Browse Source

AMBARI-915. Implement App Browser for displaying and navigating Pig/Hive workflows. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1402281 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 years ago
parent
commit
e74c7cf121
59 changed files with 21712 additions and 14903 deletions
  1. 3 0
      AMBARI-666-CHANGES.txt
  2. 7 0
      ambari-web/app/controllers.js
  3. 1 1
      ambari-web/app/controllers/installer/step7_controller.js
  4. 24 0
      ambari-web/app/controllers/main/apps/item_controller.js
  5. 24 0
      ambari-web/app/controllers/main/apps/runs/item_controller.js
  6. 29 0
      ambari-web/app/controllers/main/apps/runs/jobs/bar_controller.js
  7. 23 0
      ambari-web/app/controllers/main/apps/runs/jobs/dag_controller.js
  8. 24 0
      ambari-web/app/controllers/main/apps/runs/jobs_controller.js
  9. 30 0
      ambari-web/app/controllers/main/apps/runs_controller.js
  10. 45 0
      ambari-web/app/controllers/main/apps_controller.js
  11. 18 2
      ambari-web/app/controllers/main/host.js
  12. 1 0
      ambari-web/app/initialize.js
  13. 5 1
      ambari-web/app/models.js
  14. 68 0
      ambari-web/app/models/app.js
  15. 75 0
      ambari-web/app/models/background_operation.js
  16. 79 0
      ambari-web/app/models/job.js
  17. 56 0
      ambari-web/app/models/jobs.js
  18. 178 0
      ambari-web/app/models/run.js
  19. 65 0
      ambari-web/app/routes/main.js
  20. 0 171
      ambari-web/app/styles/app.css
  21. 196 1
      ambari-web/app/styles/application.less
  22. 1 1
      ambari-web/app/templates/main.hbs
  23. 53 0
      ambari-web/app/templates/main/apps.hbs
  24. 20 0
      ambari-web/app/templates/main/apps/item.hbs
  25. 63 0
      ambari-web/app/templates/main/apps/runs.hbs
  26. 21 0
      ambari-web/app/templates/main/apps/runs/item.hbs
  27. 24 0
      ambari-web/app/templates/main/apps/runs/jobs.hbs
  28. 57 0
      ambari-web/app/templates/main/apps/runs/jobs/bar.hbs
  29. 54 0
      ambari-web/app/templates/main/apps/runs/jobs/dag.hbs
  30. 35 0
      ambari-web/app/templates/main/host/background_operations_popup.hbs
  31. 43 0
      ambari-web/app/utils/data_table.js
  32. 54 0
      ambari-web/app/utils/date.js
  33. 191 0
      ambari-web/app/utils/graph.js
  34. 8 0
      ambari-web/app/views.js
  35. 0 1
      ambari-web/app/views/main.js
  36. 24 0
      ambari-web/app/views/main/apps/item_view.js
  37. 26 0
      ambari-web/app/views/main/apps/runs/item_view.js
  38. 49 0
      ambari-web/app/views/main/apps/runs/jobs/bar_view.js
  39. 51 0
      ambari-web/app/views/main/apps/runs/jobs/dag_view.js
  40. 51 0
      ambari-web/app/views/main/apps/runs/jobs/menu_view.js
  41. 29 0
      ambari-web/app/views/main/apps/runs/jobs_view.js
  42. 63 0
      ambari-web/app/views/main/apps/runs_view.js
  43. 89 0
      ambari-web/app/views/main/apps_view.js
  44. 21 1
      ambari-web/app/views/main/host.js
  45. 4 3
      ambari-web/app/views/main/menu.js
  46. 19 9
      ambari-web/config.coffee
  47. 3 3
      ambari-web/test/main/host/details_test.js
  48. 1085 0
      ambari-web/vendor/scripts/cubism.v1.js
  49. 0 14709
      ambari-web/vendor/scripts/jquery-ui-1.9.0.custom.js
  50. 11272 0
      ambari-web/vendor/scripts/jquery.dataTables.js
  51. 334 0
      ambari-web/vendor/scripts/jquery.ui.core.js
  52. 2224 0
      ambari-web/vendor/scripts/jquery.ui.custom-effects.js
  53. 1854 0
      ambari-web/vendor/scripts/jquery.ui.datepicker.js
  54. 175 0
      ambari-web/vendor/scripts/jquery.ui.mouse.js
  55. 662 0
      ambari-web/vendor/scripts/jquery.ui.slider.js
  56. 1087 0
      ambari-web/vendor/scripts/jquery.ui.sortable.js
  57. 276 0
      ambari-web/vendor/scripts/jquery.ui.widget.js
  58. 665 0
      ambari-web/vendor/scripts/workflow_visualization.js
  59. 74 0
      ambari-web/vendor/styles/cubism.css

+ 3 - 0
AMBARI-666-CHANGES.txt

@@ -12,6 +12,9 @@ AMBARI-666 branch (unreleased changes)
 
   NEW FEATURES
 
+  AMBARI-915. Implement App Browser for displaying and navigating Pig/Hive
+  workflows. (yusaku)
+
   AMBARI-907. Add support for getting multiple objects in controller.
   (hitesh)
 

+ 7 - 0
ambari-web/app/controllers.js

@@ -56,6 +56,13 @@ require('controllers/main/charts/heatmap');
 require('controllers/main/charts/horizon_chart');
 require('controllers/main/charts/horizon_chart');
 require('controllers/main/rack');
+require('controllers/main/apps_controller');
+require('controllers/main/apps/item_controller');
+require('controllers/main/apps/runs_controller');
+require('controllers/main/apps/runs/item_controller');
+require('controllers/main/apps/runs/jobs_controller');
+require('controllers/main/apps/runs/jobs/dag_controller');
+require('controllers/main/apps/runs/jobs/bar_controller');
 require('controllers/wizard/step2_controller');
 require('controllers/wizard/step3_controller');
 require('controllers/wizard/step4_controller');

+ 1 - 1
ambari-web/app/controllers/installer/step7_controller.js

@@ -312,7 +312,7 @@ App.SlaveComponentGroupsController = Ember.ArrayController.extend({
         return component.groups;
       }
     }
-  }.property('selectedComponentName'),
+  }.property('selectedSlaveComponent'),
 
   getHostsByGroup: function(group){
     var component = this.get('selectedSlaveComponent');

+ 24 - 0
ambari-web/app/controllers/main/apps/item_controller.js

@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.MainAppsItemController = Em.Controller.extend({
+  name:'mainAppsItemController',
+  content:null
+})

+ 24 - 0
ambari-web/app/controllers/main/apps/runs/item_controller.js

@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.MainAppsRunsItemController = Em.Controller.extend({
+  name:'mainAppsRunsItemController',
+  content:null
+})

+ 29 - 0
ambari-web/app/controllers/main/apps/runs/jobs/bar_controller.js

@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.MainAppsRunsJobsBarController = Em.ArrayController.extend({
+  name:'mainAppsRunsJobsBarController',
+  job:null,
+  activeJobId:null,
+  selectJob:function (event) {
+    this.set('job', event.context);
+    this.set('activeJobId', event.context.get('jobId'));
+  }
+})

+ 23 - 0
ambari-web/app/controllers/main/apps/runs/jobs/dag_controller.js

@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.MainJobsAppsRunsDagController = Em.ArrayController.extend({
+  name:'mainJobsAppsRunsDagController'
+})

+ 24 - 0
ambari-web/app/controllers/main/apps/runs/jobs_controller.js

@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.MainAppsRunsJobsController = Em.ArrayController.extend({
+  name:'mainAppsRunsJobsController',
+  content: null
+})

+ 30 - 0
ambari-web/app/controllers/main/apps/runs_controller.js

@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.MainAppsRunsController = Em.ArrayController.extend({
+  name:'mainAppsRunsController',
+  content:null,
+  routeHome:function () {
+    App.router.get('mainAppsController').get('routeHome')();
+  },
+  routeApps:function () {
+    App.router.transitionTo('main.apps');
+  }
+})

+ 45 - 0
ambari-web/app/controllers/main/apps_controller.js

@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.MainAppsController = Em.ArrayController.extend({
+  name:'mainAppsController',
+  content:App.App.find(),
+  routeHome:function () {
+    App.router.transitionTo('main.dashboard');
+    var view = Ember.View.views['main_menu'];
+    $.each(view._childViews, function () {
+      this.set('active', this.get('content.routing') == 'dashboard' ? "active" : "");
+    });
+  },
+  arrayUnique:function (array) {
+    var result = new Array();
+    var i, j, unique;
+    for (i = 0; i < array.length; i++) {
+      j = 0;
+      unique = true;
+      do {
+        if (array[i] === result[j]) unique = false;
+        j++;
+      } while (j < result.length);
+      if (unique) result.push(array[i]);
+    }
+    return result;
+  }
+})

+ 18 - 2
ambari-web/app/controllers/main/host.js

@@ -20,6 +20,7 @@ var App = require('app');
 require('models/service');
 require('models/cluster');
 require('models/host');
+require('models/background_operation');
 
 App.MainHostController = Em.ArrayController.extend(App.Pagination, {
   name:'mainHostController',
@@ -40,10 +41,25 @@ App.MainHostController = Em.ArrayController.extend(App.Pagination, {
     return this.get('sortingAsc')? 'icon-arrow-down' : 'icon-arrow-up';
   }.property('sortingAsc'),
   isDisabled:true,
+  operations: App.BackgroundOperation.find(),
 
   backgroundOperationsCount: function() {
-    return 5;
-  }.property(),
+    return this.get('operations.length');
+  }.property('operations.length'),
+
+  showBackgroundOperationsPopup: function(){
+    var self = this;
+    App.ModalPopup.show({
+      header: self.get('backgroundOperationsCount') + ' Background Operations Running',
+      bodyClass: Ember.View.extend({
+        controllerBinding: 'App.router.mainHostController',
+        templateName: require('templates/main/host/background_operations_popup')
+      }),
+      onPrimary: function() {
+        this.hide();
+      }
+    });
+  },
 
   onAllChecked: function () {
     var hosts = this.get('content');

+ 1 - 0
ambari-web/app/initialize.js

@@ -20,6 +20,7 @@
 window.App = require('app');
 
 require('messages');
+require('utils/data_table');
 require('utils/db');
 require('utils/helper');
 require('models');

+ 5 - 1
ambari-web/app/models.js

@@ -31,4 +31,8 @@ require('models/alert');
 require('models/user');
 require('models/pagination');
 require('models/host');
-require('models/rack');
+require('models/rack');
+require('models/job');
+require('models/run');
+require('models/app');
+require('models/background_operation');

+ 68 - 0
ambari-web/app/models/app.js

@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+
+App.App = DS.Model.extend({
+  appName:DS.attr('string'),
+  type:DS.attr('string'),
+  numJobsTotal:DS.attr('number'),
+  userName:DS.attr('string'),
+  executionTime:DS.attr('string'),
+  runs:DS.hasMany('App.Run')
+});
+
+App.App.FIXTURES = [
+  {
+    id:1,
+    app_name:'pigs.sh',
+    type:'Hive',
+    num_jobs_total:5,
+    user_name:'root',
+    execution_time:'1347629541543',
+    runs:[1, 2, 3]
+  },
+  {
+    id:2,
+    app_name:'pigsm.sh',
+    type:'pig',
+    num_jobs_total:3,
+    user_name:'user1',
+    execution_time:'1347656741515',
+    runs:[6, 4, 5]
+  },
+  {
+    id:3,
+    app_name:'pigsmo.sh',
+    type:'pig',
+    num_jobs_total:4,
+    user_name:'user3',
+    execution_time:'1347629587687',
+    runs:[7, 8, 9, 10, 11]
+  },
+  {
+    id:4,
+    app_name:'pigsmok.sh',
+    type:'MapReduce',
+    num_jobs_total:0,
+    user_name:'root',
+    execution_time:'134762957834',
+    runs:[]
+  }
+]

+ 75 - 0
ambari-web/app/models/background_operation.js

@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+
+App.BackgroundOperation = DS.Model.extend({
+  operationName:DS.attr('string'),
+  events: DS.hasMany('App.BackgroundOperationEvent'),
+  cluster:DS.belongsTo('App.Cluster'),
+  host:DS.belongsTo('App.Host'),
+  operationLog: DS.attr('string')
+});
+
+App.BackgroundOperation.FIXTURES = [
+  {
+    id:1,
+    operation_name:'Decommissioning host1',
+    operation_log:'Decommissioning log',
+    events:[1,2],
+    cluster_id:1,
+    host_id:1
+  },
+  {
+    id:2,
+    operation_name:'Starting DataNode on host4',
+    operation_log:'Starting DataNode log',
+    events:[3],
+    cluster_id:1,
+    host_id:1
+  }
+];
+
+App.BackgroundOperationEvent = DS.Model.extend({
+  eventName:DS.attr('string'),
+  operation:DS.belongsTo('App.BackgroundOperation'),
+  eventDate: DS.attr('string')
+});
+
+App.BackgroundOperationEvent.FIXTURES = [
+  {
+    id:1,
+    event_name:'Some intermediate operation',
+    operation_id:1,
+    event_date:'4 min ago'
+  },
+  {
+    id:2,
+    event_name:'Operation started',
+    operation_id:1,
+    event_date:'5 min ago'
+  },
+  {
+    id:3,
+    event_name:'Operation started',
+    operation_id:2,
+    event_date:'5 min ago'
+  }
+];
+

File diff suppressed because it is too large
+ 79 - 0
ambari-web/app/models/job.js


+ 56 - 0
ambari-web/app/models/jobs.js

@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+
+App.JobsInfo = Ember.Object.extend({
+  elementId:'jobs',
+  jobsName:'',
+  displayName:'',
+  isMaster:'',
+  isClient:'',
+  isDisabled:'',
+  isHidden:'',
+  isSelected:'true',
+  description:''
+});
+
+App.JobsModel = Em.Object.extend({
+  name:null,
+  components:[]
+});
+
+App.Jobs = DS.Model.extend({
+  jobsName:DS.attr('string'),
+  label:DS.attr('string')
+});
+
+
+App.Jobs.FIXTURES = [
+  {
+    id:1,
+    jobsName:'dag',
+    label:'DAG'
+  },
+  {
+    id:2,
+    jobsName:'bar',
+    label:'BAR'
+  }
+];

+ 178 - 0
ambari-web/app/models/run.js

@@ -0,0 +1,178 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+
+App.Run = DS.Model.extend({
+  workflowId:DS.attr('string'),
+  parentWorkflowId:DS.attr('string'),
+  workflowContext:DS.attr('string'),
+  userName:DS.attr('string'),
+  startTime:DS.attr('string'),
+  lastUpdateTime:DS.attr('string'),
+  numJobsTotal:DS.attr('number'),
+  numJobsCompleted:DS.attr('number'),
+  app:DS.belongsTo('App.App'),
+  jobs:DS.hasMany('App.Job')
+});
+
+App.Run.FIXTURES = [
+  {
+    id:1,
+    workflow_id:'pig_1',
+    parent_workflow_id:null,
+    workflow_context:'{dag: {"1":["2","3"],"2":["3","4"],"4":["2","5"]}}',
+    user_name:'user3',
+    start_time:1347629541501,
+    last_update_time:1347639541501,
+    num_jobs_total:5,
+    num_jobs_completed:0,
+    app:1,
+    jobs:[1, 2, 3, 4, 5]
+  },
+  {
+    id:2,
+    workflow_id:'pig_3',
+    parent_workflow_id:null,
+    workflow_context:'{dag:{"4":["5","1"],"3":["6"],"6":["4"],"1":["5"]}}',
+    user_name:'user1',
+    start_time:1347629951502,
+    last_update_time:1347639951502,
+    num_jobs_total:5,
+    num_jobs_completed:2,
+    app:3,
+    jobs:[4, 5, 1, 3, 6]
+  },
+  {
+    id:3,
+    workflow_id:'pig_5',
+    parent_workflow_id:null,
+    workflow_context:'{dag:{"6":["7","8"],"9":["8"],"10":["6"],"9":["7"]}}',
+    user_name:'user1',
+    start_time:1347629841503,
+    last_update_time:1347639841503,
+    num_jobs_total:5,
+    num_jobs_completed:0,
+    jobs:[6, 7, 8, 9, 10]
+  },
+  {
+    id:4,
+    workflow_id:'pig_5',
+    parent_workflow_id:null,
+    workflow_context:'{dag:{"8":["9","10"],"9":["10"]}}',
+    user_name:'user1',
+    start_time:1347629541504,
+    last_update_time:1347639541504,
+    num_jobs_total:3,
+    num_jobs_completed:0,
+    app:2,
+    jobs:[8, 9, 10]
+  },
+  {
+    id:5,
+    workflow_id:'pig_5',
+    parent_workflow_id:null,
+    workflow_context:'{dag:{"8":["9","10"],"8":["10","9"]}}',
+    user_name:'user1',
+    start_time:1347629541505,
+    last_update_time:1347639541505,
+    num_jobs_total:3,
+    num_jobs_completed:0,
+    app:2,
+    jobs:[8, 9, 10]
+  },
+  {
+    id:6,
+    workflow_id:'pig_5',
+    parent_workflow_id:null,
+    workflow_context:'{dag:{"8":["9","10"],"9":["10","8"]}}',
+    user_name:'user1',
+    start_time:1347629541506,
+    last_update_time:1347639541506,
+    num_jobs_total:3,
+    num_jobs_completed:0,
+    app:2,
+    jobs:[8, 9, 10]
+  },
+  {
+    id:7,
+    workflow_id:'pig_5',
+    parent_workflow_id:null,
+    workflow_context:'{dag:{"1":["3","5"],"5":["7"],"3":["1"]}}',
+    user_name:'user1',
+    start_time:1347629541507,
+    last_update_time:1347639541507,
+    num_jobs_total:4,
+    num_jobs_completed:0,
+    app:3,
+    jobs:[1, 3, 5, 7]
+  },
+  {
+    id:8,
+    workflow_id:'pig_5',
+    parent_workflow_id:null,
+    workflow_context:'{dag:{"1":["3","5"],"5":["7"],"3":["1"]}}',
+    user_name:'user1',
+    start_time:1347629541508,
+    last_update_time:1347639541508,
+    num_jobs_total:4,
+    num_jobs_completed:0,
+    app:3,
+    jobs:[1, 3, 5, 7]
+  },
+  {
+    id:9,
+    workflow_id:'pig_5',
+    parent_workflow_id:null,
+    workflow_context:'{dag:{"1":["3","5"],"5":["7"],"3":["1"]}}',
+    user_name:'user1',
+    start_time:1347629541509,
+    last_update_time:1347639541509,
+    num_jobs_total:4,
+    num_jobs_completed:0,
+    app:3,
+    jobs:[1, 3, 5, 7]
+  },
+  {
+    id:10,
+    workflow_id:'pig_5',
+    parent_workflow_id:null,
+    workflow_context:'{dag:{"1":["3","5"],"5":["7"],"3":["1"]}}',
+    user_name:'user1',
+    start_time:1347629541510,
+    last_update_time:1347639541510,
+    num_jobs_total:4,
+    num_jobs_completed:0,
+    app:3,
+    jobs:[1, 3, 5, 7]
+  },
+  {
+    id:11,
+    workflow_id:'pig_5',
+    parent_workflow_id:null,
+    workflow_context:'{dag:{"1":["3","5"],"5":["7"],"3":["1"]}}',
+    user_name:'user1',
+    start_time:1347629541511,
+    last_update_time:1347639541511,
+    num_jobs_total:4,
+    num_jobs_completed:0,
+    app:3,
+    jobs:[1, 3, 5, 7]
+  }
+];

+ 65 - 0
ambari-web/app/routes/main.js

@@ -76,6 +76,71 @@ module.exports = Em.Route.extend({
       router.transitionTo(event.context);
     }
   }),
+  apps:Em.Route.extend({
+    route:'/apps',
+    connectOutlets:function (router, context) {
+      console.log(1245);
+      router.get('mainController').connectOutlet('mainApps');
+    },
+    index:Ember.Route.extend({
+      route:'/'
+    }),
+    showApp:function (router, event) {
+      router.transitionTo('appItem.runs', event.context);
+    }
+  }),
+  appItem:Em.Route.extend({
+    route:'apps/:app_id',
+    connectOutlets:function (router, app) {
+      router.get('mainAppsController').connectOutlet('mainAppsItem', app);//outlet connect when use only mainController
+    },
+    index:Ember.Route.extend({
+      route:'/'
+    }),
+    runs:Em.Route.extend({
+      route:'/runs',
+      connectOutlets:function (router, context) {
+        router.get('mainController').connectOutlet('mainAppsRuns');
+      },
+      showRun:function (router, event) {
+        router.transitionTo('runItem.jobs.index', event.context);
+      }
+    }),
+    runItem:Em.Route.extend({
+      route:'/runs/:workflow_id',
+      connectOutlets:function (router, run) {
+        router.get('mainController').connectOutlet('mainAppsRunsItem', run);
+      },
+      jobs:Em.Route.extend({
+        route:'/jobs',
+        connectOutlets:function (router, context) {
+          router.get('mainController').connectOutlet('mainAppsRunsJobs');
+        },
+        index:Ember.Route.extend({
+          route:'/',
+          redirectsTo:'dag'
+        }),
+        dag:Em.Route.extend({
+          route:'dag',
+          connectOutlets:function (router, context) {
+            router.get('mainAppsRunsJobsController').connectOutlet('mainAppsRunsJobsDag');
+          }
+        }),
+        bar:Em.Route.extend({
+          route:'bar',
+          connectOutlets:function (router, context) {
+            router.get('mainAppsRunsJobsController').connectOutlet('mainAppsRunsJobsBar');
+          }
+        }),
+        showGraph:function (router, event) {
+          var parent = event.view._parentView;
+          parent.deactivateChildViews();
+          event.view.set('active', "active");
+          router.transitionTo(event.context);
+        }
+      })
+    })
+  }),
 
   hosts:Em.Route.extend({
     route:'/hosts',

+ 0 - 171
ambari-web/app/styles/app.css

@@ -1,171 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*Services*/
-.service-summary {
-    background: #F6FAFD;
-}
-.service-block {
-    margin-top: 20px;
-}
-.service-configuration {
-    padding: 10px;
-}
-.service-summary .service-block.span8{
-    margin-left: 0;
-    border-right: 1px solid #5fa3c3;
-}
-.service-summary .service-block.span3{
-    padding-left: 0;
-}
-.service-summary .service-content{
-    padding: 5px 0 0 10px;
-}
-.service-summary h5{
-    color: #0088CC;
-    font-size: 14px;
-}
-.service-summary .service-links{
-    padding: 5px 0 10px 0;
-}
-.service-summary .service-content .service-links{
-    padding: 5px 0;
-}
-.service-configuration .dl-horizontal dt{
-    width: 90px;
-    line-height: 19px;
-}
-.service-configuration .dl-horizontal dd{
-    margin-left: 100px;
-    line-height: 19px;
-}
-.service-button {
-    text-align: right;
-    margin-bottom: 5px;
-    margin-top: -55px;
-}
-/*End Services*/
-
-/*Hosts*/
-#hosts .box-header .btn-group {
-    float: left;
-}
-#hosts .box-header .btn.decommission{
-    margin-left: 5px;
-}
-#hosts .box-header .btn.add-host-button{
-    float: right;
-}
-#hosts .table{
-    margin-bottom: 0;
-}
-#hosts .table thead{
-    background: #EDF5FC;
-}
-#hosts .table th,#hosts .table td{
-    width: 130px;
-}
-#hosts .table th.first,#hosts .table td.first{
-    width: 30px;
-}
-#hosts .table td.first label{
-    padding-top: 3px;
-}
-#hosts .table td.name span{
-    display: block;
-    float: left;
-    height: 13px;
-    margin: 4px 5px 0 0;
-    width: 13px;
-}
-#hosts .open-group > .dropdown-menu{
-    display: block;
-}
-#hosts .table ul#filter-dropdown li{
-    display: block;
-    padding: 3px 0 3px 5px;
-    line-height: 20px;
-}
-#hosts .table ul#filter-dropdown li input[type="checkbox"]{
-    margin-top: 0;
-    margin-right: 2px;
-    margin-bottom: 2px;
-    margin: 0 2px 2px;
-}
-#hosts .nav-pills li.disabled{
-    display: block;
-    margin: 2px 0;
-    padding: 8px 12px;
-    line-height: 14px;
-}
-#hosts .box-footer .footer-pagination{
-    float: right;
-}
-#hosts .box-footer .footer-pagination .nav{
-    margin-bottom: 0;
-}
-#hosts .box-footer .footer-pagination .dropdown{
-    margin-top: 3px;
-}#hosts .box-footer .footer-pagination .dropdown{
-     margin-top: 3px;
- }
-#hosts .box-footer .footer-pagination .dropdown select{
-    width: 60px;
-}
-#hosts .box-footer .footer-pagination .page-listing a{
-    line-height: 0;
-    border: none;
-    margin: 0;
-    margin-right: 10px;
-    cursor: pointer;
-    color: #0088CC;
-    padding: 8px 0;
-    float: left;
-    text-decoration: underline;
-}
-#hosts .box-footer .footer-pagination .page-listing a:hover{
-    text-decoration: none;
-}
-#hosts .box-footer .footer-pagination .page-listing{
-    width: 100px;
-}
-
-/*End Hosts*/
-/*fieldset begin*/
-.fieldset {
-    border: 2px solid black;
-    padding: 10px;
-} 
-.fieldset legend {
-    border-bottom: none;
-    width: auto;
-    font-size: 14px;
-}
-/*fieldset end*/
-/*Start Carousel*/
-.carousel-inner {
-    height: 80px;
-}
-/*End Carousel*//*End Hosts*/
-
-#add-host .back,
-#add-service .back{
-    display: block;
-    width: 105px;
-    margin-bottom: 10px;
-}

+ 196 - 1
ambari-web/app/styles/application.less

@@ -657,6 +657,60 @@ a:focus {
   }
 }
 
+.service-block {
+  margin-top: 20px;
+}
+
+.service-configuration {
+  padding: 10px;
+}
+
+.service-summary {
+  background: #F6FAFD;
+  .service-block.span8 {
+    margin-left: 0;
+    border-right: 1px solid #5fa3c3;
+  }
+  .service-block.span3 {
+    padding-left: 0;
+  }
+  .service-content {
+    padding: 5px 0 0 10px;
+    .service-links{
+      padding: 5px 0;
+    }
+  }
+  h5 {
+    color: #0088CC;
+    font-size: 14px;
+  }
+  .service-links {
+    padding: 5px 0 10px 0;
+  }
+  .service-configuration .dl-horizontal {
+    dt {
+      width: 90px;
+      line-height: 19px;
+    }
+    dd {
+      margin-left: 100px;
+      line-height: 19px;
+    }
+  }
+}
+
+.service-button {
+  text-align: right;
+  margin-bottom: 5px;
+  margin-top: -55px;
+  ul.dropdown-menu {
+    li {
+      text-align: left;
+    }
+  }
+
+}
+
 /*End Services*/
 
 /*Hosts*/
@@ -667,6 +721,91 @@ a:focus {
   .health-status-DEAD {
     background-image: @status-dead-marker;
   }
+  .box-header {
+    .btn-group {
+      float: left;
+    }
+    .btn.decommission {
+      margin-left: 5px;
+    }
+    .btn.add-host-button {
+      float: right;
+    }
+  }
+  .table {
+    margin-bottom: 0;
+    thead {
+      background: #EDF5FC;
+    }
+    th, td {
+      width: 130px;
+    }
+    th.first, td.first {
+      width: 30px;
+    }
+    td.first label {
+      padding-top: 3px;
+    }
+    td.name span {
+      display: block;
+      float: left;
+      height: 13px;
+      margin: 4px 5px 0 0;
+      width: 13px;
+    }
+    ul#filter-dropdown li {
+      display: block;
+      padding: 3px 0 3px 5px;
+      line-height: 20px;
+    }
+    ul#filter-dropdown li input[type="checkbox"] {
+      margin-top: 0;
+      margin-right: 2px;
+      margin-bottom: 2px;
+      margin: 0 2px 2px;
+    }
+  }
+  .open-group > .dropdown-menu {
+    display: block;
+  }
+  .nav-pills li.disabled {
+    display: block;
+    margin: 2px 0;
+    padding: 8px 12px;
+    line-height: 14px;
+  }
+  .box-footer .footer-pagination {
+    float: right;
+    .nav {
+      margin-bottom: 0;
+    }
+    .dropdown {
+      margin-top: 3px;
+    }
+    .dropdown {
+       margin-top: 3px;
+     }
+    .dropdown select {
+      width: 60px;
+    }
+    .page-listing a {
+      line-height: 0;
+      border: none;
+      margin: 0;
+      margin-right: 10px;
+      cursor: pointer;
+      color: #0088CC;
+      padding: 8px 0;
+      float: left;
+      text-decoration: underline;
+    }
+    .page-listing a:hover {
+      text-decoration: none;
+    }
+    .page-listing {
+      width: 100px;
+    }
+  }
 }
 
 #host-details {
@@ -718,7 +857,32 @@ a:focus {
     margin: 0 5px 10px 0;
   }
 }
-
+.background-operations {
+  .open-details{
+    clear: left;
+    display: block;
+    float: left;
+    text-decoration: none;
+    width: 16px;
+  }
+  .operation-details {
+    .operation-log{
+      display: none;
+    }
+    .operation-log.open{
+      display: block;
+    }
+    padding-left: 16px;
+    padding-top: 5px;
+    display: none;
+  }
+margin-bottom: 10px;
+}
+.background-operations.is-open {
+  .operation-details {
+    display: block;
+  }
+}
 /*End Hosts*/
 
 /*assign masters*/
@@ -1125,6 +1289,12 @@ ul.filter {
   /* opacity: 0.2; */
     z-index: 2;
   }
+
+  ul.dropdown-menu {
+    li {
+      text-align: left;
+    }
+  }
 }
 
 .linear {
@@ -1263,3 +1433,28 @@ ul.inline li {
 }
 
 /* TIME RANGE WIDGET END */
+
+/* fieldset begin */
+.fieldset {
+  border: 2px solid black;
+  padding: 10px;
+}
+.fieldset legend {
+  border-bottom: none;
+  width: auto;
+  font-size: 14px;
+}
+/* fieldset end */
+
+/* Start Carousel */
+.carousel-inner {
+  height: 80px;
+}
+/* End Carousel*/
+
+#add-host .back,
+#add-service .back{
+  display: block;
+  width: 105px;
+  margin-bottom: 10px;
+}

+ 1 - 1
ambari-web/app/templates/main.hbs

@@ -22,7 +22,7 @@
         My Cluster
         {{#if view.isInHostsPath}}
           {{#if view.backgroundOperationsCount}}
-            <span class="label operations-count">{{view.backgroundOperationsCount}}</span>
+            <span class="label operations-count" {{action "showBackgroundOperationsPopup" target="App.router.mainHostController"}}>{{view.backgroundOperationsCount}}</span>
           {{/if}}
         {{/if}}
       </a>

+ 53 - 0
ambari-web/app/templates/main/apps.hbs

@@ -0,0 +1,53 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+<div id="apps" class="box">
+  <div><a href='#' {{action "routeHome" target="controller"}}><i class="icon-home"></i></a>&nbsp;/&nbsp;Apps</div>
+  <div>Show:
+  {{view view.filterTypesView}}
+  </div>
+  <div class="box-header">
+  <h2>Application list</h2>
+    <table class="table table-bordered table-striped" id="dataTable">
+    <thead>
+    <tr>
+      <th>Application Name</th>
+      <th>Type</th>
+      <th>Runs</th>
+      <th>Jobs</th>
+      <th>User</th>
+      <th>Last Run</th>
+      <th></th>
+    </tr>
+    </thead>
+    <tbody>
+    {{#each app in view.content}}
+    <tr>
+      <td>{{app.appName}}</td>
+      <td>{{app.type}}</td>
+      <td>{{app.numRuns}}</td>
+      <td>{{app.numJobsTotal}}</td>
+      <td>{{app.userName}}</td>
+      <td>{{app.executionTime}}</td>
+      <td><a href="#"{{action "showApp" app}}>Runs</a></td>
+    </tr>
+    {{/each}}
+    </tbody>
+    </table>
+    </div>
+</div>
+

+ 20 - 0
ambari-web/app/templates/main/apps/item.hbs

@@ -0,0 +1,20 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<p>App Item</p>
+

+ 63 - 0
ambari-web/app/templates/main/apps/runs.hbs

@@ -0,0 +1,63 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<div>
+  <a href='#' {{action "routeHome" target="controller"}}><i class="icon-home"></i></a>
+  &nbsp;/&nbsp;<a href='#' {{action "routeApps" target="controller"}}>Apps</a>&nbsp;/&nbsp;
+  {{view.appItem.appName}}
+</div>
+<p>Jobs: {{view.appItem.numJobsTotal}}</p>
+<div id="runs" class="box">
+  <div class="box-header">
+  <h2>Runs list</h2>
+    <table class="table table-bordered table-striped" id="dataTable">
+    <thead>
+    <tr>
+      <th>Run &#35;</th>
+      <th>Run Date</th>
+      <th>Maps</th>
+      <th>Reduces</th>
+      <th>Input</th>
+      <th>Output</th>
+      <th>Duration</th>
+      <th></th>
+    </tr>
+    </thead>
+    <tbody>
+    {{#each run in view.content}}
+    <tr>
+      <td>
+      <label class="checkbox">
+                {{view view.RunsCheckboxView}} {{run.id}}
+      </label>
+      </td>
+      <td>{{run.startTime}}</td>
+      <td>10</td>
+      <td>15</td>
+      <td>1300</td>
+      <td>200</td>
+      <td>{{run.lastUpdateTime}}</td>
+      <td><a href="#"{{action "showRun" run}}>Details</a></td>
+    </tr>
+    {{/each}}
+    </tbody>
+    </table>
+    </div>
+</div>
+{{outlet}}
+

+ 21 - 0
ambari-web/app/templates/main/apps/runs/item.hbs

@@ -0,0 +1,21 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+
+<h2>runItem template</h2>
+

+ 24 - 0
ambari-web/app/templates/main/apps/runs/jobs.hbs

@@ -0,0 +1,24 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<h5>/{{view.appItem.appName}}/{{view.runItem.id}}</h5>
+<p>Jobs: {{view.runItem.numJobsTotal}}</p>
+<div class="content">
+  {{view App.MainJobsAppsRunsMenuView}}
+  {{outlet}}
+</div>

+ 57 - 0
ambari-web/app/templates/main/apps/runs/jobs/bar.hbs

@@ -0,0 +1,57 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<h2>Bar</h2>
+<div class="btn-group">
+  <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
+    Job
+    <span class="caret"></span>
+  </button>
+  <ul class="dropdown-menu">
+    {{#each job in view.content}}
+    <li><a {{action "selectJob" job target="controller"}} href="javascript:void(null)">{{job.id}}</a></li>
+    {{/each}}
+  </ul>
+</div>
+<div>{{controller.activeJobId}}</div>
+<div id="graph1">
+  <div style="float:left">
+    <div id="graph1_desc" class="graph_desc">
+      Job Timeline
+    </div>
+    <div id="chart"></div>
+    <div id="timeline1"></div>
+  </div>
+  <div id="legend_container" style="float:left;margin-top:60px">
+    <div id="legend"></div>
+  </div>
+  <div style="clear: both"></div>
+</div>
+<div id="graph2">
+  <div style="float:left">
+    <div id="graph2_desc" class="graph_desc">
+      Job Tasks' View
+    </div>
+    <div id="job_tasks"></div>
+    <div id="timeline2"></div>
+  </div>
+  <div id="tasks_legend_container" style="float:left;margin-top:60px">
+    <div id="tasks_legend"></div>
+  </div>
+  <div style="clear: both"></div>
+</div>

+ 54 - 0
ambari-web/app/templates/main/apps/runs/jobs/dag.hbs

@@ -0,0 +1,54 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+<div id="jobs" class="box">
+  <div class="box-header">
+  <div>
+  <div id="dag_viewer"></div>
+  </div>
+  <h2>Jobs list</h2>
+    <table class="table table-bordered table-striped" id="dataTable">
+    <thead>
+    <tr>
+      <th>Job &#35;</th>
+      <th>Job Id</th>
+      <th>Status</th>
+      <th>Maps</th>
+      <th>Reduces</th>
+      <th>Input</th>
+      <th>Output</th>
+      <th>Duration</th>
+    </tr>
+    </thead>
+    <tbody>
+    {{#each job in view.content}}
+    <tr>
+      <td>{{job.id}}</td>
+      <td>{{job.jobId}}</td>
+      <td>{{job.status}}</td>
+      <td>{{job.maps}}</td>
+      <td>{{job.reduces}}</td>
+      <td>{{job.input}}</td>
+      <td>{{job.output}}</td>
+      <td>{{job.mapsRuntime}}</td>
+    </tr>
+    {{/each}}
+    </tbody>
+    </table>
+  </div>
+</div>
+

+ 35 - 0
ambari-web/app/templates/main/host/background_operations_popup.hbs

@@ -0,0 +1,35 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+{{#each operation in operations}}
+{{#view App.MainBackgroundOperation contentBinding="operation"}}
+<a class="open-details" {{action openDetails target="view"}} href="#">
+  <i {{bindAttr class="view.iconClass"}}></i>
+</a>
+{{operation.operationName}}
+<div class="operation-details">
+  {{#each event in operation.events}}
+  <div>{{event.eventDate}}: {{event.eventName}}</div>
+  {{/each}}
+  <a {{action showLog target="view"}} href="#">
+    {{#if view.isOpenShowLog}}Hide{{else}}Show{{/if}} operation log
+  </a>
+  <div {{bindAttr class="view.showLogClass"}}>{{operation.operationLog}}</div>
+</div>
+{{/view}}
+{{/each}}

+ 43 - 0
ambari-web/app/utils/data_table.js

@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+jQuery.extend(jQuery.fn.dataTableExt.oSort, {
+  // @see utils/date.js
+  "ambari-date-pre":function (date_string) {
+    date_string = $(date_string).text(); // strip Ember script tags
+    var date = date_string.substring(4);
+    var month = date.substring(1, 4);
+    var day = date.substring(5, 7);
+    var year = date.substring(9, 13);
+    var hours = date.substring(14, 16);
+    var minutes = date.substring(17, 19);
+
+    var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
+    month = months.indexOf(month);
+    if (month < 10) month = '0' + month;
+    return year + month + day + hours + minutes;
+  },
+
+  "ambari-date-asc":function (a, b) {
+    return a - b;
+  },
+
+  "ambari-date-desc":function (a, b) {
+    return b - a;
+  }
+});

+ 54 - 0
ambari-web/app/utils/date.js

@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var validator = require('utils/validator');
+
+module.exports = {
+  dateMonths:['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+  dateDays:['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+  dateFormatZeroFirst:function (time) {
+    if (time < 10) return '0' + time;
+    return time;
+  },
+  /**
+   * Convert timestamp to date-string 'DAY_OF_THE_WEEK, MONTH DAY, YEAR HOURS:MINUTES'
+   * @param timestamp
+   * @return date-string
+   */
+  dateFormat:function (timestamp) {
+    if (!validator.isValidInt(timestamp)) return timestamp;
+    var date = new Date(timestamp * 1);
+    var months = this.dateMonths;
+    var days = this.dateDays;
+    return days[date.getDay()] + ', ' + months[date.getMonth()] + ' ' + this.dateFormatZeroFirst(date.getDate()) + ', ' + date.getFullYear() + ' ' + this.dateFormatZeroFirst(date.getHours()) + ':' + this.dateFormatZeroFirst(date.getMinutes());
+  },
+  /**
+   * Convert time in seconds to 'HOURS:MINUTES:SECONDS'
+   * @param seconds
+   * @return formated date-string
+   */
+  dateFormatInterval:function (timestamp_interval) {
+    if (!validator.isValidInt(timestamp_interval)) return timestamp_interval;
+    var hours = Math.floor(timestamp_interval / (60 * 60));
+    var divisor_for_minutes = timestamp_interval % (60 * 60);
+    var minutes = Math.floor(divisor_for_minutes / 60);
+    var divisor_for_seconds = divisor_for_minutes % 60;
+    var seconds = Math.ceil(divisor_for_seconds);
+    return (hours < 10 ? '0' : '') + hours + ':' + (minutes < 10 ? '0' : '') + minutes + ':' + (seconds < 10 ? '0' : '') + seconds;
+  }
+}

+ 191 - 0
ambari-web/app/utils/graph.js

@@ -0,0 +1,191 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+module.exports = {
+  drawJobTimeline:function (json_str, w, h, element, legend_id, timeline_id) {
+    var json = $.parseJSON(json_str);
+    if (!json) {
+      return new Error("unable to load data");
+    }
+
+    var graph = new Rickshaw.Graph({
+      width:w,
+      height:h,
+      element:document.querySelector(element),
+      renderer:'area',
+      stroke:true,
+      series:[
+        {
+          data:json[0],
+          color:'green',
+          name:'maps'
+        },
+        {
+          data:json[1],
+          color:'lightblue',
+          name:'shuffles'
+        },
+        {
+          data:json[2],
+          color:'steelblue',
+          name:'reduces'
+        }
+      ]
+      }
+    );
+
+    graph.render();
+
+    var legend = new Rickshaw.Graph.Legend({
+      graph:graph,
+      element:document.getElementById(legend_id)
+    });
+
+    var shelving = new Rickshaw.Graph.Behavior.Series.Toggle({
+      graph:graph,
+      legend:legend
+    });
+
+    var order = new Rickshaw.Graph.Behavior.Series.Order({
+      graph:graph,
+      legend:legend
+    });
+
+    var highlight = new Rickshaw.Graph.Behavior.Series.Highlight({
+      graph:graph,
+      legend:legend
+    });
+
+    var xAxis = new Rickshaw.Graph.Axis.Time({
+
+      graph:graph
+    });
+    xAxis.render();
+
+    var yAxis = new Rickshaw.Graph.Axis.Y({
+
+      graph:graph
+    });
+    yAxis.render();
+
+    var hoverDetail = new Rickshaw.Graph.HoverDetail({
+      graph:graph,
+      yFormatter:function (y) {
+        return Math.floor(y) + " tasks"
+      }
+    });
+
+    var annotator = new Rickshaw.Graph.Annotate({
+      graph:graph,
+      element:document.getElementById(timeline_id)
+    });
+  },
+  drawJobTasks:function (json_str, w, h, element, legend_id, timeline_id) {
+    var json = $.parseJSON(json_str);
+    if (!json) {
+      return new Error("unable to load data");
+    }
+
+    var graph = new Rickshaw.Graph({
+      width:w,
+      height:h,
+      element:document.querySelector(element),
+      renderer:'scatterplot',
+      stroke:true,
+      series:[
+        {
+          data:json[0],
+          color:'green',
+          name:'node_local_map'
+        },
+        {
+          data:json[1],
+          color:'lightblue',
+          name:'rack_local_map'
+        },
+        {
+          data:json[2],
+          color:'brown',
+          name:'off_switch_map'
+        },
+        {
+          data:json[3],
+          color:'red',
+          name:'reduce'
+        },
+      ]
+    });
+    graph.render();
+    var legend = new Rickshaw.Graph.Legend({
+      graph:graph,
+      element:document.getElementById(legend_id)
+    });
+
+    var shelving = new Rickshaw.Graph.Behavior.Series.Toggle({
+      graph:graph,
+      legend:legend
+    });
+
+    var order = new Rickshaw.Graph.Behavior.Series.Order({
+      graph:graph,
+      legend:legend
+    });
+
+    var highlight = new Rickshaw.Graph.Behavior.Series.Highlight({
+      graph:graph,
+      legend:legend
+    });
+
+    var ticksTreatment = 'glow';
+
+    var xAxis = new Rickshaw.Graph.Axis.Time({
+      graph:graph,
+      ticksTreatment:ticksTreatment,
+    });
+    xAxis.render();
+
+    var yAxis = new Rickshaw.Graph.Axis.Y({
+      graph:graph,
+      ticksTreatment:ticksTreatment,
+    });
+    yAxis.render();
+
+    var hoverDetail = new Rickshaw.Graph.HoverDetail({
+      graph:graph,
+      xFormatter:function (x) {
+        return (x - json[4].submitTime) / 1000 + 's'
+      },
+      yFormatter:function (y) {
+        return y / 1000 + 's'
+      },
+      formatter:function (series, x, y, formattedX, formattedY, d) {
+        var swatch = '<span class="detail_swatch" style="background-color: ' + series.color + '"></span>';
+        return swatch + d.label +
+          '<br>Run-time: ' + formattedY + '<br>Wait-time: ' + formattedX;
+      },
+
+    });
+    var annotator = new Rickshaw.Graph.Annotate({
+      graph:graph,
+      element:document.getElementById(timeline_id)
+    });
+    annotator.add(1337970759432, 'Lost tasktracker');
+    graph.update();
+  }
+}

+ 8 - 0
ambari-web/app/views.js

@@ -77,6 +77,14 @@ require('views/main/charts/horizon/chart');
 require('views/main/charts/heatmap/heatmap_rack');
 require('views/main/charts/heatmap/heatmap_host');
 require('views/main/charts/heatmap/heatmap_host_detail');
+require('views/main/apps_view');
+require('views/main/apps/runs_view');
+require('views/main/apps/item_view');
+require('views/main/apps/runs/item_view');
+require('views/main/apps/runs/jobs_view');
+require('views/main/apps/runs/jobs/bar_view');
+require('views/main/apps/runs/jobs/dag_view');
+require('views/main/apps/runs/jobs/menu_view');
 require('views/installer');
 require('views/installer/step1_view');
 require('views/installer/step2_view');

+ 0 - 1
ambari-web/app/views/main.js

@@ -23,7 +23,6 @@ App.MainView = Em.View.extend({
 
   templateName: require('templates/main'),
   isInHostsPath: function(){
-    console.log(App.router.get('currentState.name'))
     return App.router.get('currentState.name') === 'hosts';
   }.property('App.router.currentState.name'),
   backgroundOperationsCount:function () {

+ 24 - 0
ambari-web/app/views/main/apps/item_view.js

@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.MainAppsItemView = Em.View.extend({
+  templateName:require('templates/main/apps/item'),
+  content:null
+});

+ 26 - 0
ambari-web/app/views/main/apps/runs/item_view.js

@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.MainAppsRunsItemView = Em.View.extend({
+  templateName:require('templates/main/apps/runs/item'),
+  content:function () {
+    return App.router.get('mainAppsRunsItemController.content');
+  }.property('App.router.mainAppsRunsItemController.content')
+});

+ 49 - 0
ambari-web/app/views/main/apps/runs/jobs/bar_view.js

@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+var graph = require('utils/graph');
+App.MainAppsRunsJobsBarView = Em.View.extend({
+  templateName:require('templates/main/apps/runs/jobs/bar'),
+  content:function () {
+    return App.router.get('mainAppsRunsItemController.content').get('jobs');
+  }.property('App.router.mainAppsRunsItemController.content'),
+  firstJob:function () {
+    return this.get('content').get('firstObject');
+  }.property('content'),
+  didInsertElement:function () {
+    this.get('controller').set('activeJobId', this.get('firstJob').get('jobId'));
+    this.get('controller').set('job', this.get('firstJob'));
+    this.get('controller').set('job', null);
+  },
+  draw:function () {
+    if (!this.get('controller').get('job')) {
+      return;//when job is not defined
+    }
+    width = 500;
+    height = 420;
+    var desc1 = $('#graph1_desc');
+    var desc2 = $('#graph2_desc');
+    $('.rickshaw_graph, .rickshaw_legend, .rickshaw_annotation_timeline').html('');
+    if (null == desc1.html() || null == desc2.html()) return;
+    desc1.css('display', 'block');
+    desc2.css('display', 'block');
+    graph.drawJobTimeline(this.get('controller').get('job').get('jobTimeline'), width, height, '#chart', 'legend', 'timeline1');
+    graph.drawJobTasks(this.get('controller').get('job').get('jobTaskview'), width, height, '#job_tasks', 'tasks_legend', 'timeline2');
+  }.observes('controller.job')
+});

+ 51 - 0
ambari-web/app/views/main/apps/runs/jobs/dag_view.js

@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.MainAppsRunsJobsDagView = Em.View.extend({
+  templateName:require('templates/main/apps/runs/jobs/dag'),
+  content:function () {
+    return App.router.get('mainAppsRunsItemController.content').get('jobs');
+  }.property('App.router.mainAppsRunsItemController.content'),
+  classNames:['table', 'dataTable'],
+  jobs:function () {
+    var c = this.get('content');
+    var result = new Array();
+    c.forEach(function (item, index) {
+      result[index] = new Object({
+        'name':item.get('id'),
+        'status':(item.get('status') == 'COMPLETE') ? true : false,
+        'info':[],
+        'input':2,
+        'output':3
+      })
+    });
+    return result;
+  }.property('content'),
+  didInsertElement:function () {
+    var oTable = this.$('#dataTable').dataTable({
+    });
+    var dagSchema = App.router.get('mainAppsRunsItemController.content').get('workflowContext');
+    var jobs = this.get('jobs');
+    var graph = new DagViewer(false, 'dag_viewer')
+      .setPhysicalParametrs(800, 250, -800, 0.01)
+      .setData(dagSchema, jobs)
+      .drawDag(10, 20, 100);
+  }
+});

+ 51 - 0
ambari-web/app/views/main/apps/runs/jobs/menu_view.js

@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.MainJobsAppsRunsMenuView = Em.CollectionView.extend({
+  tagName:'ul',
+  classNames:["nav", "nav-tabs"],
+  content:[
+    { label:'DAG', routing:'dag', active:"active"},
+    { label:'BAR', routing:'bar'}
+  ],
+
+  init:function () {
+    this._super();
+    this.activateView();
+  },
+
+  activateView:function () {
+    $.each(this._childViews, function () {
+      this.set('active', (this.get('content.routing') == 'dag' ? "active" : ""));
+    });
+  },
+
+  deactivateChildViews:function () {
+    $.each(this._childViews, function () {
+      this.set('active', "");
+    });
+  },
+
+  itemViewClass:Em.View.extend({
+    classNameBindings:["active"],
+    active:"",
+    template:Ember.Handlebars.compile('<a {{action showGraph view.content.routing }} href="#"> {{unbound view.content.label}}</a>')
+  })
+});

+ 29 - 0
ambari-web/app/views/main/apps/runs/jobs_view.js

@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.MainAppsRunsJobsView = Em.View.extend({
+  templateName:require('templates/main/apps/runs/jobs'),
+  runItem:function () {
+    return App.router.get('mainAppsRunsItemController.content');
+  }.property('App.router.mainAppsRunsItemController.content'),
+  appItem:function () {
+    return App.router.get('mainAppsItemController.content');
+  }.property('App.router.mainAppsItemController.content')
+});

+ 63 - 0
ambari-web/app/views/main/apps/runs_view.js

@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+var validator = require('utils/validator');
+var date = require('utils/date');
+
+App.MainAppsRunsView = Em.View.extend({
+  templateName:require('templates/main/apps/runs'),
+  classNames:['table', 'dataTable'],
+  didInsertElement:function () {
+    var oTable = this.$('#dataTable').dataTable({
+      "aoColumns":[
+        null,
+        { "sType":"ambari-date" },
+        null,
+        null,
+        null,
+        null,
+        null,
+        null
+      ]
+    });
+  },
+  RunsCheckboxView:Em.Checkbox.extend({
+    content:null,
+    isChecked:false,
+    change:function (event) {
+
+    }
+  }),
+  content:function () {
+    var content = App.router.get('mainAppsItemController.content').get('runs');
+    content.forEach(function (item) {
+      item.set('numJobs', item.get('jobs').get('content').length);
+      var startTime = item.get('startTime');
+      var lastUpdateTime = item.get('lastUpdateTime');
+      item.set('startTime', date.dateFormat(item.get('startTime')));
+      if (validator.isValidInt(lastUpdateTime)) {
+        item.set('lastUpdateTime', date.dateFormatInterval((lastUpdateTime - startTime) / 1000));
+      }
+    });
+    return content;
+  }.property('App.router.mainAppsItemController.content'),
+  appItem:function () {
+    return App.router.get('mainAppsItemController.content');
+  }.property('App.router.mainAppsItemController.content')
+});

+ 89 - 0
ambari-web/app/views/main/apps_view.js

@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+var date = require('utils/date');
+
+App.MainAppsView = Em.View.extend({
+  templateName:require('templates/main/apps'),
+  classNames:['table', 'dataTable'],
+  oTable:null,
+  types:function () {
+    var result = new Array();
+    var content = this.get('content');
+    content.forEach(function (item) {
+      result.push(item.get('type'));
+    });
+    return result;
+  }.property('content'),
+  uniqueTypes:function () {
+    return this.get('controller').get('arrayUnique')(this.get('types'));
+  }.property('types'),
+  filterTypesView:Em.CollectionView.extend({
+    tagName:'span',
+    parentView:null,
+    content:function () {
+      var content = new Array();
+      this.set('parentView', this._parentView);
+      content.push({label:'All', active:'active'});
+      for (var i = 0; i < this._parentView.get('uniqueTypes').length; i++) {
+        content.push({
+          label:this._parentView.get('uniqueTypes')[i],
+          active:''
+        })
+      }
+      return content;
+    }.property('view.uniqueTypes'),
+    filterByType:function (event) {
+      var type = (event.context.label === 'All') ? '' : event.context.label;
+      event.view._parentView.get('parentView').get('oTable').fnFilter(type, 1);
+    },
+    itemViewClass:Em.View.extend({
+      tagName:'span',
+      classNames:['btn', 'btn-link'],
+
+      filterByType:function (event) {
+        event.view._parentView.get('filterByType')(event);
+      },
+      template:Ember.Handlebars.compile('<a {{action "filterByType" view.content target="view"}}>{{view.content.label}}</a><p></p>')
+    })
+
+  }),
+  didInsertElement:function () {
+    var oTable = this.$('#dataTable').dataTable({
+      "aoColumns":[
+        null,
+        null,
+        null,
+        null,
+        null,
+        { "sType":"ambari-date" },
+        null
+      ]
+    });
+    this.set('oTable', oTable);
+  },
+  content:function () {
+    var content = App.router.get('mainAppsController.content');
+    content.forEach(function (item) {
+      item.set('numRuns', item.get('runs').get('content').length);
+      item.set('executionTime', date.dateFormat(item.get('executionTime')));
+    });
+    return content;
+  }.property('App.router.mainAppsController.content')
+});

+ 21 - 1
ambari-web/app/views/main/host.js

@@ -95,4 +95,24 @@ App.MainHostView = Em.View.extend({
       else componentsIds.splice(index, 1);
     }
   })
-});
+});
+
+App.MainBackgroundOperation = Em.View.extend({
+  content: null,
+  classNames: ['background-operations'],
+  classNameBindings: ['isOpen'],
+  isOpen: false,
+  isOpenShowLog: false,
+  iconClass: function(){
+    return this.get('isOpen') ? 'icon-minus' : 'icon-plus';
+  }.property('isOpen'),
+  openDetails: function(){
+    this.set('isOpen', !this.get('isOpen'))
+  },
+  showLogClass: function(){
+    return this.get('isOpenShowLog') ? 'operation-log open' : 'operation-log';
+  }.property('isOpenShowLog'),
+  showLog:function(){
+    this.set('isOpenShowLog', !this.get('isOpenShowLog'))
+  }
+});

+ 4 - 3
ambari-web/app/views/main/menu.js

@@ -30,7 +30,8 @@ App.MainMenuView = Em.CollectionView.extend({
     { label:'Charts', routing:'charts'},
     { label:'Services', routing:'services'},
     { label:'Hosts', routing:'hosts'},
-    { label:'Admin', routing:'admin'}
+    { label:'Admin', routing:'admin'},
+    { label:'Apps', routing:'apps'}
   ],
 
   /**
@@ -45,8 +46,8 @@ App.MainMenuView = Em.CollectionView.extend({
    *    Syncs navigation menu with requested URL
    */
   renderOnRoute:function () {
-    var last_url = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/,'');
-    if(last_url.substr(1,4) !== 'main' || !this._childViews){
+    var last_url = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/, '');
+    if (last_url.substr(1, 4) !== 'main' || !this._childViews) {
       return;
     }
     var reg = /^\/main\/([a-z]+)/g;

+ 19 - 9
ambari-web/config.coffee

@@ -1,4 +1,3 @@
-
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -23,19 +22,18 @@ path = require 'path'
 
 exports.config =
 
-  files: 
-    
-    javascripts: 
-      joinTo: 
+  files:
+
+    javascripts:
+      joinTo:
         'javascripts/app.js': /^app/
         'javascripts/vendor.js': /^vendor/
         'test/javascripts/test.js': /^test(\/|\\)(?!vendor)/
         'test/javascripts/test-vendor.js': /^test(\/|\\)(?=vendor)/
-      order: 
+      order:
         before: [
           'vendor/scripts/console-helper.js',
           'vendor/scripts/jquery-1.7.2.min.js',
-          'vendor/scripts/jquery-ui-1.9.0.custom.js'
           'vendor/scripts/handlebars-1.0.0.beta.6.js',
           'vendor/scripts/ember-latest.js',
           'vendor/scripts/ember-data-latest.js',
@@ -43,6 +41,17 @@ exports.config =
           'vendor/scripts/bootstrap.js',
           'vendor/scripts/d3.v2.js',
           'vendor/scripts/sinon-1.4.2.js',
+          'vendor/scripts/cubism.v1.js',
+          'vendor/scripts/jquery.ui.core.js',
+          'vendor/scripts/jquery.ui.widget.js',
+          'vendor/scripts/jquery.ui.mouse.js',
+          'vendor/scripts/jquery.ui.datepicker.js',
+          'vendor/scripts/jquery-ui-timepicker-addon.js',
+          'vendor/scripts/jquery.ui.slider.js',
+          'vendor/scripts/jquery.ui.sortable.js',
+          'vendor/scripts/jquery.ui.custom-effects.js',
+          'vendor/scripts/jquery.dataTables.js',
+          'vendor/scripts/workflow_visualization.js',
           'vendor/scripts/rickshaw.js'
           ]
 
@@ -52,9 +61,10 @@ exports.config =
       order:
         before: [
           'vendor/styles/bootstrap.css',
-          'vendor/styles/datepicker.css'
-          'vendor/styles/font-awesome.css'
+          'vendor/styles/datepicker.css',
+          'vendor/styles/font-awesome.css',
           'vendor/styles/font-awesome-ie7.css',
+          'vendor/styles/cubism.css',
           'vendor/styles/rickshaw.css'
         ]
 

+ 3 - 3
ambari-web/test/main/host/details_test.js

@@ -29,19 +29,19 @@ describe('MainHostdetails', function () {
       controller.setBack(true);
       expect(controller.get('isFromHosts')).to.equal(true);
     })
-  }),
+  })
   describe('#workStatus positive', function () {
     it('should return true if workstatus is true', function () {
       controller.content.set('workStatus',true);   
       expect(controller.get('isStarting')).to.equal(true);
-      }),
+      })
     it('should return false if workStatus is true', function () {
       expect(controller.get('isStopping')).to.equal(false);
     })
     it('should return false if workstatus is false', function () {
       controller.content.set('workStatus',false);   
       expect(controller.get('isStarting')).to.equal(false);
-      }),
+      })
     it('should return true if workStatus is false', function () {
       expect(controller.get('isStopping')).to.equal(true);
     })

+ 1085 - 0
ambari-web/vendor/scripts/cubism.v1.js

@@ -0,0 +1,1085 @@
+(function (exports) {
+  var cubism = exports.cubism = {version:"1.2.0"};
+  var cubism_id = 0;
+
+  function cubism_identity(d) {
+    return d;
+  }
+
+  cubism.option = function (name, defaultValue) {
+    var values = cubism.options(name);
+    return values.length ? values[0] : defaultValue;
+  };
+
+  cubism.options = function (name, defaultValues) {
+    var options = location.search.substring(1).split("&"),
+      values = [],
+      i = -1,
+      n = options.length,
+      o;
+    while (++i < n) {
+      if ((o = options[i].split("="))[0] == name) {
+        values.push(decodeURIComponent(o[1]));
+      }
+    }
+    return values.length || arguments.length < 2 ? values : defaultValues;
+  };
+  cubism.context = function () {
+    var context = new cubism_context,
+      step = 1e4, // ten seconds, in milliseconds
+      size = 1440, // four hours at ten seconds, in pixels
+      start0, stop0, // the start and stop for the previous change event
+      start1, stop1, // the start and stop for the next prepare event
+      serverDelay = 5e3,
+      clientDelay = 5e3,
+      event = d3.dispatch("prepare", "beforechange", "change", "focus"),
+      scale = context.scale = d3.time.scale().range([0, size]),
+      timeout,
+      focus;
+
+    function update() {
+      var now = Date.now();
+      stop0 = new Date(Math.floor((now - serverDelay - clientDelay) / step) * step);
+      start0 = new Date(stop0 - size * step);
+      stop1 = new Date(Math.floor((now - serverDelay) / step) * step);
+      start1 = new Date(stop1 - size * step);
+      scale.domain([start0, stop0]);
+      return context;
+    }
+
+    context.start = function () {
+      if (timeout) clearTimeout(timeout);
+      var delay = +stop1 + serverDelay - Date.now();
+
+      // If we're too late for the first prepare event, skip it.
+      if (delay < clientDelay) delay += step;
+
+      timeout = setTimeout(function prepare() {
+        stop1 = new Date(Math.floor((Date.now() - serverDelay) / step) * step);
+        start1 = new Date(stop1 - size * step);
+        event.prepare.call(context, start1, stop1);
+
+        setTimeout(function () {
+          scale.domain([start0 = start1, stop0 = stop1]);
+          event.beforechange.call(context, start1, stop1);
+          event.change.call(context, start1, stop1);
+          event.focus.call(context, focus);
+        }, clientDelay);
+
+        timeout = setTimeout(prepare, step);
+      }, delay);
+      return context;
+    };
+
+    context.stop = function () {
+      timeout = clearTimeout(timeout);
+      return context;
+    };
+
+    timeout = setTimeout(context.start, 10);
+
+    // Set or get the step interval in milliseconds.
+    // Defaults to ten seconds.
+    context.step = function (_) {
+      if (!arguments.length) return step;
+      step = +_;
+      return update();
+    };
+
+    // Set or get the context size (the count of metric values).
+    // Defaults to 1440 (four hours at ten seconds).
+    context.size = function (_) {
+      if (!arguments.length) return size;
+      scale.range([0, size = +_]);
+      return update();
+    };
+
+    // The server delay is the amount of time we wait for the server to compute a
+    // metric. This delay may result from clock skew or from delays collecting
+    // metrics from various hosts. Defaults to 4 seconds.
+    context.serverDelay = function (_) {
+      if (!arguments.length) return serverDelay;
+      serverDelay = +_;
+      return update();
+    };
+
+    // The client delay is the amount of additional time we wait to fetch those
+    // metrics from the server. The client and server delay combined represent the
+    // age of the most recent displayed metric. Defaults to 1 second.
+    context.clientDelay = function (_) {
+      if (!arguments.length) return clientDelay;
+      clientDelay = +_;
+      return update();
+    };
+
+    // Sets the focus to the specified index, and dispatches a "focus" event.
+    context.focus = function (i) {
+      event.focus.call(context, focus = i);
+      return context;
+    };
+
+    // Add, remove or get listeners for events.
+    context.on = function (type, listener) {
+      if (arguments.length < 2) return event.on(type);
+
+      event.on(type, listener);
+
+      // Notify the listener of the current start and stop time, as appropriate.
+      // This way, metrics can make requests for data immediately,
+      // and likewise the axis can display itself synchronously.
+      if (listener != null) {
+        if (/^prepare(\.|$)/.test(type)) listener.call(context, start1, stop1);
+        if (/^beforechange(\.|$)/.test(type)) listener.call(context, start0, stop0);
+        if (/^change(\.|$)/.test(type)) listener.call(context, start0, stop0);
+        if (/^focus(\.|$)/.test(type)) listener.call(context, focus);
+      }
+
+      return context;
+    };
+
+    d3.select(window).on("keydown.context-" + ++cubism_id, function () {
+      switch (!d3.event.metaKey && d3.event.keyCode) {
+        case 37: // left
+          if (focus == null) focus = size - 1;
+          if (focus > 0) context.focus(--focus);
+          break;
+        case 39: // right
+          if (focus == null) focus = size - 2;
+          if (focus < size - 1) context.focus(++focus);
+          break;
+        default:
+          return;
+      }
+      d3.event.preventDefault();
+    });
+
+    return update();
+  };
+
+  function cubism_context() {
+  }
+
+  var cubism_contextPrototype = cubism.context.prototype = cubism_context.prototype;
+
+  cubism_contextPrototype.constant = function (value) {
+    return new cubism_metricConstant(this, +value);
+  };
+  cubism_contextPrototype.cube = function (host) {
+    if (!arguments.length) host = "";
+    var source = {},
+      context = this;
+
+    source.metric = function (expression) {
+      return context.metric(function (start, stop, step, callback) {
+        d3.json(host + "/1.0/metric"
+          + "?expression=" + encodeURIComponent(expression)
+          + "&start=" + cubism_cubeFormatDate(start)
+          + "&stop=" + cubism_cubeFormatDate(stop)
+          + "&step=" + step, function (data) {
+          if (!data) return callback(new Error("unable to load data"));
+          callback(null, data.map(function (d) {
+            return d.value;
+          }));
+        });
+      }, expression += "");
+    };
+
+    // Returns the Cube host.
+    source.toString = function () {
+      return host;
+    };
+
+    return source;
+  };
+
+  var cubism_cubeFormatDate = d3.time.format.iso;
+  cubism_contextPrototype.graphite = function (host) {
+    if (!arguments.length) host = "";
+    var source = {},
+      context = this;
+
+    source.metric = function (expression) {
+      var sum = "sum";
+
+      var metric = context.metric(function (start, stop, step, callback) {
+        var target = expression;
+
+        // Apply the summarize, if necessary.
+        if (step !== 1e4) target = "summarize(" + target + ",'"
+          + (!(step % 36e5) ? step / 36e5 + "hour" : !(step % 6e4) ? step / 6e4 + "min" : step + "sec")
+          + "','" + sum + "')";
+
+        d3.text(host + "/render?format=raw"
+          + "&target=" + encodeURIComponent("alias(" + target + ",'')")
+          + "&from=" + cubism_graphiteFormatDate(start - 2 * step) // off-by-two?
+          + "&until=" + cubism_graphiteFormatDate(stop - 1000), function (text) {
+          if (!text) return callback(new Error("unable to load data"));
+          callback(null, cubism_graphiteParse(text));
+        });
+      }, expression += "");
+
+      metric.summarize = function (_) {
+        sum = _;
+        return metric;
+      };
+
+      return metric;
+    };
+
+    source.find = function (pattern, callback) {
+      d3.json(host + "/metrics/find?format=completer"
+        + "&query=" + encodeURIComponent(pattern), function (result) {
+        if (!result) return callback(new Error("unable to find metrics"));
+        callback(null, result.metrics.map(function (d) {
+          return d.path;
+        }));
+      });
+    };
+
+    // Returns the graphite host.
+    source.toString = function () {
+      return host;
+    };
+
+    return source;
+  };
+
+// Graphite understands seconds since UNIX epoch.
+  function cubism_graphiteFormatDate(time) {
+    return Math.floor(time / 1000);
+  }
+
+// Helper method for parsing graphite's raw format.
+  function cubism_graphiteParse(text) {
+    var i = text.indexOf("|"),
+      meta = text.substring(0, i),
+      c = meta.lastIndexOf(","),
+      b = meta.lastIndexOf(",", c - 1),
+      a = meta.lastIndexOf(",", b - 1),
+      start = meta.substring(a + 1, b) * 1000,
+      step = meta.substring(c + 1) * 1000;
+    return text
+      .substring(i + 1)
+      .split(",")
+      .slice(1)// the first value is always None?
+      .map(function (d) {
+        return +d;
+      });
+  }
+
+  function cubism_metric(context) {
+    if (!(context instanceof cubism_context)) throw new Error("invalid context");
+    this.context = context;
+  }
+
+  var cubism_metricPrototype = cubism_metric.prototype;
+
+  cubism.metric = cubism_metric;
+
+  cubism_metricPrototype.valueAt = function () {
+    return NaN;
+  };
+
+  cubism_metricPrototype.alias = function (name) {
+    this.toString = function () {
+      return name;
+    };
+    return this;
+  };
+
+  cubism_metricPrototype.extent = function () {
+    var i = 0,
+      n = this.context.size(),
+      value,
+      min = Infinity,
+      max = -Infinity;
+    while (++i < n) {
+      value = this.valueAt(i);
+      if (value < min) min = value;
+      if (value > max) max = value;
+    }
+    return [min, max];
+  };
+
+  cubism_metricPrototype.on = function (type, listener) {
+    return arguments.length < 2 ? null : this;
+  };
+
+  cubism_metricPrototype.shift = function () {
+    return this;
+  };
+
+  cubism_metricPrototype.on = function () {
+    return arguments.length < 2 ? null : this;
+  };
+
+  cubism_contextPrototype.metric = function (request, name) {
+    var context = this,
+      metric = new cubism_metric(context),
+      id = ".metric-" + ++cubism_id,
+      start = -Infinity,
+      stop,
+      step = context.step(),
+      size = context.size(),
+      values = [],
+      event = d3.dispatch("change"),
+      listening = 0,
+      fetching;
+
+    // Prefetch new data into a temporary array.
+    function prepare(start1, stop) {
+      var steps = Math.min(size, Math.round((start1 - start) / step));
+      if (!steps || fetching) return; // already fetched, or fetching!
+      fetching = true;
+      steps = Math.min(size, steps + cubism_metricOverlap);
+      var start0 = new Date(stop - steps * step);
+      request(start0, stop, step, function (error, data) {
+        fetching = false;
+        if (error) return console.warn(error);
+        var i = isFinite(start) ? Math.round((start0 - start) / step) : 0;
+        for (var j = 0, m = data.length; j < m; ++j) values[j + i] = data[j];
+        event.change.call(metric, start, stop);
+      });
+    }
+
+    // When the context changes, switch to the new data, ready-or-not!
+    function beforechange(start1, stop1) {
+      if (!isFinite(start)) start = start1;
+      values.splice(0, Math.max(0, Math.min(size, Math.round((start1 - start) / step))));
+      start = start1;
+      stop = stop1;
+    }
+
+    //
+    metric.valueAt = function (i) {
+      return values[i];
+    };
+
+    //
+    metric.shift = function (offset) {
+      return context.metric(cubism_metricShift(request, +offset));
+    };
+
+    //
+    metric.on = function (type, listener) {
+      if (!arguments.length) return event.on(type);
+
+      // If there are no listeners, then stop listening to the context,
+      // and avoid unnecessary fetches.
+      if (listener == null) {
+        if (event.on(type) != null && --listening == 0) {
+          context.on("prepare" + id, null).on("beforechange" + id, null);
+        }
+      } else {
+        if (event.on(type) == null && ++listening == 1) {
+          context.on("prepare" + id, prepare).on("beforechange" + id, beforechange);
+        }
+      }
+
+      event.on(type, listener);
+
+      // Notify the listener of the current start and stop time, as appropriate.
+      // This way, charts can display synchronous metrics immediately.
+      if (listener != null) {
+        if (/^change(\.|$)/.test(type)) listener.call(context, start, stop);
+      }
+
+      return metric;
+    };
+
+    //
+    if (arguments.length > 1) metric.toString = function () {
+      return name;
+    };
+
+    return metric;
+  };
+
+// Number of metric to refetch each period, in case of lag.
+  var cubism_metricOverlap = 6;
+
+// Wraps the specified request implementation, and shifts time by the given offset.
+  function cubism_metricShift(request, offset) {
+    return function (start, stop, step, callback) {
+      request(new Date(+start + offset), new Date(+stop + offset), step, callback);
+    };
+  }
+
+  function cubism_metricConstant(context, value) {
+    cubism_metric.call(this, context);
+    value = +value;
+    var name = value + "";
+    this.valueOf = function () {
+      return value;
+    };
+    this.toString = function () {
+      return name;
+    };
+  }
+
+  var cubism_metricConstantPrototype = cubism_metricConstant.prototype = Object.create(cubism_metric.prototype);
+
+  cubism_metricConstantPrototype.valueAt = function () {
+    return +this;
+  };
+
+  cubism_metricConstantPrototype.extent = function () {
+    return [+this, +this];
+  };
+  function cubism_metricOperator(name, operate) {
+
+    function cubism_metricOperator(left, right) {
+      if (!(right instanceof cubism_metric)) right = new cubism_metricConstant(left.context, right);
+      else if (left.context !== right.context) throw new Error("mismatch context");
+      cubism_metric.call(this, left.context);
+      this.left = left;
+      this.right = right;
+      this.toString = function () {
+        return left + " " + name + " " + right;
+      };
+    }
+
+    var cubism_metricOperatorPrototype = cubism_metricOperator.prototype = Object.create(cubism_metric.prototype);
+
+    cubism_metricOperatorPrototype.valueAt = function (i) {
+      return operate(this.left.valueAt(i), this.right.valueAt(i));
+    };
+
+    cubism_metricOperatorPrototype.shift = function (offset) {
+      return new cubism_metricOperator(this.left.shift(offset), this.right.shift(offset));
+    };
+
+    cubism_metricOperatorPrototype.on = function (type, listener) {
+      if (arguments.length < 2) return this.left.on(type);
+      this.left.on(type, listener);
+      this.right.on(type, listener);
+      return this;
+    };
+
+    return function (right) {
+      return new cubism_metricOperator(this, right);
+    };
+  }
+
+  cubism_metricPrototype.add = cubism_metricOperator("+", function (left, right) {
+    return left + right;
+  });
+
+  cubism_metricPrototype.subtract = cubism_metricOperator("-", function (left, right) {
+    return left - right;
+  });
+
+  cubism_metricPrototype.multiply = cubism_metricOperator("*", function (left, right) {
+    return left * right;
+  });
+
+  cubism_metricPrototype.divide = cubism_metricOperator("/", function (left, right) {
+    return left / right;
+  });
+  cubism_contextPrototype.horizon = function () {
+    var context = this,
+      mode = "offset",
+      buffer = document.createElement("canvas"),
+      width = buffer.width = context.size(),
+      height = buffer.height = 30,
+      scale = d3.scale.linear().interpolate(d3.interpolateRound),
+      metric = cubism_identity,
+      extent = null,
+      title = cubism_identity,
+      format = d3.format(".2s"),
+      colors = ["#08519c", "#3182bd", "#6baed6", "#bdd7e7", "#bae4b3", "#74c476", "#31a354", "#006d2c"];
+
+    function horizon(selection) {
+
+      selection
+        .on("mousemove.horizon", function () {
+          context.focus(d3.mouse(this)[0]);
+        })
+        .on("mouseout.horizon", function () {
+          context.focus(null);
+        });
+
+      selection.append("canvas")
+        .attr("width", width)
+        .attr("height", height);
+
+      selection.append("span")
+        .attr("class", "title")
+        .text(title);
+
+      selection.append("span")
+        .attr("class", "value");
+
+      selection.each(function (d, i) {
+        var that = this,
+          id = ++cubism_id,
+          metric_ = typeof metric === "function" ? metric.call(that, d, i) : metric,
+          colors_ = typeof colors === "function" ? colors.call(that, d, i) : colors,
+          extent_ = typeof extent === "function" ? extent.call(that, d, i) : extent,
+          start = -Infinity,
+          step = context.step(),
+          canvas = d3.select(that).select("canvas"),
+          span = d3.select(that).select(".value"),
+          max_,
+          m = colors_.length >> 1,
+          ready;
+
+        canvas.datum({id:id, metric:metric_});
+        canvas = canvas.node().getContext("2d");
+
+        function change(start1, stop) {
+          canvas.save();
+
+          // compute the new extent and ready flag
+          var extent = metric_.extent();
+          ready = extent.every(isFinite);
+          if (extent_ != null) extent = extent_;
+
+          // if this is an update (with no extent change), copy old values!
+          var i0 = 0, max = Math.max(-extent[0], extent[1]);
+          if (this === context) {
+            if (max == max_) {
+              i0 = width - cubism_metricOverlap;
+              var dx = (start1 - start) / step;
+              if (dx < width) {
+                var canvas0 = buffer.getContext("2d");
+                canvas0.clearRect(0, 0, width, height);
+                canvas0.drawImage(canvas.canvas, dx, 0, width - dx, height, 0, 0, width - dx, height);
+                canvas.clearRect(0, 0, width, height);
+                canvas.drawImage(canvas0.canvas, 0, 0);
+              }
+            }
+            start = start1;
+          }
+
+          // update the domain
+          scale.domain([0, max_ = max]);
+
+          // clear for the new data
+          canvas.clearRect(i0, 0, width - i0, height);
+
+          // record whether there are negative values to display
+          var negative;
+
+          // positive bands
+          for (var j = 0; j < m; ++j) {
+            canvas.fillStyle = colors_[m + j];
+
+            // Adjust the range based on the current band index.
+            var y0 = (j - m + 1) * height;
+            scale.range([m * height + y0, y0]);
+            y0 = scale(0);
+
+            for (var i = i0, n = width, y1; i < n; ++i) {
+              y1 = metric_.valueAt(i);
+              if (y1 <= 0) {
+                negative = true;
+                continue;
+              }
+              canvas.fillRect(i, y1 = scale(y1), 1, y0 - y1);
+            }
+          }
+
+          if (negative) {
+            // enable offset mode
+            if (mode === "offset") {
+              canvas.translate(0, height);
+              canvas.scale(1, -1);
+            }
+
+            // negative bands
+            for (var j = 0; j < m; ++j) {
+              canvas.fillStyle = colors_[m - 1 - j];
+
+              // Adjust the range based on the current band index.
+              var y0 = (j - m + 1) * height;
+              scale.range([m * height + y0, y0]);
+              y0 = scale(0);
+
+              for (var i = i0, n = width, y1; i < n; ++i) {
+                y1 = metric_.valueAt(i);
+                if (y1 >= 0) continue;
+                canvas.fillRect(i, scale(-y1), 1, y0 - scale(-y1));
+              }
+            }
+          }
+
+          canvas.restore();
+        }
+
+        function focus(i) {
+          if (i == null) i = width - 1;
+          var value = metric_.valueAt(i);
+          span.datum(value).text(isNaN(value) ? null : format);
+        }
+
+        // Update the chart when the context changes.
+        context.on("change.horizon-" + id, change);
+        context.on("focus.horizon-" + id, focus);
+
+        // Display the first metric change immediately,
+        // but defer subsequent updates to the canvas change.
+        // Note that someone still needs to listen to the metric,
+        // so that it continues to update automatically.
+        metric_.on("change.horizon-" + id, function (start, stop) {
+          change(start, stop), focus();
+          if (ready) metric_.on("change.horizon-" + id, cubism_identity);
+        });
+      });
+    }
+
+    horizon.remove = function (selection) {
+
+      selection
+        .on("mousemove.horizon", null)
+        .on("mouseout.horizon", null);
+
+      selection.selectAll("canvas")
+        .each(remove)
+        .remove();
+
+      selection.selectAll(".title,.value")
+        .remove();
+
+      function remove(d) {
+        d.metric.on("change.horizon-" + d.id, null);
+        context.on("change.horizon-" + d.id, null);
+        context.on("focus.horizon-" + d.id, null);
+      }
+    };
+
+    horizon.mode = function (_) {
+      if (!arguments.length) return mode;
+      mode = _ + "";
+      return horizon;
+    };
+
+    horizon.height = function (_) {
+      if (!arguments.length) return height;
+      buffer.height = height = +_;
+      return horizon;
+    };
+
+    horizon.metric = function (_) {
+      if (!arguments.length) return metric;
+      metric = _;
+      return horizon;
+    };
+
+    horizon.scale = function (_) {
+      if (!arguments.length) return scale;
+      scale = _;
+      return horizon;
+    };
+
+    horizon.extent = function (_) {
+      if (!arguments.length) return extent;
+      extent = _;
+      return horizon;
+    };
+
+    horizon.title = function (_) {
+      if (!arguments.length) return title;
+      title = _;
+      return horizon;
+    };
+
+    horizon.format = function (_) {
+      if (!arguments.length) return format;
+      format = _;
+      return horizon;
+    };
+
+    horizon.colors = function (_) {
+      if (!arguments.length) return colors;
+      colors = _;
+      return horizon;
+    };
+
+    return horizon;
+  };
+  cubism_contextPrototype.comparison = function () {
+    var context = this,
+      width = context.size(),
+      height = 120,
+      scale = d3.scale.linear().interpolate(d3.interpolateRound),
+      primary = function (d) {
+        return d[0];
+      },
+      secondary = function (d) {
+        return d[1];
+      },
+      extent = null,
+      title = cubism_identity,
+      formatPrimary = cubism_comparisonPrimaryFormat,
+      formatChange = cubism_comparisonChangeFormat,
+      colors = ["#9ecae1", "#225b84", "#a1d99b", "#22723a"],
+      strokeWidth = 1.5;
+
+    function comparison(selection) {
+
+      selection
+        .on("mousemove.comparison", function () {
+          context.focus(d3.mouse(this)[0]);
+        })
+        .on("mouseout.comparison", function () {
+          context.focus(null);
+        });
+
+      selection.append("canvas")
+        .attr("width", width)
+        .attr("height", height);
+
+      selection.append("span")
+        .attr("class", "title")
+        .text(title);
+
+      selection.append("span")
+        .attr("class", "value primary");
+
+      selection.append("span")
+        .attr("class", "value change");
+
+      selection.each(function (d, i) {
+        var that = this,
+          id = ++cubism_id,
+          primary_ = typeof primary === "function" ? primary.call(that, d, i) : primary,
+          secondary_ = typeof secondary === "function" ? secondary.call(that, d, i) : secondary,
+          extent_ = typeof extent === "function" ? extent.call(that, d, i) : extent,
+          div = d3.select(that),
+          canvas = div.select("canvas"),
+          spanPrimary = div.select(".value.primary"),
+          spanChange = div.select(".value.change"),
+          ready;
+
+        canvas.datum({id:id, primary:primary_, secondary:secondary_});
+        canvas = canvas.node().getContext("2d");
+
+        function change(start, stop) {
+          canvas.save();
+          canvas.clearRect(0, 0, width, height);
+
+          // update the scale
+          var primaryExtent = primary_.extent(),
+            secondaryExtent = secondary_.extent(),
+            extent = extent_ == null ? primaryExtent : extent_;
+          scale.domain(extent).range([height, 0]);
+          ready = primaryExtent.concat(secondaryExtent).every(isFinite);
+
+          // consistent overplotting
+          var round = start / context.step() & 1
+            ? cubism_comparisonRoundOdd
+            : cubism_comparisonRoundEven;
+
+          // positive changes
+          canvas.fillStyle = colors[2];
+          for (var i = 0, n = width; i < n; ++i) {
+            var y0 = scale(primary_.valueAt(i)),
+              y1 = scale(secondary_.valueAt(i));
+            if (y0 < y1) canvas.fillRect(round(i), y0, 1, y1 - y0);
+          }
+
+          // negative changes
+          canvas.fillStyle = colors[0];
+          for (i = 0; i < n; ++i) {
+            var y0 = scale(primary_.valueAt(i)),
+              y1 = scale(secondary_.valueAt(i));
+            if (y0 > y1) canvas.fillRect(round(i), y1, 1, y0 - y1);
+          }
+
+          // positive values
+          canvas.fillStyle = colors[3];
+          for (i = 0; i < n; ++i) {
+            var y0 = scale(primary_.valueAt(i)),
+              y1 = scale(secondary_.valueAt(i));
+            if (y0 <= y1) canvas.fillRect(round(i), y0, 1, strokeWidth);
+          }
+
+          // negative values
+          canvas.fillStyle = colors[1];
+          for (i = 0; i < n; ++i) {
+            var y0 = scale(primary_.valueAt(i)),
+              y1 = scale(secondary_.valueAt(i));
+            if (y0 > y1) canvas.fillRect(round(i), y0 - strokeWidth, 1, strokeWidth);
+          }
+
+          canvas.restore();
+        }
+
+        function focus(i) {
+          if (i == null) i = width - 1;
+          var valuePrimary = primary_.valueAt(i),
+            valueSecondary = secondary_.valueAt(i),
+            valueChange = (valuePrimary - valueSecondary) / valueSecondary;
+
+          spanPrimary
+            .datum(valuePrimary)
+            .text(isNaN(valuePrimary) ? null : formatPrimary);
+
+          spanChange
+            .datum(valueChange)
+            .text(isNaN(valueChange) ? null : formatChange)
+            .attr("class", "value change " + (valueChange > 0 ? "positive" : valueChange < 0 ? "negative" : ""));
+        }
+
+        // Display the first primary change immediately,
+        // but defer subsequent updates to the context change.
+        // Note that someone still needs to listen to the metric,
+        // so that it continues to update automatically.
+        primary_.on("change.comparison-" + id, firstChange);
+        secondary_.on("change.comparison-" + id, firstChange);
+        function firstChange(start, stop) {
+          change(start, stop), focus();
+          if (ready) {
+            primary_.on("change.comparison-" + id, cubism_identity);
+            secondary_.on("change.comparison-" + id, cubism_identity);
+          }
+        }
+
+        // Update the chart when the context changes.
+        context.on("change.comparison-" + id, change);
+        context.on("focus.comparison-" + id, focus);
+      });
+    }
+
+    comparison.remove = function (selection) {
+
+      selection
+        .on("mousemove.comparison", null)
+        .on("mouseout.comparison", null);
+
+      selection.selectAll("canvas")
+        .each(remove)
+        .remove();
+
+      selection.selectAll(".title,.value")
+        .remove();
+
+      function remove(d) {
+        d.primary.on("change.comparison-" + d.id, null);
+        d.secondary.on("change.comparison-" + d.id, null);
+        context.on("change.comparison-" + d.id, null);
+        context.on("focus.comparison-" + d.id, null);
+      }
+    };
+
+    comparison.height = function (_) {
+      if (!arguments.length) return height;
+      height = +_;
+      return comparison;
+    };
+
+    comparison.primary = function (_) {
+      if (!arguments.length) return primary;
+      primary = _;
+      return comparison;
+    };
+
+    comparison.secondary = function (_) {
+      if (!arguments.length) return secondary;
+      secondary = _;
+      return comparison;
+    };
+
+    comparison.scale = function (_) {
+      if (!arguments.length) return scale;
+      scale = _;
+      return comparison;
+    };
+
+    comparison.extent = function (_) {
+      if (!arguments.length) return extent;
+      extent = _;
+      return comparison;
+    };
+
+    comparison.title = function (_) {
+      if (!arguments.length) return title;
+      title = _;
+      return comparison;
+    };
+
+    comparison.formatPrimary = function (_) {
+      if (!arguments.length) return formatPrimary;
+      formatPrimary = _;
+      return comparison;
+    };
+
+    comparison.formatChange = function (_) {
+      if (!arguments.length) return formatChange;
+      formatChange = _;
+      return comparison;
+    };
+
+    comparison.colors = function (_) {
+      if (!arguments.length) return colors;
+      colors = _;
+      return comparison;
+    };
+
+    comparison.strokeWidth = function (_) {
+      if (!arguments.length) return strokeWidth;
+      strokeWidth = _;
+      return comparison;
+    };
+
+    return comparison;
+  };
+
+  var cubism_comparisonPrimaryFormat = d3.format(".2s"),
+    cubism_comparisonChangeFormat = d3.format("+.0%");
+
+  function cubism_comparisonRoundEven(i) {
+    return i & 0xfffffe;
+  }
+
+  function cubism_comparisonRoundOdd(i) {
+    return ((i + 1) & 0xfffffe) - 1;
+  }
+
+  cubism_contextPrototype.axis = function () {
+    var context = this,
+      scale = context.scale,
+      axis_ = d3.svg.axis().scale(scale);
+
+    var format = context.step() < 6e4 ? cubism_axisFormatSeconds
+      : context.step() < 864e5 ? cubism_axisFormatMinutes
+      : cubism_axisFormatDays;
+
+    function axis(selection) {
+      var id = ++cubism_id,
+        tick;
+
+      var g = selection.append("svg")
+        .datum({id:id})
+        .attr("width", context.size())
+        .attr("height", Math.max(28, -axis.tickSize()))
+        .append("g")
+        .attr("transform", "translate(0," + (axis_.orient() === "top" ? 27 : 4) + ")")
+        .call(axis_);
+
+      context.on("change.axis-" + id, function () {
+        g.call(axis_);
+        if (!tick) tick = d3.select(g.node().appendChild(g.selectAll("text").node().cloneNode(true)))
+          .style("display", "none")
+          .text(null);
+      });
+
+      context.on("focus.axis-" + id, function (i) {
+        if (tick) {
+          if (i == null) {
+            tick.style("display", "none");
+            g.selectAll("text").style("fill-opacity", null);
+          } else {
+            tick.style("display", null).attr("x", i).text(format(scale.invert(i)));
+            var dx = tick.node().getComputedTextLength() + 6;
+            g.selectAll("text").style("fill-opacity", function (d) {
+              return Math.abs(scale(d) - i) < dx ? 0 : 1;
+            });
+          }
+        }
+      });
+    }
+
+    axis.remove = function (selection) {
+
+      selection.selectAll("svg")
+        .each(remove)
+        .remove();
+
+      function remove(d) {
+        context.on("change.axis-" + d.id, null);
+        context.on("focus.axis-" + d.id, null);
+      }
+    };
+
+    return d3.rebind(axis, axis_,
+      "orient",
+      "ticks",
+      "tickSubdivide",
+      "tickSize",
+      "tickPadding",
+      "tickFormat");
+  };
+
+  var cubism_axisFormatSeconds = d3.time.format("%I:%M:%S %p"),
+    cubism_axisFormatMinutes = d3.time.format("%I:%M %p"),
+    cubism_axisFormatDays = d3.time.format("%B %d");
+  cubism_contextPrototype.rule = function () {
+    var context = this,
+      metric = cubism_identity;
+
+    function rule(selection) {
+      var id = ++cubism_id;
+
+      var line = selection.append("div")
+        .datum({id:id})
+        .attr("class", "line")
+        .call(cubism_ruleStyle);
+
+      selection.each(function (d, i) {
+        var that = this,
+          id = ++cubism_id,
+          metric_ = typeof metric === "function" ? metric.call(that, d, i) : metric;
+
+        if (!metric_) return;
+
+        function change(start, stop) {
+          var values = [];
+
+          for (var i = 0, n = context.size(); i < n; ++i) {
+            if (metric_.valueAt(i)) {
+              values.push(i);
+            }
+          }
+
+          var lines = selection.selectAll(".metric").data(values);
+          lines.exit().remove();
+          lines.enter().append("div").attr("class", "metric line").call(cubism_ruleStyle);
+          lines.style("left", cubism_ruleLeft);
+        }
+
+        context.on("change.rule-" + id, change);
+        metric_.on("change.rule-" + id, change);
+      });
+
+      context.on("focus.rule-" + id, function (i) {
+        line.datum(i)
+          .style("display", i == null ? "none" : null)
+          .style("left", cubism_ruleLeft);
+      });
+    }
+
+    rule.remove = function (selection) {
+
+      selection.selectAll(".line")
+        .each(remove)
+        .remove();
+
+      function remove(d) {
+        context.on("focus.rule-" + d.id, null);
+      }
+    };
+
+    rule.metric = function (_) {
+      if (!arguments.length) return metric;
+      metric = _;
+      return rule;
+    };
+
+    return rule;
+  };
+
+  function cubism_ruleStyle(line) {
+    line
+      .style("position", "absolute")
+      .style("top", 0)
+      .style("bottom", 0)
+      .style("width", "1px")
+      .style("pointer-events", "none");
+  }
+
+  function cubism_ruleLeft(i) {
+    return i + "px";
+  }
+})(this);

+ 0 - 14709
ambari-web/vendor/scripts/jquery-ui-1.9.0.custom.js

@@ -1,14709 +0,0 @@
-/*! jQuery UI - v1.9.0 - 2012-10-05
-* 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.0",
-
-	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 (($.browser.msie && (/(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" );
-			}
-		});
-	}
-});
-
-// 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" );
-			});
-		};
-	});
-}
-
-// 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 !$( element ).parents().andSelf().filter(function() {
-		return $.css( this, "visibility" ) === "hidden" ||
-			$.expr.filters.hidden( this );
-	}).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";
-});
-
-
-
-
-
-// deprecated
-
-$.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: 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 ) {
-				target[ key ] = $.isPlainObject( value ) ? $.widget.extend( {}, target[ key ], value ) : value;
-			}
-		}
-	}
-	return target;
-};
-
-$.widget.bridge = function( name, object ) {
-	var fullName = object.prototype.widgetFullName;
-	$.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 {
-					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({ remove: "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( element, handlers ) {
-		// no element argument, shuffle and use this.element
-		if ( !handlers ) {
-			handlers = element;
-			element = this.element;
-		} else {
-			// accept selectors, DOM elements
-			element = $( element );
-			this.bindings = this.bindings.add( element );
-		}
-
-		var instance = this;
-		$.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 ( 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 ) {
-				instance.widget().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.0",
-	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 ($.browser.msie && !(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.0",
-	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
-		if ( !options.collapsible && options.active === false ) {
-			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.originalHeight = this.element[0].style.height;
-		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" ) {
-			this.element.css( "height", this.originalHeight );
-			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();
-
-		this.element.css( "height", this.originalHeight );
-
-		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 ).height( "" ).height() );
-				})
-				.height( maxHeight );
-		}
-
-		if ( heightStyle !== "content" ) {
-			this.element.height( this.element.height() );
-		}
-	},
-
-	_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, value ) {
-				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.0",
-	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({
-			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, status ) {
-						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( value ) {
-		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.0",
-	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",
-			hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
-			focusClass = "ui-state-focus";
-
-		if ( options.label === null ) {
-			options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
-		}
-
-		this.buttonElement
-			.addClass( baseClasses )
-			.attr( "role", "button" )
-			.bind( "mouseenter" + this.eventNamespace, function() {
-				if ( options.disabled ) {
-					return;
-				}
-				$( this ).addClass( "ui-state-hover" );
-				if ( this === lastActive ) {
-					$( this ).addClass( "ui-state-active" );
-				}
-			})
-			.bind( "mouseleave" + this.eventNamespace, function() {
-				if ( options.disabled ) {
-					return;
-				}
-				$( this ).removeClass( hoverClass );
-			})
-			.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() {
-		var isDisabled = this.element.is( ":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.0",
-	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.0" } });
-
-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 + ($.browser.msie && parseInt($.browser.version,10) < 7 && !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.0";
-
-// 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.0",
-	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 = ( 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" ),
-
-			uiDialogContent = 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" )
-				.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 ),
-
-			uiDialogTitlebarCloseText = ( 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" ),
-
-			uiButtonSet = ( 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.uiDialog.hide( 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 uiDialogButtonPane, uiButtonSet,
-			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 ) {
-				props = $.isFunction( props ) ?
-					{ click: props, text: name } :
-					props;
-				var button = $( "<button type='button'>" )
-					.attr( props, true )
-					.unbind( "click" )
-					.click(function() {
-						props.click.apply( that.element[0], arguments );
-					})
-					.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.join( " " ),
-					at: myAt.join( " " ),
-					offset: offset.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 ( $.browser.msie ) {
-			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 ( $.browser.msie ) {
-			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.0",
-	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' && $.browser.msie)) //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) {
-			
-			//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)) {
-
-				//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.0",
-	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 = [],
-			source;
-
-		// 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, i ) {
-
-			// 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,
-		r, g, b;
-
-	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( value ) {
-				// 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,
-		camelCase,
-		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.0",
-
-	// 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 optinos as the first parameter
-	if ( $.isPlainObject( effect ) ) {
-		options = effect;
-		effect = effect.effect;
-	}
-
-	// convert to an object
-	effect = { effect: effect };
-
-	// catch (effect)
-	if ( options === undefined ) {
-		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()
-		};
-
-	$.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
-			}
-	});
-
-	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 } : 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 el = $( this ),
-		props = [ "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" ],
-		original, baseline, factor,
-		position = el.css( "position" );
-
-	if ( mode === "show" ) {
-		el.show();
-	}
-	original = {
-		height: el.height(),
-		width: el.width(),
-		outerHeight: el.outerHeight(),
-		outerWidth: el.outerWidth()
-	};
-
-	el.from = o.from || original;
-	el.to = o.to || 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 );
-			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, restore ? props : props1 );
-	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 = props.concat(vProps).concat(hProps);
-
-		el.find( "*[width]" ).each( function(){
-			var child = $( this ),
-				c_original = {
-					height: child.height(),
-					width: child.width()
-				};
-			if (restore) {
-				$.effects.save(child, props2);
-			}
-
-			child.from = {
-				height: c_original.height * factor.from.y,
-				width: c_original.width * factor.from.x
-			};
-			child.to = {
-				height: c_original.height * factor.to.y,
-				width: 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, restore ? props : props1 );
-			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.0",
-	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() {
-		// Initialize nested menus
-		var menus,
-			icon = this.options.icons.submenu,
-			submenus = this.element.find( this.options.menus + ":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"
-				});
-
-		// Don't refresh list items that are already adapted
-		menus = submenus.add( this.element );
-
-		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" );
-
-		submenus.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" ) );
-		});
-
-		// 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.0",
-	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.0",
-	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;
-			wrapper.after(
-				this.originalElement.css({
-					position: wrapper.css('position'),
-					width: wrapper.outerWidth(),
-					height: wrapper.outerHeight(),
-					top: wrapper.css('top'),
-					left: wrapper.css('left')
-				})
-			).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 ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
-			pxyoffset = ( 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.0",
-	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.0",
-	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,
-			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>",
-			handleCount = ( o.values && o.values.length ) || 1,
-			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 : "" ) );
-		}
-
-		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( event ) {
-		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;
-		}
-	},
-
-	//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, j ) {
-				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.0",
-	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)");
-
-		for (var i=0; i < this.items.length; i++) {
-
-			for (var j=0; j < list.length; j++) {
-				if(list[j] == this.items[i].item[0])
-					this.items.splice(i,1);
-			};
-
-		};
-
-	},
-
-	_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 if(this.currentContainer != this.containers[innermostIndex]) {
-
-			//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 base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
-			for (var j = this.items.length - 1; j >= 0; j--) {
-				if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
-				var cur = this.containers[innermostIndex].floating ? this.items[j].item.offset().left : this.items[j].item.offset().top;
-				if(Math.abs(cur - base) < dist) {
-					dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
-					this.direction = (cur - base > 0) ? 'down' : 'up';
-				}
-			}
-
-			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' && $.browser.msie)) //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.0",
-	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.uiSpinner.addClass( "ui-state-active" );
-			this.previous = this.element.val();
-		},
-		blur: function( event ) {
-			if ( this.cancelBlur ) {
-				delete this.cancelBlur;
-				return;
-			}
-
-			this._refresh();
-			this.uiSpinner.removeClass( "ui-state-active" );
-			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._hoverable( uiSpinner );
-
-		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-state-default 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 ) {
-	// clone the node to work around IE 6 not normalizing the href property
-	// if it's manually set, i.e., a.href = "#foo" kills the normalization
-	anchor = anchor.cloneNode( false );
-	return anchor.hash.length > 1 &&
-		anchor.href.replace( rhash, "" ) === location.href.replace( rhash, "" );
-}
-
-$.widget( "ui.tabs", {
-	version: "1.9.0",
-	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 panel,
-			that = this,
-			options = this.options,
-			active = options.active;
-
-		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 ( location.hash ) {
-				this.anchors.each(function( i, anchor ) {
-					if ( anchor.hash === location.hash ) {
-						active = i;
-						return false;
-					}
-				});
-			}
-
-			// check for a tab marked active via a class
-			if ( active === null ) {
-				active = this.tabs.filter( ".ui-tabs-active" ).index();
-			}
-
-			// 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 next,
-			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" );
-			}
-		});
-
-		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, s, e ) {
-					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, s, ui.tab.closest( "li" ).index(), ui.tab[ 0 ] );
-					}
-					catch ( e ) {}
-				}
-			}, 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, url ){
-			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( event ) {
-			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 ret = this._superApply( arguments );
-			if ( !ret ) {
-				return false;
-			}
-			if ( type === "beforeActivate" && data.newTab.length ) {
-				ret = this._super( "select", event, {
-					tab: data.newTab.find( ".ui-tabs-anchor" )[ 0],
-					panel: data.newPanel[ 0 ],
-					index: data.newTab.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( event ) {
-			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.0",
-	options: {
-		content: function() {
-			return $( this ).attr( "title" );
-		},
-		hide: true,
-		items: "[title]",
-		position: {
-			my: "left+15 center",
-			at: "right center",
-			collision: "flipfit flipfit"
-		},
-		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 = {};
-	},
-
-	_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 target = $( event ? event.target : this.element )
-				.closest( this.options.items );
-
-		// No element to show a tooltip for
-		if ( !target.length ) {
-			return;
-		}
-
-		// If the tooltip is open and we're tracking then reposition the tooltip.
-		// This makes sure that a tracking tooltip doesn't obscure a focused element
-		// if the user was hovering when the element gained focused.
-		if ( this.options.track && target.data( "ui-tooltip-id" ) ) {
-			this._find( target ).position( $.extend({
-				of: target
-			}, this.options.position ) );
-			// Stop tracking (#8622)
-			this._off( this.document, "mousemove" );
-			return;
-		}
-
-		if ( target.attr( "title" ) ) {
-			target.data( "ui-tooltip-title", target.attr( "title" ) );
-		}
-
-		target.data( "tooltip-open", true );
-
-		this._updateContent( target, event );
-	},
-
-	_updateContent: function( target, event ) {
-		var content,
-			contentOption = this.options.content,
-			that = this;
-
-		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( "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() {
-				this._open( event, target, response );
-			});
-		});
-		if ( content ) {
-			this._open( event, target, content );
-		}
-	},
-
-	_open: function( event, target, content ) {
-		var tooltip, positionOption;
-		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;
-			tooltip.position( positionOption );
-		}
-		if ( this.options.track && event && /^mouse/.test( event.originalEvent.type ) ) {
-			positionOption = $.extend( {}, this.options.position );
-			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 );
-
-		this._trigger( "open", event, { tooltip: tooltip } );
-
-		this._on( target, {
-			mouseleave: "close",
-			focusout: "close",
-			keyup: function( event ) {
-				if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
-					var fakeEvent = $.Event(event);
-					fakeEvent.currentTarget = target[0];
-					this.close( fakeEvent, true );
-				}
-			}
-		});
-	},
-
-	close: function( event, force ) {
-		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;
-		}
-
-		// don't close if the element has focus
-		// this prevents the tooltip from closing if you hover while focused
-		//
-		// we have to check the event type because tabbing out of the document
-		// may leave the element as the activeElement
-		if ( !force && event && event.type !== "focusout" &&
-				this.document[0].activeElement === target[0] ) {
-			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() {
-			$( this ).remove();
-			delete that.tooltips[ this.id ];
-		});
-
-		target.removeData( "tooltip-open" );
-		this._off( target, "mouseleave focusout keyup" );
-		this._off( this.document, "mousemove" );
-
-		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 ) : $();
-	},
-
-	_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 ) );

+ 11272 - 0
ambari-web/vendor/scripts/jquery.dataTables.js

@@ -0,0 +1,11272 @@
+/**
+ * @summary     DataTables
+ * @description Paginate, search and sort HTML tables
+ * @version     1.9.4
+ * @file        jquery.dataTables.js
+ * @author      Allan Jardine (www.sprymedia.co.uk)
+ * @contact     www.sprymedia.co.uk/contact
+ *
+ * @copyright Copyright 2008-2012 Allan Jardine, all rights reserved.
+ *
+ * This source file is free software, under either the GPL v2 license or a
+ * BSD style license, available at:
+ *   http://datatables.net/license_gpl2
+ *   http://datatables.net/license_bsd
+ *
+ * This source file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
+ *
+ * For details please refer to: http://www.datatables.net
+ */
+
+/*jslint evil: true, undef: true, browser: true */
+/*globals $, jQuery,define,_fnExternApiFunc,_fnInitialise,_fnInitComplete,_fnLanguageCompat,_fnAddColumn,_fnColumnOptions,_fnAddData,_fnCreateTr,_fnGatherData,_fnBuildHead,_fnDrawHead,_fnDraw,_fnReDraw,_fnAjaxUpdate,_fnAjaxParameters,_fnAjaxUpdateDraw,_fnServerParams,_fnAddOptionsHtml,_fnFeatureHtmlTable,_fnScrollDraw,_fnAdjustColumnSizing,_fnFeatureHtmlFilter,_fnFilterComplete,_fnFilterCustom,_fnFilterColumn,_fnFilter,_fnBuildSearchArray,_fnBuildSearchRow,_fnFilterCreateSearch,_fnDataToSearch,_fnSort,_fnSortAttachListener,_fnSortingClasses,_fnFeatureHtmlPaginate,_fnPageChange,_fnFeatureHtmlInfo,_fnUpdateInfo,_fnFeatureHtmlLength,_fnFeatureHtmlProcessing,_fnProcessingDisplay,_fnVisibleToColumnIndex,_fnColumnIndexToVisible,_fnNodeToDataIndex,_fnVisbleColumns,_fnCalculateEnd,_fnConvertToWidth,_fnCalculateColumnWidths,_fnScrollingWidthAdjust,_fnGetWidestNode,_fnGetMaxLenString,_fnStringToCss,_fnDetectType,_fnSettingsFromNode,_fnGetDataMaster,_fnGetTrNodes,_fnGetTdNodes,_fnEscapeRegex,_fnDeleteIndex,_fnReOrderIndex,_fnColumnOrdering,_fnLog,_fnClearTable,_fnSaveState,_fnLoadState,_fnCreateCookie,_fnReadCookie,_fnDetectHeader,_fnGetUniqueThs,_fnScrollBarWidth,_fnApplyToChildren,_fnMap,_fnGetRowData,_fnGetCellData,_fnSetCellData,_fnGetObjectDataFn,_fnSetObjectDataFn,_fnApplyColumnDefs,_fnBindAction,_fnCallbackReg,_fnCallbackFire,_fnJsonString,_fnRender,_fnNodeToColumnIndex,_fnInfoMacros,_fnBrowserDetect,_fnGetColumns*/
+
+(/** @lends <global> */function (window, document, undefined) {
+
+  (function (factory) {
+    "use strict";
+
+    // Define as an AMD module if possible
+    if (typeof define === 'function' && define.amd) {
+      define(['jquery'], factory);
+    }
+    /* Define using browser globals otherwise
+     * Prevent multiple instantiations if the script is loaded twice
+     */
+    else if (jQuery && !jQuery.fn.dataTable) {
+      factory(jQuery);
+    }
+  }
+    (/** @lends <global> */function ($) {
+      "use strict";
+      /**
+       * DataTables is a plug-in for the jQuery Javascript library. It is a
+       * highly flexible tool, based upon the foundations of progressive
+       * enhancement, which will add advanced interaction controls to any
+       * HTML table. For a full list of features please refer to
+       * <a href="http://datatables.net">DataTables.net</a>.
+       *
+       * Note that the <i>DataTable</i> object is not a global variable but is
+       * aliased to <i>jQuery.fn.DataTable</i> and <i>jQuery.fn.dataTable</i> through which
+       * it may be  accessed.
+       *
+       *  @class
+       *  @param {object} [oInit={}] Configuration object for DataTables. Options
+       *    are defined by {@link DataTable.defaults}
+       *  @requires jQuery 1.3+
+       *
+       *  @example
+       *    // Basic initialisation
+       *    $(document).ready( function {
+	 *      $('#example').dataTable();
+	 *    } );
+       *
+       *  @example
+       *    // Initialisation with configuration options - in this case, disable
+       *    // pagination and sorting.
+       *    $(document).ready( function {
+	 *      $('#example').dataTable( {
+	 *        "bPaginate": false,
+	 *        "bSort": false 
+	 *      } );
+	 *    } );
+       */
+      var DataTable = function (oInit) {
+
+
+        /**
+         * Add a column to the list used for the table with default values
+         *  @param {object} oSettings dataTables settings object
+         *  @param {node} nTh The th element for this column
+         *  @memberof DataTable#oApi
+         */
+        function _fnAddColumn(oSettings, nTh) {
+          var oDefaults = DataTable.defaults.columns;
+          var iCol = oSettings.aoColumns.length;
+          var oCol = $.extend({}, DataTable.models.oColumn, oDefaults, {
+            "sSortingClass":oSettings.oClasses.sSortable,
+            "sSortingClassJUI":oSettings.oClasses.sSortJUI,
+            "nTh":nTh ? nTh : document.createElement('th'),
+            "sTitle":oDefaults.sTitle ? oDefaults.sTitle : nTh ? nTh.innerHTML : '',
+            "aDataSort":oDefaults.aDataSort ? oDefaults.aDataSort : [iCol],
+            "mData":oDefaults.mData ? oDefaults.oDefaults : iCol
+          });
+          oSettings.aoColumns.push(oCol);
+
+          /* Add a column specific filter */
+          if (oSettings.aoPreSearchCols[ iCol ] === undefined || oSettings.aoPreSearchCols[ iCol ] === null) {
+            oSettings.aoPreSearchCols[ iCol ] = $.extend({}, DataTable.models.oSearch);
+          }
+          else {
+            var oPre = oSettings.aoPreSearchCols[ iCol ];
+
+            /* Don't require that the user must specify bRegex, bSmart or bCaseInsensitive */
+            if (oPre.bRegex === undefined) {
+              oPre.bRegex = true;
+            }
+
+            if (oPre.bSmart === undefined) {
+              oPre.bSmart = true;
+            }
+
+            if (oPre.bCaseInsensitive === undefined) {
+              oPre.bCaseInsensitive = true;
+            }
+          }
+
+          /* Use the column options function to initialise classes etc */
+          _fnColumnOptions(oSettings, iCol, null);
+        }
+
+
+        /**
+         * Apply options for a column
+         *  @param {object} oSettings dataTables settings object
+         *  @param {int} iCol column index to consider
+         *  @param {object} oOptions object with sType, bVisible and bSearchable etc
+         *  @memberof DataTable#oApi
+         */
+        function _fnColumnOptions(oSettings, iCol, oOptions) {
+          var oCol = oSettings.aoColumns[ iCol ];
+
+          /* User specified column options */
+          if (oOptions !== undefined && oOptions !== null) {
+            /* Backwards compatibility for mDataProp */
+            if (oOptions.mDataProp && !oOptions.mData) {
+              oOptions.mData = oOptions.mDataProp;
+            }
+
+            if (oOptions.sType !== undefined) {
+              oCol.sType = oOptions.sType;
+              oCol._bAutoType = false;
+            }
+
+            $.extend(oCol, oOptions);
+            _fnMap(oCol, oOptions, "sWidth", "sWidthOrig");
+
+            /* iDataSort to be applied (backwards compatibility), but aDataSort will take
+             * priority if defined
+             */
+            if (oOptions.iDataSort !== undefined) {
+              oCol.aDataSort = [ oOptions.iDataSort ];
+            }
+            _fnMap(oCol, oOptions, "aDataSort");
+          }
+
+          /* Cache the data get and set functions for speed */
+          var mRender = oCol.mRender ? _fnGetObjectDataFn(oCol.mRender) : null;
+          var mData = _fnGetObjectDataFn(oCol.mData);
+
+          oCol.fnGetData = function (oData, sSpecific) {
+            var innerData = mData(oData, sSpecific);
+
+            if (oCol.mRender && (sSpecific && sSpecific !== '')) {
+              return mRender(innerData, sSpecific, oData);
+            }
+            return innerData;
+          };
+          oCol.fnSetData = _fnSetObjectDataFn(oCol.mData);
+
+          /* Feature sorting overrides column specific when off */
+          if (!oSettings.oFeatures.bSort) {
+            oCol.bSortable = false;
+          }
+
+          /* Check that the class assignment is correct for sorting */
+          if (!oCol.bSortable ||
+            ($.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) == -1)) {
+            oCol.sSortingClass = oSettings.oClasses.sSortableNone;
+            oCol.sSortingClassJUI = "";
+          }
+          else if ($.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) == -1) {
+            oCol.sSortingClass = oSettings.oClasses.sSortable;
+            oCol.sSortingClassJUI = oSettings.oClasses.sSortJUI;
+          }
+          else if ($.inArray('asc', oCol.asSorting) != -1 && $.inArray('desc', oCol.asSorting) == -1) {
+            oCol.sSortingClass = oSettings.oClasses.sSortableAsc;
+            oCol.sSortingClassJUI = oSettings.oClasses.sSortJUIAscAllowed;
+          }
+          else if ($.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) != -1) {
+            oCol.sSortingClass = oSettings.oClasses.sSortableDesc;
+            oCol.sSortingClassJUI = oSettings.oClasses.sSortJUIDescAllowed;
+          }
+        }
+
+
+        /**
+         * Adjust the table column widths for new data. Note: you would probably want to
+         * do a redraw after calling this function!
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnAdjustColumnSizing(oSettings) {
+          /* Not interested in doing column width calculation if auto-width is disabled */
+          if (oSettings.oFeatures.bAutoWidth === false) {
+            return false;
+          }
+
+          _fnCalculateColumnWidths(oSettings);
+          for (var i = 0 , iLen = oSettings.aoColumns.length; i < iLen; i++) {
+            oSettings.aoColumns[i].nTh.style.width = oSettings.aoColumns[i].sWidth;
+          }
+        }
+
+
+        /**
+         * Covert the index of a visible column to the index in the data array (take account
+         * of hidden columns)
+         *  @param {object} oSettings dataTables settings object
+         *  @param {int} iMatch Visible column index to lookup
+         *  @returns {int} i the data index
+         *  @memberof DataTable#oApi
+         */
+        function _fnVisibleToColumnIndex(oSettings, iMatch) {
+          var aiVis = _fnGetColumns(oSettings, 'bVisible');
+
+          return typeof aiVis[iMatch] === 'number' ?
+            aiVis[iMatch] :
+            null;
+        }
+
+
+        /**
+         * Covert the index of an index in the data array and convert it to the visible
+         *   column index (take account of hidden columns)
+         *  @param {int} iMatch Column index to lookup
+         *  @param {object} oSettings dataTables settings object
+         *  @returns {int} i the data index
+         *  @memberof DataTable#oApi
+         */
+        function _fnColumnIndexToVisible(oSettings, iMatch) {
+          var aiVis = _fnGetColumns(oSettings, 'bVisible');
+          var iPos = $.inArray(iMatch, aiVis);
+
+          return iPos !== -1 ? iPos : null;
+        }
+
+
+        /**
+         * Get the number of visible columns
+         *  @param {object} oSettings dataTables settings object
+         *  @returns {int} i the number of visible columns
+         *  @memberof DataTable#oApi
+         */
+        function _fnVisbleColumns(oSettings) {
+          return _fnGetColumns(oSettings, 'bVisible').length;
+        }
+
+
+        /**
+         * Get an array of column indexes that match a given property
+         *  @param {object} oSettings dataTables settings object
+         *  @param {string} sParam Parameter in aoColumns to look for - typically
+         *    bVisible or bSearchable
+         *  @returns {array} Array of indexes with matched properties
+         *  @memberof DataTable#oApi
+         */
+        function _fnGetColumns(oSettings, sParam) {
+          var a = [];
+
+          $.map(oSettings.aoColumns, function (val, i) {
+            if (val[sParam]) {
+              a.push(i);
+            }
+          });
+
+          return a;
+        }
+
+
+        /**
+         * Get the sort type based on an input string
+         *  @param {string} sData data we wish to know the type of
+         *  @returns {string} type (defaults to 'string' if no type can be detected)
+         *  @memberof DataTable#oApi
+         */
+        function _fnDetectType(sData) {
+          var aTypes = DataTable.ext.aTypes;
+          var iLen = aTypes.length;
+
+          for (var i = 0; i < iLen; i++) {
+            var sType = aTypes[i](sData);
+            if (sType !== null) {
+              return sType;
+            }
+          }
+
+          return 'string';
+        }
+
+
+        /**
+         * Figure out how to reorder a display list
+         *  @param {object} oSettings dataTables settings object
+         *  @returns array {int} aiReturn index list for reordering
+         *  @memberof DataTable#oApi
+         */
+        function _fnReOrderIndex(oSettings, sColumns) {
+          var aColumns = sColumns.split(',');
+          var aiReturn = [];
+
+          for (var i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {
+            for (var j = 0; j < iLen; j++) {
+              if (oSettings.aoColumns[i].sName == aColumns[j]) {
+                aiReturn.push(j);
+                break;
+              }
+            }
+          }
+
+          return aiReturn;
+        }
+
+
+        /**
+         * Get the column ordering that DataTables expects
+         *  @param {object} oSettings dataTables settings object
+         *  @returns {string} comma separated list of names
+         *  @memberof DataTable#oApi
+         */
+        function _fnColumnOrdering(oSettings) {
+          var sNames = '';
+          for (var i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {
+            sNames += oSettings.aoColumns[i].sName + ',';
+          }
+          if (sNames.length == iLen) {
+            return "";
+          }
+          return sNames.slice(0, -1);
+        }
+
+
+        /**
+         * Take the column definitions and static columns arrays and calculate how
+         * they relate to column indexes. The callback function will then apply the
+         * definition found for a column to a suitable configuration object.
+         *  @param {object} oSettings dataTables settings object
+         *  @param {array} aoColDefs The aoColumnDefs array that is to be applied
+         *  @param {array} aoCols The aoColumns array that defines columns individually
+         *  @param {function} fn Callback function - takes two parameters, the calculated
+         *    column index and the definition for that column.
+         *  @memberof DataTable#oApi
+         */
+        function _fnApplyColumnDefs(oSettings, aoColDefs, aoCols, fn) {
+          var i, iLen, j, jLen, k, kLen;
+
+          // Column definitions with aTargets
+          if (aoColDefs) {
+            /* Loop over the definitions array - loop in reverse so first instance has priority */
+            for (i = aoColDefs.length - 1; i >= 0; i--) {
+              /* Each definition can target multiple columns, as it is an array */
+              var aTargets = aoColDefs[i].aTargets;
+              if (!$.isArray(aTargets)) {
+                _fnLog(oSettings, 1, 'aTargets must be an array of targets, not a ' + (typeof aTargets));
+              }
+
+              for (j = 0, jLen = aTargets.length; j < jLen; j++) {
+                if (typeof aTargets[j] === 'number' && aTargets[j] >= 0) {
+                  /* Add columns that we don't yet know about */
+                  while (oSettings.aoColumns.length <= aTargets[j]) {
+                    _fnAddColumn(oSettings);
+                  }
+
+                  /* Integer, basic index */
+                  fn(aTargets[j], aoColDefs[i]);
+                }
+                else if (typeof aTargets[j] === 'number' && aTargets[j] < 0) {
+                  /* Negative integer, right to left column counting */
+                  fn(oSettings.aoColumns.length + aTargets[j], aoColDefs[i]);
+                }
+                else if (typeof aTargets[j] === 'string') {
+                  /* Class name matching on TH element */
+                  for (k = 0, kLen = oSettings.aoColumns.length; k < kLen; k++) {
+                    if (aTargets[j] == "_all" ||
+                      $(oSettings.aoColumns[k].nTh).hasClass(aTargets[j])) {
+                      fn(k, aoColDefs[i]);
+                    }
+                  }
+                }
+              }
+            }
+          }
+
+          // Statically defined columns array
+          if (aoCols) {
+            for (i = 0, iLen = aoCols.length; i < iLen; i++) {
+              fn(i, aoCols[i]);
+            }
+          }
+        }
+
+        /**
+         * Add a data array to the table, creating DOM node etc. This is the parallel to
+         * _fnGatherData, but for adding rows from a Javascript source, rather than a
+         * DOM source.
+         *  @param {object} oSettings dataTables settings object
+         *  @param {array} aData data array to be added
+         *  @returns {int} >=0 if successful (index of new aoData entry), -1 if failed
+         *  @memberof DataTable#oApi
+         */
+        function _fnAddData(oSettings, aDataSupplied) {
+          var oCol;
+
+          /* Take an independent copy of the data source so we can bash it about as we wish */
+          var aDataIn = ($.isArray(aDataSupplied)) ?
+            aDataSupplied.slice() :
+            $.extend(true, {}, aDataSupplied);
+
+          /* Create the object for storing information about this new row */
+          var iRow = oSettings.aoData.length;
+          var oData = $.extend(true, {}, DataTable.models.oRow);
+          oData._aData = aDataIn;
+          oSettings.aoData.push(oData);
+
+          /* Create the cells */
+          var nTd, sThisType;
+          for (var i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {
+            oCol = oSettings.aoColumns[i];
+
+            /* Use rendered data for filtering / sorting */
+            if (typeof oCol.fnRender === 'function' && oCol.bUseRendered && oCol.mData !== null) {
+              _fnSetCellData(oSettings, iRow, i, _fnRender(oSettings, iRow, i));
+            }
+            else {
+              _fnSetCellData(oSettings, iRow, i, _fnGetCellData(oSettings, iRow, i));
+            }
+
+            /* See if we should auto-detect the column type */
+            if (oCol._bAutoType && oCol.sType != 'string') {
+              /* Attempt to auto detect the type - same as _fnGatherData() */
+              var sVarType = _fnGetCellData(oSettings, iRow, i, 'type');
+              if (sVarType !== null && sVarType !== '') {
+                sThisType = _fnDetectType(sVarType);
+                if (oCol.sType === null) {
+                  oCol.sType = sThisType;
+                }
+                else if (oCol.sType != sThisType && oCol.sType != "html") {
+                  /* String is always the 'fallback' option */
+                  oCol.sType = 'string';
+                }
+              }
+            }
+          }
+
+          /* Add to the display array */
+          oSettings.aiDisplayMaster.push(iRow);
+
+          /* Create the DOM information */
+          if (!oSettings.oFeatures.bDeferRender) {
+            _fnCreateTr(oSettings, iRow);
+          }
+
+          return iRow;
+        }
+
+
+        /**
+         * Read in the data from the target table from the DOM
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnGatherData(oSettings) {
+          var iLoop, i, iLen, j, jLen, jInner,
+            nTds, nTrs, nTd, nTr, aLocalData, iThisIndex,
+            iRow, iRows, iColumn, iColumns, sNodeName,
+            oCol, oData;
+
+          /*
+           * Process by row first
+           * Add the data object for the whole table - storing the tr node. Note - no point in getting
+           * DOM based data if we are going to go and replace it with Ajax source data.
+           */
+          if (oSettings.bDeferLoading || oSettings.sAjaxSource === null) {
+            nTr = oSettings.nTBody.firstChild;
+            while (nTr) {
+              if (nTr.nodeName.toUpperCase() == "TR") {
+                iThisIndex = oSettings.aoData.length;
+                nTr._DT_RowIndex = iThisIndex;
+                oSettings.aoData.push($.extend(true, {}, DataTable.models.oRow, {
+                  "nTr":nTr
+                }));
+
+                oSettings.aiDisplayMaster.push(iThisIndex);
+                nTd = nTr.firstChild;
+                jInner = 0;
+                while (nTd) {
+                  sNodeName = nTd.nodeName.toUpperCase();
+                  if (sNodeName == "TD" || sNodeName == "TH") {
+                    _fnSetCellData(oSettings, iThisIndex, jInner, $.trim(nTd.innerHTML));
+                    jInner++;
+                  }
+                  nTd = nTd.nextSibling;
+                }
+              }
+              nTr = nTr.nextSibling;
+            }
+          }
+
+          /* Gather in the TD elements of the Table - note that this is basically the same as
+           * fnGetTdNodes, but that function takes account of hidden columns, which we haven't yet
+           * setup!
+           */
+          nTrs = _fnGetTrNodes(oSettings);
+          nTds = [];
+          for (i = 0, iLen = nTrs.length; i < iLen; i++) {
+            nTd = nTrs[i].firstChild;
+            while (nTd) {
+              sNodeName = nTd.nodeName.toUpperCase();
+              if (sNodeName == "TD" || sNodeName == "TH") {
+                nTds.push(nTd);
+              }
+              nTd = nTd.nextSibling;
+            }
+          }
+
+          /* Now process by column */
+          for (iColumn = 0, iColumns = oSettings.aoColumns.length; iColumn < iColumns; iColumn++) {
+            oCol = oSettings.aoColumns[iColumn];
+
+            /* Get the title of the column - unless there is a user set one */
+            if (oCol.sTitle === null) {
+              oCol.sTitle = oCol.nTh.innerHTML;
+            }
+
+            var
+              bAutoType = oCol._bAutoType,
+              bRender = typeof oCol.fnRender === 'function',
+              bClass = oCol.sClass !== null,
+              bVisible = oCol.bVisible,
+              nCell, sThisType, sRendered, sValType;
+
+            /* A single loop to rule them all (and be more efficient) */
+            if (bAutoType || bRender || bClass || !bVisible) {
+              for (iRow = 0, iRows = oSettings.aoData.length; iRow < iRows; iRow++) {
+                oData = oSettings.aoData[iRow];
+                nCell = nTds[ (iRow * iColumns) + iColumn ];
+
+                /* Type detection */
+                if (bAutoType && oCol.sType != 'string') {
+                  sValType = _fnGetCellData(oSettings, iRow, iColumn, 'type');
+                  if (sValType !== '') {
+                    sThisType = _fnDetectType(sValType);
+                    if (oCol.sType === null) {
+                      oCol.sType = sThisType;
+                    }
+                    else if (oCol.sType != sThisType &&
+                      oCol.sType != "html") {
+                      /* String is always the 'fallback' option */
+                      oCol.sType = 'string';
+                    }
+                  }
+                }
+
+                if (oCol.mRender) {
+                  // mRender has been defined, so we need to get the value and set it
+                  nCell.innerHTML = _fnGetCellData(oSettings, iRow, iColumn, 'display');
+                }
+                else if (oCol.mData !== iColumn) {
+                  // If mData is not the same as the column number, then we need to
+                  // get the dev set value. If it is the column, no point in wasting
+                  // time setting the value that is already there!
+                  nCell.innerHTML = _fnGetCellData(oSettings, iRow, iColumn, 'display');
+                }
+
+                /* Rendering */
+                if (bRender) {
+                  sRendered = _fnRender(oSettings, iRow, iColumn);
+                  nCell.innerHTML = sRendered;
+                  if (oCol.bUseRendered) {
+                    /* Use the rendered data for filtering / sorting */
+                    _fnSetCellData(oSettings, iRow, iColumn, sRendered);
+                  }
+                }
+
+                /* Classes */
+                if (bClass) {
+                  nCell.className += ' ' + oCol.sClass;
+                }
+
+                /* Column visibility */
+                if (!bVisible) {
+                  oData._anHidden[iColumn] = nCell;
+                  nCell.parentNode.removeChild(nCell);
+                }
+                else {
+                  oData._anHidden[iColumn] = null;
+                }
+
+                if (oCol.fnCreatedCell) {
+                  oCol.fnCreatedCell.call(oSettings.oInstance,
+                    nCell, _fnGetCellData(oSettings, iRow, iColumn, 'display'), oData._aData, iRow, iColumn
+                  );
+                }
+              }
+            }
+          }
+
+          /* Row created callbacks */
+          if (oSettings.aoRowCreatedCallback.length !== 0) {
+            for (i = 0, iLen = oSettings.aoData.length; i < iLen; i++) {
+              oData = oSettings.aoData[i];
+              _fnCallbackFire(oSettings, 'aoRowCreatedCallback', null, [oData.nTr, oData._aData, i]);
+            }
+          }
+        }
+
+
+        /**
+         * Take a TR element and convert it to an index in aoData
+         *  @param {object} oSettings dataTables settings object
+         *  @param {node} n the TR element to find
+         *  @returns {int} index if the node is found, null if not
+         *  @memberof DataTable#oApi
+         */
+        function _fnNodeToDataIndex(oSettings, n) {
+          return (n._DT_RowIndex !== undefined) ? n._DT_RowIndex : null;
+        }
+
+
+        /**
+         * Take a TD element and convert it into a column data index (not the visible index)
+         *  @param {object} oSettings dataTables settings object
+         *  @param {int} iRow The row number the TD/TH can be found in
+         *  @param {node} n The TD/TH element to find
+         *  @returns {int} index if the node is found, -1 if not
+         *  @memberof DataTable#oApi
+         */
+        function _fnNodeToColumnIndex(oSettings, iRow, n) {
+          var anCells = _fnGetTdNodes(oSettings, iRow);
+
+          for (var i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {
+            if (anCells[i] === n) {
+              return i;
+            }
+          }
+          return -1;
+        }
+
+
+        /**
+         * Get an array of data for a given row from the internal data cache
+         *  @param {object} oSettings dataTables settings object
+         *  @param {int} iRow aoData row id
+         *  @param {string} sSpecific data get type ('type' 'filter' 'sort')
+         *  @param {array} aiColumns Array of column indexes to get data from
+         *  @returns {array} Data array
+         *  @memberof DataTable#oApi
+         */
+        function _fnGetRowData(oSettings, iRow, sSpecific, aiColumns) {
+          var out = [];
+          for (var i = 0, iLen = aiColumns.length; i < iLen; i++) {
+            out.push(_fnGetCellData(oSettings, iRow, aiColumns[i], sSpecific));
+          }
+          return out;
+        }
+
+
+        /**
+         * Get the data for a given cell from the internal cache, taking into account data mapping
+         *  @param {object} oSettings dataTables settings object
+         *  @param {int} iRow aoData row id
+         *  @param {int} iCol Column index
+         *  @param {string} sSpecific data get type ('display', 'type' 'filter' 'sort')
+         *  @returns {*} Cell data
+         *  @memberof DataTable#oApi
+         */
+        function _fnGetCellData(oSettings, iRow, iCol, sSpecific) {
+          var sData;
+          var oCol = oSettings.aoColumns[iCol];
+          var oData = oSettings.aoData[iRow]._aData;
+
+          if ((sData = oCol.fnGetData(oData, sSpecific)) === undefined) {
+            if (oSettings.iDrawError != oSettings.iDraw && oCol.sDefaultContent === null) {
+              _fnLog(oSettings, 0, "Requested unknown parameter " +
+                (typeof oCol.mData == 'function' ? '{mData function}' : "'" + oCol.mData + "'") +
+                " from the data source for row " + iRow);
+              oSettings.iDrawError = oSettings.iDraw;
+            }
+            return oCol.sDefaultContent;
+          }
+
+          /* When the data source is null, we can use default column data */
+          if (sData === null && oCol.sDefaultContent !== null) {
+            sData = oCol.sDefaultContent;
+          }
+          else if (typeof sData === 'function') {
+            /* If the data source is a function, then we run it and use the return */
+            return sData();
+          }
+
+          if (sSpecific == 'display' && sData === null) {
+            return '';
+          }
+          return sData;
+        }
+
+
+        /**
+         * Set the value for a specific cell, into the internal data cache
+         *  @param {object} oSettings dataTables settings object
+         *  @param {int} iRow aoData row id
+         *  @param {int} iCol Column index
+         *  @param {*} val Value to set
+         *  @memberof DataTable#oApi
+         */
+        function _fnSetCellData(oSettings, iRow, iCol, val) {
+          var oCol = oSettings.aoColumns[iCol];
+          var oData = oSettings.aoData[iRow]._aData;
+
+          oCol.fnSetData(oData, val);
+        }
+
+
+        // Private variable that is used to match array syntax in the data property object
+        var __reArray = /\[.*?\]$/;
+
+        /**
+         * Return a function that can be used to get data from a source object, taking
+         * into account the ability to use nested objects as a source
+         *  @param {string|int|function} mSource The data source for the object
+         *  @returns {function} Data get function
+         *  @memberof DataTable#oApi
+         */
+        function _fnGetObjectDataFn(mSource) {
+          if (mSource === null) {
+            /* Give an empty string for rendering / sorting etc */
+            return function (data, type) {
+              return null;
+            };
+          }
+          else if (typeof mSource === 'function') {
+            return function (data, type, extra) {
+              return mSource(data, type, extra);
+            };
+          }
+          else if (typeof mSource === 'string' && (mSource.indexOf('.') !== -1 || mSource.indexOf('[') !== -1)) {
+            /* If there is a . in the source string then the data source is in a 
+             * nested object so we loop over the data for each level to get the next
+             * level down. On each loop we test for undefined, and if found immediately
+             * return. This allows entire objects to be missing and sDefaultContent to
+             * be used if defined, rather than throwing an error
+             */
+            var fetchData = function (data, type, src) {
+              var a = src.split('.');
+              var arrayNotation, out, innerSrc;
+
+              if (src !== "") {
+                for (var i = 0, iLen = a.length; i < iLen; i++) {
+                  // Check if we are dealing with an array notation request
+                  arrayNotation = a[i].match(__reArray);
+
+                  if (arrayNotation) {
+                    a[i] = a[i].replace(__reArray, '');
+
+                    // Condition allows simply [] to be passed in
+                    if (a[i] !== "") {
+                      data = data[ a[i] ];
+                    }
+                    out = [];
+
+                    // Get the remainder of the nested object to get
+                    a.splice(0, i + 1);
+                    innerSrc = a.join('.');
+
+                    // Traverse each entry in the array getting the properties requested
+                    for (var j = 0, jLen = data.length; j < jLen; j++) {
+                      out.push(fetchData(data[j], type, innerSrc));
+                    }
+
+                    // If a string is given in between the array notation indicators, that
+                    // is used to join the strings together, otherwise an array is returned
+                    var join = arrayNotation[0].substring(1, arrayNotation[0].length - 1);
+                    data = (join === "") ? out : out.join(join);
+
+                    // The inner call to fetchData has already traversed through the remainder
+                    // of the source requested, so we exit from the loop
+                    break;
+                  }
+
+                  if (data === null || data[ a[i] ] === undefined) {
+                    return undefined;
+                  }
+                  data = data[ a[i] ];
+                }
+              }
+
+              return data;
+            };
+
+            return function (data, type) {
+              return fetchData(data, type, mSource);
+            };
+          }
+          else {
+            /* Array or flat object mapping */
+            return function (data, type) {
+              return data[mSource];
+            };
+          }
+        }
+
+
+        /**
+         * Return a function that can be used to set data from a source object, taking
+         * into account the ability to use nested objects as a source
+         *  @param {string|int|function} mSource The data source for the object
+         *  @returns {function} Data set function
+         *  @memberof DataTable#oApi
+         */
+        function _fnSetObjectDataFn(mSource) {
+          if (mSource === null) {
+            /* Nothing to do when the data source is null */
+            return function (data, val) {
+            };
+          }
+          else if (typeof mSource === 'function') {
+            return function (data, val) {
+              mSource(data, 'set', val);
+            };
+          }
+          else if (typeof mSource === 'string' && (mSource.indexOf('.') !== -1 || mSource.indexOf('[') !== -1)) {
+            /* Like the get, we need to get data from a nested object */
+            var setData = function (data, val, src) {
+              var a = src.split('.'), b;
+              var arrayNotation, o, innerSrc;
+
+              for (var i = 0, iLen = a.length - 1; i < iLen; i++) {
+                // Check if we are dealing with an array notation request
+                arrayNotation = a[i].match(__reArray);
+
+                if (arrayNotation) {
+                  a[i] = a[i].replace(__reArray, '');
+                  data[ a[i] ] = [];
+
+                  // Get the remainder of the nested object to set so we can recurse
+                  b = a.slice();
+                  b.splice(0, i + 1);
+                  innerSrc = b.join('.');
+
+                  // Traverse each entry in the array setting the properties requested
+                  for (var j = 0, jLen = val.length; j < jLen; j++) {
+                    o = {};
+                    setData(o, val[j], innerSrc);
+                    data[ a[i] ].push(o);
+                  }
+
+                  // The inner call to setData has already traversed through the remainder
+                  // of the source and has set the data, thus we can exit here
+                  return;
+                }
+
+                // If the nested object doesn't currently exist - since we are
+                // trying to set the value - create it
+                if (data[ a[i] ] === null || data[ a[i] ] === undefined) {
+                  data[ a[i] ] = {};
+                }
+                data = data[ a[i] ];
+              }
+
+              // If array notation is used, we just want to strip it and use the property name
+              // and assign the value. If it isn't used, then we get the result we want anyway
+              data[ a[a.length - 1].replace(__reArray, '') ] = val;
+            };
+
+            return function (data, val) {
+              return setData(data, val, mSource);
+            };
+          }
+          else {
+            /* Array or flat object mapping */
+            return function (data, val) {
+              data[mSource] = val;
+            };
+          }
+        }
+
+
+        /**
+         * Return an array with the full table data
+         *  @param {object} oSettings dataTables settings object
+         *  @returns array {array} aData Master data array
+         *  @memberof DataTable#oApi
+         */
+        function _fnGetDataMaster(oSettings) {
+          var aData = [];
+          var iLen = oSettings.aoData.length;
+          for (var i = 0; i < iLen; i++) {
+            aData.push(oSettings.aoData[i]._aData);
+          }
+          return aData;
+        }
+
+
+        /**
+         * Nuke the table
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnClearTable(oSettings) {
+          oSettings.aoData.splice(0, oSettings.aoData.length);
+          oSettings.aiDisplayMaster.splice(0, oSettings.aiDisplayMaster.length);
+          oSettings.aiDisplay.splice(0, oSettings.aiDisplay.length);
+          _fnCalculateEnd(oSettings);
+        }
+
+
+        /**
+         * Take an array of integers (index array) and remove a target integer (value - not
+         * the key!)
+         *  @param {array} a Index array to target
+         *  @param {int} iTarget value to find
+         *  @memberof DataTable#oApi
+         */
+        function _fnDeleteIndex(a, iTarget) {
+          var iTargetIndex = -1;
+
+          for (var i = 0, iLen = a.length; i < iLen; i++) {
+            if (a[i] == iTarget) {
+              iTargetIndex = i;
+            }
+            else if (a[i] > iTarget) {
+              a[i]--;
+            }
+          }
+
+          if (iTargetIndex != -1) {
+            a.splice(iTargetIndex, 1);
+          }
+        }
+
+
+        /**
+         * Call the developer defined fnRender function for a given cell (row/column) with
+         * the required parameters and return the result.
+         *  @param {object} oSettings dataTables settings object
+         *  @param {int} iRow aoData index for the row
+         *  @param {int} iCol aoColumns index for the column
+         *  @returns {*} Return of the developer's fnRender function
+         *  @memberof DataTable#oApi
+         */
+        function _fnRender(oSettings, iRow, iCol) {
+          var oCol = oSettings.aoColumns[iCol];
+
+          return oCol.fnRender({
+            "iDataRow":iRow,
+            "iDataColumn":iCol,
+            "oSettings":oSettings,
+            "aData":oSettings.aoData[iRow]._aData,
+            "mDataProp":oCol.mData
+          }, _fnGetCellData(oSettings, iRow, iCol, 'display'));
+        }
+
+        /**
+         * Create a new TR element (and it's TD children) for a row
+         *  @param {object} oSettings dataTables settings object
+         *  @param {int} iRow Row to consider
+         *  @memberof DataTable#oApi
+         */
+        function _fnCreateTr(oSettings, iRow) {
+          var oData = oSettings.aoData[iRow];
+          var nTd;
+
+          if (oData.nTr === null) {
+            oData.nTr = document.createElement('tr');
+
+            /* Use a private property on the node to allow reserve mapping from the node
+             * to the aoData array for fast look up
+             */
+            oData.nTr._DT_RowIndex = iRow;
+
+            /* Special parameters can be given by the data source to be used on the row */
+            if (oData._aData.DT_RowId) {
+              oData.nTr.id = oData._aData.DT_RowId;
+            }
+
+            if (oData._aData.DT_RowClass) {
+              oData.nTr.className = oData._aData.DT_RowClass;
+            }
+
+            /* Process each column */
+            for (var i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {
+              var oCol = oSettings.aoColumns[i];
+              nTd = document.createElement(oCol.sCellType);
+
+              /* Render if needed - if bUseRendered is true then we already have the rendered
+               * value in the data source - so can just use that
+               */
+              nTd.innerHTML = (typeof oCol.fnRender === 'function' && (!oCol.bUseRendered || oCol.mData === null)) ?
+                _fnRender(oSettings, iRow, i) :
+                _fnGetCellData(oSettings, iRow, i, 'display');
+
+              /* Add user defined class */
+              if (oCol.sClass !== null) {
+                nTd.className = oCol.sClass;
+              }
+
+              if (oCol.bVisible) {
+                oData.nTr.appendChild(nTd);
+                oData._anHidden[i] = null;
+              }
+              else {
+                oData._anHidden[i] = nTd;
+              }
+
+              if (oCol.fnCreatedCell) {
+                oCol.fnCreatedCell.call(oSettings.oInstance,
+                  nTd, _fnGetCellData(oSettings, iRow, i, 'display'), oData._aData, iRow, i
+                );
+              }
+            }
+
+            _fnCallbackFire(oSettings, 'aoRowCreatedCallback', null, [oData.nTr, oData._aData, iRow]);
+          }
+        }
+
+
+        /**
+         * Create the HTML header for the table
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnBuildHead(oSettings) {
+          var i, nTh, iLen, j, jLen;
+          var iThs = $('th, td', oSettings.nTHead).length;
+          var iCorrector = 0;
+          var jqChildren;
+
+          /* If there is a header in place - then use it - otherwise it's going to get nuked... */
+          if (iThs !== 0) {
+            /* We've got a thead from the DOM, so remove hidden columns and apply width to vis cols */
+            for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {
+              nTh = oSettings.aoColumns[i].nTh;
+              nTh.setAttribute('role', 'columnheader');
+              if (oSettings.aoColumns[i].bSortable) {
+                nTh.setAttribute('tabindex', oSettings.iTabIndex);
+                nTh.setAttribute('aria-controls', oSettings.sTableId);
+              }
+
+              if (oSettings.aoColumns[i].sClass !== null) {
+                $(nTh).addClass(oSettings.aoColumns[i].sClass);
+              }
+
+              /* Set the title of the column if it is user defined (not what was auto detected) */
+              if (oSettings.aoColumns[i].sTitle != nTh.innerHTML) {
+                nTh.innerHTML = oSettings.aoColumns[i].sTitle;
+              }
+            }
+          }
+          else {
+            /* We don't have a header in the DOM - so we are going to have to create one */
+            var nTr = document.createElement("tr");
+
+            for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {
+              nTh = oSettings.aoColumns[i].nTh;
+              nTh.innerHTML = oSettings.aoColumns[i].sTitle;
+              nTh.setAttribute('tabindex', '0');
+
+              if (oSettings.aoColumns[i].sClass !== null) {
+                $(nTh).addClass(oSettings.aoColumns[i].sClass);
+              }
+
+              nTr.appendChild(nTh);
+            }
+            $(oSettings.nTHead).html('')[0].appendChild(nTr);
+            _fnDetectHeader(oSettings.aoHeader, oSettings.nTHead);
+          }
+
+          /* ARIA role for the rows */
+          $(oSettings.nTHead).children('tr').attr('role', 'row');
+
+          /* Add the extra markup needed by jQuery UI's themes */
+          if (oSettings.bJUI) {
+            for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {
+              nTh = oSettings.aoColumns[i].nTh;
+
+              var nDiv = document.createElement('div');
+              nDiv.className = oSettings.oClasses.sSortJUIWrapper;
+              $(nTh).contents().appendTo(nDiv);
+
+              var nSpan = document.createElement('span');
+              nSpan.className = oSettings.oClasses.sSortIcon;
+              nDiv.appendChild(nSpan);
+              nTh.appendChild(nDiv);
+            }
+          }
+
+          if (oSettings.oFeatures.bSort) {
+            for (i = 0; i < oSettings.aoColumns.length; i++) {
+              if (oSettings.aoColumns[i].bSortable !== false) {
+                _fnSortAttachListener(oSettings, oSettings.aoColumns[i].nTh, i);
+              }
+              else {
+                $(oSettings.aoColumns[i].nTh).addClass(oSettings.oClasses.sSortableNone);
+              }
+            }
+          }
+
+          /* Deal with the footer - add classes if required */
+          if (oSettings.oClasses.sFooterTH !== "") {
+            $(oSettings.nTFoot).children('tr').children('th').addClass(oSettings.oClasses.sFooterTH);
+          }
+
+          /* Cache the footer elements */
+          if (oSettings.nTFoot !== null) {
+            var anCells = _fnGetUniqueThs(oSettings, null, oSettings.aoFooter);
+            for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {
+              if (anCells[i]) {
+                oSettings.aoColumns[i].nTf = anCells[i];
+                if (oSettings.aoColumns[i].sClass) {
+                  $(anCells[i]).addClass(oSettings.aoColumns[i].sClass);
+                }
+              }
+            }
+          }
+        }
+
+
+        /**
+         * Draw the header (or footer) element based on the column visibility states. The
+         * methodology here is to use the layout array from _fnDetectHeader, modified for
+         * the instantaneous column visibility, to construct the new layout. The grid is
+         * traversed over cell at a time in a rows x columns grid fashion, although each
+         * cell insert can cover multiple elements in the grid - which is tracks using the
+         * aApplied array. Cell inserts in the grid will only occur where there isn't
+         * already a cell in that position.
+         *  @param {object} oSettings dataTables settings object
+         *  @param array {objects} aoSource Layout array from _fnDetectHeader
+         *  @param {boolean} [bIncludeHidden=false] If true then include the hidden columns in the calc,
+         *  @memberof DataTable#oApi
+         */
+        function _fnDrawHead(oSettings, aoSource, bIncludeHidden) {
+          var i, iLen, j, jLen, k, kLen, n, nLocalTr;
+          var aoLocal = [];
+          var aApplied = [];
+          var iColumns = oSettings.aoColumns.length;
+          var iRowspan, iColspan;
+
+          if (bIncludeHidden === undefined) {
+            bIncludeHidden = false;
+          }
+
+          /* Make a copy of the master layout array, but without the visible columns in it */
+          for (i = 0, iLen = aoSource.length; i < iLen; i++) {
+            aoLocal[i] = aoSource[i].slice();
+            aoLocal[i].nTr = aoSource[i].nTr;
+
+            /* Remove any columns which are currently hidden */
+            for (j = iColumns - 1; j >= 0; j--) {
+              if (!oSettings.aoColumns[j].bVisible && !bIncludeHidden) {
+                aoLocal[i].splice(j, 1);
+              }
+            }
+
+            /* Prep the applied array - it needs an element for each row */
+            aApplied.push([]);
+          }
+
+          for (i = 0, iLen = aoLocal.length; i < iLen; i++) {
+            nLocalTr = aoLocal[i].nTr;
+
+            /* All cells are going to be replaced, so empty out the row */
+            if (nLocalTr) {
+              while ((n = nLocalTr.firstChild)) {
+                nLocalTr.removeChild(n);
+              }
+            }
+
+            for (j = 0, jLen = aoLocal[i].length; j < jLen; j++) {
+              iRowspan = 1;
+              iColspan = 1;
+
+              /* Check to see if there is already a cell (row/colspan) covering our target
+               * insert point. If there is, then there is nothing to do.
+               */
+              if (aApplied[i][j] === undefined) {
+                nLocalTr.appendChild(aoLocal[i][j].cell);
+                aApplied[i][j] = 1;
+
+                /* Expand the cell to cover as many rows as needed */
+                while (aoLocal[i + iRowspan] !== undefined &&
+                  aoLocal[i][j].cell == aoLocal[i + iRowspan][j].cell) {
+                  aApplied[i + iRowspan][j] = 1;
+                  iRowspan++;
+                }
+
+                /* Expand the cell to cover as many columns as needed */
+                while (aoLocal[i][j + iColspan] !== undefined &&
+                  aoLocal[i][j].cell == aoLocal[i][j + iColspan].cell) {
+                  /* Must update the applied array over the rows for the columns */
+                  for (k = 0; k < iRowspan; k++) {
+                    aApplied[i + k][j + iColspan] = 1;
+                  }
+                  iColspan++;
+                }
+
+                /* Do the actual expansion in the DOM */
+                aoLocal[i][j].cell.rowSpan = iRowspan;
+                aoLocal[i][j].cell.colSpan = iColspan;
+              }
+            }
+          }
+        }
+
+
+        /**
+         * Insert the required TR nodes into the table for display
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnDraw(oSettings) {
+          /* Provide a pre-callback function which can be used to cancel the draw is false is returned */
+          var aPreDraw = _fnCallbackFire(oSettings, 'aoPreDrawCallback', 'preDraw', [oSettings]);
+          if ($.inArray(false, aPreDraw) !== -1) {
+            _fnProcessingDisplay(oSettings, false);
+            return;
+          }
+
+          var i, iLen, n;
+          var anRows = [];
+          var iRowCount = 0;
+          var iStripes = oSettings.asStripeClasses.length;
+          var iOpenRows = oSettings.aoOpenRows.length;
+
+          oSettings.bDrawing = true;
+
+          /* Check and see if we have an initial draw position from state saving */
+          if (oSettings.iInitDisplayStart !== undefined && oSettings.iInitDisplayStart != -1) {
+            if (oSettings.oFeatures.bServerSide) {
+              oSettings._iDisplayStart = oSettings.iInitDisplayStart;
+            }
+            else {
+              oSettings._iDisplayStart = (oSettings.iInitDisplayStart >= oSettings.fnRecordsDisplay()) ?
+                0 : oSettings.iInitDisplayStart;
+            }
+            oSettings.iInitDisplayStart = -1;
+            _fnCalculateEnd(oSettings);
+          }
+
+          /* Server-side processing draw intercept */
+          if (oSettings.bDeferLoading) {
+            oSettings.bDeferLoading = false;
+            oSettings.iDraw++;
+          }
+          else if (!oSettings.oFeatures.bServerSide) {
+            oSettings.iDraw++;
+          }
+          else if (!oSettings.bDestroying && !_fnAjaxUpdate(oSettings)) {
+            return;
+          }
+
+          if (oSettings.aiDisplay.length !== 0) {
+            var iStart = oSettings._iDisplayStart;
+            var iEnd = oSettings._iDisplayEnd;
+
+            if (oSettings.oFeatures.bServerSide) {
+              iStart = 0;
+              iEnd = oSettings.aoData.length;
+            }
+
+            for (var j = iStart; j < iEnd; j++) {
+              var aoData = oSettings.aoData[ oSettings.aiDisplay[j] ];
+              if (aoData.nTr === null) {
+                _fnCreateTr(oSettings, oSettings.aiDisplay[j]);
+              }
+
+              var nRow = aoData.nTr;
+
+              /* Remove the old striping classes and then add the new one */
+              if (iStripes !== 0) {
+                var sStripe = oSettings.asStripeClasses[ iRowCount % iStripes ];
+                if (aoData._sRowStripe != sStripe) {
+                  $(nRow).removeClass(aoData._sRowStripe).addClass(sStripe);
+                  aoData._sRowStripe = sStripe;
+                }
+              }
+
+              /* Row callback functions - might want to manipulate the row */
+              _fnCallbackFire(oSettings, 'aoRowCallback', null,
+                [nRow, oSettings.aoData[ oSettings.aiDisplay[j] ]._aData, iRowCount, j]);
+
+              anRows.push(nRow);
+              iRowCount++;
+
+              /* If there is an open row - and it is attached to this parent - attach it on redraw */
+              if (iOpenRows !== 0) {
+                for (var k = 0; k < iOpenRows; k++) {
+                  if (nRow == oSettings.aoOpenRows[k].nParent) {
+                    anRows.push(oSettings.aoOpenRows[k].nTr);
+                    break;
+                  }
+                }
+              }
+            }
+          }
+          else {
+            /* Table is empty - create a row with an empty message in it */
+            anRows[ 0 ] = document.createElement('tr');
+
+            if (oSettings.asStripeClasses[0]) {
+              anRows[ 0 ].className = oSettings.asStripeClasses[0];
+            }
+
+            var oLang = oSettings.oLanguage;
+            var sZero = oLang.sZeroRecords;
+            if (oSettings.iDraw == 1 && oSettings.sAjaxSource !== null && !oSettings.oFeatures.bServerSide) {
+              sZero = oLang.sLoadingRecords;
+            }
+            else if (oLang.sEmptyTable && oSettings.fnRecordsTotal() === 0) {
+              sZero = oLang.sEmptyTable;
+            }
+
+            var nTd = document.createElement('td');
+            nTd.setAttribute('valign', "top");
+            nTd.colSpan = _fnVisbleColumns(oSettings);
+            nTd.className = oSettings.oClasses.sRowEmpty;
+            nTd.innerHTML = _fnInfoMacros(oSettings, sZero);
+
+            anRows[ iRowCount ].appendChild(nTd);
+          }
+
+          /* Header and footer callbacks */
+          _fnCallbackFire(oSettings, 'aoHeaderCallback', 'header', [ $(oSettings.nTHead).children('tr')[0],
+            _fnGetDataMaster(oSettings), oSettings._iDisplayStart, oSettings.fnDisplayEnd(), oSettings.aiDisplay ]);
+
+          _fnCallbackFire(oSettings, 'aoFooterCallback', 'footer', [ $(oSettings.nTFoot).children('tr')[0],
+            _fnGetDataMaster(oSettings), oSettings._iDisplayStart, oSettings.fnDisplayEnd(), oSettings.aiDisplay ]);
+
+          /* 
+           * Need to remove any old row from the display - note we can't just empty the tbody using
+           * $().html('') since this will unbind the jQuery event handlers (even although the node 
+           * still exists!) - equally we can't use innerHTML, since IE throws an exception.
+           */
+          var
+            nAddFrag = document.createDocumentFragment(),
+            nRemoveFrag = document.createDocumentFragment(),
+            nBodyPar, nTrs;
+
+          if (oSettings.nTBody) {
+            nBodyPar = oSettings.nTBody.parentNode;
+            nRemoveFrag.appendChild(oSettings.nTBody);
+
+            /* When doing infinite scrolling, only remove child rows when sorting, filtering or start
+             * up. When not infinite scroll, always do it.
+             */
+            if (!oSettings.oScroll.bInfinite || !oSettings._bInitComplete ||
+              oSettings.bSorted || oSettings.bFiltered) {
+              while ((n = oSettings.nTBody.firstChild)) {
+                oSettings.nTBody.removeChild(n);
+              }
+            }
+
+            /* Put the draw table into the dom */
+            for (i = 0, iLen = anRows.length; i < iLen; i++) {
+              nAddFrag.appendChild(anRows[i]);
+            }
+
+            oSettings.nTBody.appendChild(nAddFrag);
+            if (nBodyPar !== null) {
+              nBodyPar.appendChild(oSettings.nTBody);
+            }
+          }
+
+          /* Call all required callback functions for the end of a draw */
+          _fnCallbackFire(oSettings, 'aoDrawCallback', 'draw', [oSettings]);
+
+          /* Draw is complete, sorting and filtering must be as well */
+          oSettings.bSorted = false;
+          oSettings.bFiltered = false;
+          oSettings.bDrawing = false;
+
+          if (oSettings.oFeatures.bServerSide) {
+            _fnProcessingDisplay(oSettings, false);
+            if (!oSettings._bInitComplete) {
+              _fnInitComplete(oSettings);
+            }
+          }
+        }
+
+
+        /**
+         * Redraw the table - taking account of the various features which are enabled
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnReDraw(oSettings) {
+          if (oSettings.oFeatures.bSort) {
+            /* Sorting will refilter and draw for us */
+            _fnSort(oSettings, oSettings.oPreviousSearch);
+          }
+          else if (oSettings.oFeatures.bFilter) {
+            /* Filtering will redraw for us */
+            _fnFilterComplete(oSettings, oSettings.oPreviousSearch);
+          }
+          else {
+            _fnCalculateEnd(oSettings);
+            _fnDraw(oSettings);
+          }
+        }
+
+
+        /**
+         * Add the options to the page HTML for the table
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnAddOptionsHtml(oSettings) {
+          /*
+           * Create a temporary, empty, div which we can later on replace with what we have generated
+           * we do it this way to rendering the 'options' html offline - speed :-)
+           */
+          var nHolding = $('<div></div>')[0];
+          oSettings.nTable.parentNode.insertBefore(nHolding, oSettings.nTable);
+
+          /* 
+           * All DataTables are wrapped in a div
+           */
+          oSettings.nTableWrapper = $('<div id="' + oSettings.sTableId + '_wrapper" class="' + oSettings.oClasses.sWrapper + '" role="grid"></div>')[0];
+          oSettings.nTableReinsertBefore = oSettings.nTable.nextSibling;
+
+          /* Track where we want to insert the option */
+          var nInsertNode = oSettings.nTableWrapper;
+
+          /* Loop over the user set positioning and place the elements as needed */
+          var aDom = oSettings.sDom.split('');
+          var nTmp, iPushFeature, cOption, nNewNode, cNext, sAttr, j;
+          for (var i = 0; i < aDom.length; i++) {
+            iPushFeature = 0;
+            cOption = aDom[i];
+
+            if (cOption == '<') {
+              /* New container div */
+              nNewNode = $('<div></div>')[0];
+
+              /* Check to see if we should append an id and/or a class name to the container */
+              cNext = aDom[i + 1];
+              if (cNext == "'" || cNext == '"') {
+                sAttr = "";
+                j = 2;
+                while (aDom[i + j] != cNext) {
+                  sAttr += aDom[i + j];
+                  j++;
+                }
+
+                /* Replace jQuery UI constants */
+                if (sAttr == "H") {
+                  sAttr = oSettings.oClasses.sJUIHeader;
+                }
+                else if (sAttr == "F") {
+                  sAttr = oSettings.oClasses.sJUIFooter;
+                }
+
+                /* The attribute can be in the format of "#id.class", "#id" or "class" This logic
+                 * breaks the string into parts and applies them as needed
+                 */
+                if (sAttr.indexOf('.') != -1) {
+                  var aSplit = sAttr.split('.');
+                  nNewNode.id = aSplit[0].substr(1, aSplit[0].length - 1);
+                  nNewNode.className = aSplit[1];
+                }
+                else if (sAttr.charAt(0) == "#") {
+                  nNewNode.id = sAttr.substr(1, sAttr.length - 1);
+                }
+                else {
+                  nNewNode.className = sAttr;
+                }
+
+                i += j;
+                /* Move along the position array */
+              }
+
+              nInsertNode.appendChild(nNewNode);
+              nInsertNode = nNewNode;
+            }
+            else if (cOption == '>') {
+              /* End container div */
+              nInsertNode = nInsertNode.parentNode;
+            }
+            else if (cOption == 'l' && oSettings.oFeatures.bPaginate && oSettings.oFeatures.bLengthChange) {
+              /* Length */
+              nTmp = _fnFeatureHtmlLength(oSettings);
+              iPushFeature = 1;
+            }
+            else if (cOption == 'f' && oSettings.oFeatures.bFilter) {
+              /* Filter */
+              nTmp = _fnFeatureHtmlFilter(oSettings);
+              iPushFeature = 1;
+            }
+            else if (cOption == 'r' && oSettings.oFeatures.bProcessing) {
+              /* pRocessing */
+              nTmp = _fnFeatureHtmlProcessing(oSettings);
+              iPushFeature = 1;
+            }
+            else if (cOption == 't') {
+              /* Table */
+              nTmp = _fnFeatureHtmlTable(oSettings);
+              iPushFeature = 1;
+            }
+            else if (cOption == 'i' && oSettings.oFeatures.bInfo) {
+              /* Info */
+              nTmp = _fnFeatureHtmlInfo(oSettings);
+              iPushFeature = 1;
+            }
+            else if (cOption == 'p' && oSettings.oFeatures.bPaginate) {
+              /* Pagination */
+              nTmp = _fnFeatureHtmlPaginate(oSettings);
+              iPushFeature = 1;
+            }
+            else if (DataTable.ext.aoFeatures.length !== 0) {
+              /* Plug-in features */
+              var aoFeatures = DataTable.ext.aoFeatures;
+              for (var k = 0, kLen = aoFeatures.length; k < kLen; k++) {
+                if (cOption == aoFeatures[k].cFeature) {
+                  nTmp = aoFeatures[k].fnInit(oSettings);
+                  if (nTmp) {
+                    iPushFeature = 1;
+                  }
+                  break;
+                }
+              }
+            }
+
+            /* Add to the 2D features array */
+            if (iPushFeature == 1 && nTmp !== null) {
+              if (typeof oSettings.aanFeatures[cOption] !== 'object') {
+                oSettings.aanFeatures[cOption] = [];
+              }
+              oSettings.aanFeatures[cOption].push(nTmp);
+              nInsertNode.appendChild(nTmp);
+            }
+          }
+
+          /* Built our DOM structure - replace the holding div with what we want */
+          nHolding.parentNode.replaceChild(oSettings.nTableWrapper, nHolding);
+        }
+
+
+        /**
+         * Use the DOM source to create up an array of header cells. The idea here is to
+         * create a layout grid (array) of rows x columns, which contains a reference
+         * to the cell that that point in the grid (regardless of col/rowspan), such that
+         * any column / row could be removed and the new grid constructed
+         *  @param array {object} aLayout Array to store the calculated layout in
+         *  @param {node} nThead The header/footer element for the table
+         *  @memberof DataTable#oApi
+         */
+        function _fnDetectHeader(aLayout, nThead) {
+          var nTrs = $(nThead).children('tr');
+          var nTr, nCell;
+          var i, k, l, iLen, jLen, iColShifted, iColumn, iColspan, iRowspan;
+          var bUnique;
+          var fnShiftCol = function (a, i, j) {
+            var k = a[i];
+            while (k[j]) {
+              j++;
+            }
+            return j;
+          };
+
+          aLayout.splice(0, aLayout.length);
+
+          /* We know how many rows there are in the layout - so prep it */
+          for (i = 0, iLen = nTrs.length; i < iLen; i++) {
+            aLayout.push([]);
+          }
+
+          /* Calculate a layout array */
+          for (i = 0, iLen = nTrs.length; i < iLen; i++) {
+            nTr = nTrs[i];
+            iColumn = 0;
+
+            /* For every cell in the row... */
+            nCell = nTr.firstChild;
+            while (nCell) {
+              if (nCell.nodeName.toUpperCase() == "TD" ||
+                nCell.nodeName.toUpperCase() == "TH") {
+                /* Get the col and rowspan attributes from the DOM and sanitise them */
+                iColspan = nCell.getAttribute('colspan') * 1;
+                iRowspan = nCell.getAttribute('rowspan') * 1;
+                iColspan = (!iColspan || iColspan === 0 || iColspan === 1) ? 1 : iColspan;
+                iRowspan = (!iRowspan || iRowspan === 0 || iRowspan === 1) ? 1 : iRowspan;
+
+                /* There might be colspan cells already in this row, so shift our target 
+                 * accordingly
+                 */
+                iColShifted = fnShiftCol(aLayout, i, iColumn);
+
+                /* Cache calculation for unique columns */
+                bUnique = iColspan === 1 ? true : false;
+
+                /* If there is col / rowspan, copy the information into the layout grid */
+                for (l = 0; l < iColspan; l++) {
+                  for (k = 0; k < iRowspan; k++) {
+                    aLayout[i + k][iColShifted + l] = {
+                      "cell":nCell,
+                      "unique":bUnique
+                    };
+                    aLayout[i + k].nTr = nTr;
+                  }
+                }
+              }
+              nCell = nCell.nextSibling;
+            }
+          }
+        }
+
+
+        /**
+         * Get an array of unique th elements, one for each column
+         *  @param {object} oSettings dataTables settings object
+         *  @param {node} nHeader automatically detect the layout from this node - optional
+         *  @param {array} aLayout thead/tfoot layout from _fnDetectHeader - optional
+         *  @returns array {node} aReturn list of unique th's
+         *  @memberof DataTable#oApi
+         */
+        function _fnGetUniqueThs(oSettings, nHeader, aLayout) {
+          var aReturn = [];
+          if (!aLayout) {
+            aLayout = oSettings.aoHeader;
+            if (nHeader) {
+              aLayout = [];
+              _fnDetectHeader(aLayout, nHeader);
+            }
+          }
+
+          for (var i = 0, iLen = aLayout.length; i < iLen; i++) {
+            for (var j = 0, jLen = aLayout[i].length; j < jLen; j++) {
+              if (aLayout[i][j].unique &&
+                (!aReturn[j] || !oSettings.bSortCellsTop)) {
+                aReturn[j] = aLayout[i][j].cell;
+              }
+            }
+          }
+
+          return aReturn;
+        }
+
+
+        /**
+         * Update the table using an Ajax call
+         *  @param {object} oSettings dataTables settings object
+         *  @returns {boolean} Block the table drawing or not
+         *  @memberof DataTable#oApi
+         */
+        function _fnAjaxUpdate(oSettings) {
+          if (oSettings.bAjaxDataGet) {
+            oSettings.iDraw++;
+            _fnProcessingDisplay(oSettings, true);
+            var iColumns = oSettings.aoColumns.length;
+            var aoData = _fnAjaxParameters(oSettings);
+            _fnServerParams(oSettings, aoData);
+
+            oSettings.fnServerData.call(oSettings.oInstance, oSettings.sAjaxSource, aoData,
+              function (json) {
+                _fnAjaxUpdateDraw(oSettings, json);
+              }, oSettings);
+            return false;
+          }
+          else {
+            return true;
+          }
+        }
+
+
+        /**
+         * Build up the parameters in an object needed for a server-side processing request
+         *  @param {object} oSettings dataTables settings object
+         *  @returns {bool} block the table drawing or not
+         *  @memberof DataTable#oApi
+         */
+        function _fnAjaxParameters(oSettings) {
+          var iColumns = oSettings.aoColumns.length;
+          var aoData = [], mDataProp, aaSort, aDataSort;
+          var i, j;
+
+          aoData.push({ "name":"sEcho", "value":oSettings.iDraw });
+          aoData.push({ "name":"iColumns", "value":iColumns });
+          aoData.push({ "name":"sColumns", "value":_fnColumnOrdering(oSettings) });
+          aoData.push({ "name":"iDisplayStart", "value":oSettings._iDisplayStart });
+          aoData.push({ "name":"iDisplayLength", "value":oSettings.oFeatures.bPaginate !== false ?
+            oSettings._iDisplayLength : -1 });
+
+          for (i = 0; i < iColumns; i++) {
+            mDataProp = oSettings.aoColumns[i].mData;
+            aoData.push({ "name":"mDataProp_" + i, "value":typeof(mDataProp) === "function" ? 'function' : mDataProp });
+          }
+
+          /* Filtering */
+          if (oSettings.oFeatures.bFilter !== false) {
+            aoData.push({ "name":"sSearch", "value":oSettings.oPreviousSearch.sSearch });
+            aoData.push({ "name":"bRegex", "value":oSettings.oPreviousSearch.bRegex });
+            for (i = 0; i < iColumns; i++) {
+              aoData.push({ "name":"sSearch_" + i, "value":oSettings.aoPreSearchCols[i].sSearch });
+              aoData.push({ "name":"bRegex_" + i, "value":oSettings.aoPreSearchCols[i].bRegex });
+              aoData.push({ "name":"bSearchable_" + i, "value":oSettings.aoColumns[i].bSearchable });
+            }
+          }
+
+          /* Sorting */
+          if (oSettings.oFeatures.bSort !== false) {
+            var iCounter = 0;
+
+            aaSort = ( oSettings.aaSortingFixed !== null ) ?
+              oSettings.aaSortingFixed.concat(oSettings.aaSorting) :
+              oSettings.aaSorting.slice();
+
+            for (i = 0; i < aaSort.length; i++) {
+              aDataSort = oSettings.aoColumns[ aaSort[i][0] ].aDataSort;
+
+              for (j = 0; j < aDataSort.length; j++) {
+                aoData.push({ "name":"iSortCol_" + iCounter, "value":aDataSort[j] });
+                aoData.push({ "name":"sSortDir_" + iCounter, "value":aaSort[i][1] });
+                iCounter++;
+              }
+            }
+            aoData.push({ "name":"iSortingCols", "value":iCounter });
+
+            for (i = 0; i < iColumns; i++) {
+              aoData.push({ "name":"bSortable_" + i, "value":oSettings.aoColumns[i].bSortable });
+            }
+          }
+
+          return aoData;
+        }
+
+
+        /**
+         * Add Ajax parameters from plug-ins
+         *  @param {object} oSettings dataTables settings object
+         *  @param array {objects} aoData name/value pairs to send to the server
+         *  @memberof DataTable#oApi
+         */
+        function _fnServerParams(oSettings, aoData) {
+          _fnCallbackFire(oSettings, 'aoServerParams', 'serverParams', [aoData]);
+        }
+
+
+        /**
+         * Data the data from the server (nuking the old) and redraw the table
+         *  @param {object} oSettings dataTables settings object
+         *  @param {object} json json data return from the server.
+         *  @param {string} json.sEcho Tracking flag for DataTables to match requests
+         *  @param {int} json.iTotalRecords Number of records in the data set, not accounting for filtering
+         *  @param {int} json.iTotalDisplayRecords Number of records in the data set, accounting for filtering
+         *  @param {array} json.aaData The data to display on this page
+         *  @param {string} [json.sColumns] Column ordering (sName, comma separated)
+         *  @memberof DataTable#oApi
+         */
+        function _fnAjaxUpdateDraw(oSettings, json) {
+          if (json.sEcho !== undefined) {
+            /* Protect against old returns over-writing a new one. Possible when you get
+             * very fast interaction, and later queries are completed much faster
+             */
+            if (json.sEcho * 1 < oSettings.iDraw) {
+              return;
+            }
+            else {
+              oSettings.iDraw = json.sEcho * 1;
+            }
+          }
+
+          if (!oSettings.oScroll.bInfinite ||
+            (oSettings.oScroll.bInfinite && (oSettings.bSorted || oSettings.bFiltered))) {
+            _fnClearTable(oSettings);
+          }
+          oSettings._iRecordsTotal = parseInt(json.iTotalRecords, 10);
+          oSettings._iRecordsDisplay = parseInt(json.iTotalDisplayRecords, 10);
+
+          /* Determine if reordering is required */
+          var sOrdering = _fnColumnOrdering(oSettings);
+          var bReOrder = (json.sColumns !== undefined && sOrdering !== "" && json.sColumns != sOrdering );
+          var aiIndex;
+          if (bReOrder) {
+            aiIndex = _fnReOrderIndex(oSettings, json.sColumns);
+          }
+
+          var aData = _fnGetObjectDataFn(oSettings.sAjaxDataProp)(json);
+          for (var i = 0, iLen = aData.length; i < iLen; i++) {
+            if (bReOrder) {
+              /* If we need to re-order, then create a new array with the correct order and add it */
+              var aDataSorted = [];
+              for (var j = 0, jLen = oSettings.aoColumns.length; j < jLen; j++) {
+                aDataSorted.push(aData[i][ aiIndex[j] ]);
+              }
+              _fnAddData(oSettings, aDataSorted);
+            }
+            else {
+              /* No re-order required, sever got it "right" - just straight add */
+              _fnAddData(oSettings, aData[i]);
+            }
+          }
+          oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
+
+          oSettings.bAjaxDataGet = false;
+          _fnDraw(oSettings);
+          oSettings.bAjaxDataGet = true;
+          _fnProcessingDisplay(oSettings, false);
+        }
+
+
+        /**
+         * Generate the node required for filtering text
+         *  @returns {node} Filter control element
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnFeatureHtmlFilter(oSettings) {
+          var oPreviousSearch = oSettings.oPreviousSearch;
+
+          var sSearchStr = oSettings.oLanguage.sSearch;
+          sSearchStr = (sSearchStr.indexOf('_INPUT_') !== -1) ?
+            sSearchStr.replace('_INPUT_', '<input type="text" />') :
+            sSearchStr === "" ? '<input type="text" />' : sSearchStr + ' <input type="text" />';
+
+          var nFilter = document.createElement('div');
+          nFilter.className = oSettings.oClasses.sFilter;
+          nFilter.innerHTML = '<label>' + sSearchStr + '</label>';
+          if (!oSettings.aanFeatures.f) {
+            nFilter.id = oSettings.sTableId + '_filter';
+          }
+
+          var jqFilter = $('input[type="text"]', nFilter);
+
+          // Store a reference to the input element, so other input elements could be
+          // added to the filter wrapper if needed (submit button for example)
+          nFilter._DT_Input = jqFilter[0];
+
+          jqFilter.val(oPreviousSearch.sSearch.replace('"', '&quot;'));
+          jqFilter.bind('keyup.DT', function (e) {
+            /* Update all other filter input elements for the new display */
+            var n = oSettings.aanFeatures.f;
+            var val = this.value === "" ? "" : this.value; // mental IE8 fix :-(
+
+            for (var i = 0, iLen = n.length; i < iLen; i++) {
+              if (n[i] != $(this).parents('div.dataTables_filter')[0]) {
+                $(n[i]._DT_Input).val(val);
+              }
+            }
+
+            /* Now do the filter */
+            if (val != oPreviousSearch.sSearch) {
+              _fnFilterComplete(oSettings, {
+                "sSearch":val,
+                "bRegex":oPreviousSearch.bRegex,
+                "bSmart":oPreviousSearch.bSmart,
+                "bCaseInsensitive":oPreviousSearch.bCaseInsensitive
+              });
+            }
+          });
+
+          jqFilter
+            .attr('aria-controls', oSettings.sTableId)
+            .bind('keypress.DT', function (e) {
+              /* Prevent form submission */
+              if (e.keyCode == 13) {
+                return false;
+              }
+            }
+          );
+
+          return nFilter;
+        }
+
+
+        /**
+         * Filter the table using both the global filter and column based filtering
+         *  @param {object} oSettings dataTables settings object
+         *  @param {object} oSearch search information
+         *  @param {int} [iForce] force a research of the master array (1) or not (undefined or 0)
+         *  @memberof DataTable#oApi
+         */
+        function _fnFilterComplete(oSettings, oInput, iForce) {
+          var oPrevSearch = oSettings.oPreviousSearch;
+          var aoPrevSearch = oSettings.aoPreSearchCols;
+          var fnSaveFilter = function (oFilter) {
+            /* Save the filtering values */
+            oPrevSearch.sSearch = oFilter.sSearch;
+            oPrevSearch.bRegex = oFilter.bRegex;
+            oPrevSearch.bSmart = oFilter.bSmart;
+            oPrevSearch.bCaseInsensitive = oFilter.bCaseInsensitive;
+          };
+
+          /* In server-side processing all filtering is done by the server, so no point hanging around here */
+          if (!oSettings.oFeatures.bServerSide) {
+            /* Global filter */
+            _fnFilter(oSettings, oInput.sSearch, iForce, oInput.bRegex, oInput.bSmart, oInput.bCaseInsensitive);
+            fnSaveFilter(oInput);
+
+            /* Now do the individual column filter */
+            for (var i = 0; i < oSettings.aoPreSearchCols.length; i++) {
+              _fnFilterColumn(oSettings, aoPrevSearch[i].sSearch, i, aoPrevSearch[i].bRegex,
+                aoPrevSearch[i].bSmart, aoPrevSearch[i].bCaseInsensitive);
+            }
+
+            /* Custom filtering */
+            _fnFilterCustom(oSettings);
+          }
+          else {
+            fnSaveFilter(oInput);
+          }
+
+          /* Tell the draw function we have been filtering */
+          oSettings.bFiltered = true;
+          $(oSettings.oInstance).trigger('filter', oSettings);
+
+          /* Redraw the table */
+          oSettings._iDisplayStart = 0;
+          _fnCalculateEnd(oSettings);
+          _fnDraw(oSettings);
+
+          /* Rebuild search array 'offline' */
+          _fnBuildSearchArray(oSettings, 0);
+        }
+
+
+        /**
+         * Apply custom filtering functions
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnFilterCustom(oSettings) {
+          var afnFilters = DataTable.ext.afnFiltering;
+          var aiFilterColumns = _fnGetColumns(oSettings, 'bSearchable');
+
+          for (var i = 0, iLen = afnFilters.length; i < iLen; i++) {
+            var iCorrector = 0;
+            for (var j = 0, jLen = oSettings.aiDisplay.length; j < jLen; j++) {
+              var iDisIndex = oSettings.aiDisplay[j - iCorrector];
+              var bTest = afnFilters[i](
+                oSettings,
+                _fnGetRowData(oSettings, iDisIndex, 'filter', aiFilterColumns),
+                iDisIndex
+              );
+
+              /* Check if we should use this row based on the filtering function */
+              if (!bTest) {
+                oSettings.aiDisplay.splice(j - iCorrector, 1);
+                iCorrector++;
+              }
+            }
+          }
+        }
+
+
+        /**
+         * Filter the table on a per-column basis
+         *  @param {object} oSettings dataTables settings object
+         *  @param {string} sInput string to filter on
+         *  @param {int} iColumn column to filter
+         *  @param {bool} bRegex treat search string as a regular expression or not
+         *  @param {bool} bSmart use smart filtering or not
+         *  @param {bool} bCaseInsensitive Do case insenstive matching or not
+         *  @memberof DataTable#oApi
+         */
+        function _fnFilterColumn(oSettings, sInput, iColumn, bRegex, bSmart, bCaseInsensitive) {
+          if (sInput === "") {
+            return;
+          }
+
+          var iIndexCorrector = 0;
+          var rpSearch = _fnFilterCreateSearch(sInput, bRegex, bSmart, bCaseInsensitive);
+
+          for (var i = oSettings.aiDisplay.length - 1; i >= 0; i--) {
+            var sData = _fnDataToSearch(_fnGetCellData(oSettings, oSettings.aiDisplay[i], iColumn, 'filter'),
+              oSettings.aoColumns[iColumn].sType);
+            if (!rpSearch.test(sData)) {
+              oSettings.aiDisplay.splice(i, 1);
+              iIndexCorrector++;
+            }
+          }
+        }
+
+
+        /**
+         * Filter the data table based on user input and draw the table
+         *  @param {object} oSettings dataTables settings object
+         *  @param {string} sInput string to filter on
+         *  @param {int} iForce optional - force a research of the master array (1) or not (undefined or 0)
+         *  @param {bool} bRegex treat as a regular expression or not
+         *  @param {bool} bSmart perform smart filtering or not
+         *  @param {bool} bCaseInsensitive Do case insenstive matching or not
+         *  @memberof DataTable#oApi
+         */
+        function _fnFilter(oSettings, sInput, iForce, bRegex, bSmart, bCaseInsensitive) {
+          var i;
+          var rpSearch = _fnFilterCreateSearch(sInput, bRegex, bSmart, bCaseInsensitive);
+          var oPrevSearch = oSettings.oPreviousSearch;
+
+          /* Check if we are forcing or not - optional parameter */
+          if (!iForce) {
+            iForce = 0;
+          }
+
+          /* Need to take account of custom filtering functions - always filter */
+          if (DataTable.ext.afnFiltering.length !== 0) {
+            iForce = 1;
+          }
+
+          /*
+           * If the input is blank - we want the full data set
+           */
+          if (sInput.length <= 0) {
+            oSettings.aiDisplay.splice(0, oSettings.aiDisplay.length);
+            oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
+          }
+          else {
+            /*
+             * We are starting a new search or the new search string is smaller 
+             * then the old one (i.e. delete). Search from the master array
+             */
+            if (oSettings.aiDisplay.length == oSettings.aiDisplayMaster.length ||
+              oPrevSearch.sSearch.length > sInput.length || iForce == 1 ||
+              sInput.indexOf(oPrevSearch.sSearch) !== 0) {
+              /* Nuke the old display array - we are going to rebuild it */
+              oSettings.aiDisplay.splice(0, oSettings.aiDisplay.length);
+
+              /* Force a rebuild of the search array */
+              _fnBuildSearchArray(oSettings, 1);
+
+              /* Search through all records to populate the search array
+               * The the oSettings.aiDisplayMaster and asDataSearch arrays have 1 to 1 
+               * mapping
+               */
+              for (i = 0; i < oSettings.aiDisplayMaster.length; i++) {
+                if (rpSearch.test(oSettings.asDataSearch[i])) {
+                  oSettings.aiDisplay.push(oSettings.aiDisplayMaster[i]);
+                }
+              }
+            }
+            else {
+              /* Using old search array - refine it - do it this way for speed
+               * Don't have to search the whole master array again
+               */
+              var iIndexCorrector = 0;
+
+              /* Search the current results */
+              for (i = 0; i < oSettings.asDataSearch.length; i++) {
+                if (!rpSearch.test(oSettings.asDataSearch[i])) {
+                  oSettings.aiDisplay.splice(i - iIndexCorrector, 1);
+                  iIndexCorrector++;
+                }
+              }
+            }
+          }
+        }
+
+
+        /**
+         * Create an array which can be quickly search through
+         *  @param {object} oSettings dataTables settings object
+         *  @param {int} iMaster use the master data array - optional
+         *  @memberof DataTable#oApi
+         */
+        function _fnBuildSearchArray(oSettings, iMaster) {
+          if (!oSettings.oFeatures.bServerSide) {
+            /* Clear out the old data */
+            oSettings.asDataSearch = [];
+
+            var aiFilterColumns = _fnGetColumns(oSettings, 'bSearchable');
+            var aiIndex = (iMaster === 1) ?
+              oSettings.aiDisplayMaster :
+              oSettings.aiDisplay;
+
+            for (var i = 0, iLen = aiIndex.length; i < iLen; i++) {
+              oSettings.asDataSearch[i] = _fnBuildSearchRow(
+                oSettings,
+                _fnGetRowData(oSettings, aiIndex[i], 'filter', aiFilterColumns)
+              );
+            }
+          }
+        }
+
+
+        /**
+         * Create a searchable string from a single data row
+         *  @param {object} oSettings dataTables settings object
+         *  @param {array} aData Row data array to use for the data to search
+         *  @memberof DataTable#oApi
+         */
+        function _fnBuildSearchRow(oSettings, aData) {
+          var sSearch = aData.join('  ');
+
+          /* If it looks like there is an HTML entity in the string, attempt to decode it */
+          if (sSearch.indexOf('&') !== -1) {
+            sSearch = $('<div>').html(sSearch).text();
+          }
+
+          // Strip newline characters
+          return sSearch.replace(/[\n\r]/g, " ");
+        }
+
+        /**
+         * Build a regular expression object suitable for searching a table
+         *  @param {string} sSearch string to search for
+         *  @param {bool} bRegex treat as a regular expression or not
+         *  @param {bool} bSmart perform smart filtering or not
+         *  @param {bool} bCaseInsensitive Do case insensitive matching or not
+         *  @returns {RegExp} constructed object
+         *  @memberof DataTable#oApi
+         */
+        function _fnFilterCreateSearch(sSearch, bRegex, bSmart, bCaseInsensitive) {
+          var asSearch, sRegExpString;
+
+          if (bSmart) {
+            /* Generate the regular expression to use. Something along the lines of:
+             * ^(?=.*?\bone\b)(?=.*?\btwo\b)(?=.*?\bthree\b).*$
+             */
+            asSearch = bRegex ? sSearch.split(' ') : _fnEscapeRegex(sSearch).split(' ');
+            sRegExpString = '^(?=.*?' + asSearch.join(')(?=.*?') + ').*$';
+            return new RegExp(sRegExpString, bCaseInsensitive ? "i" : "");
+          }
+          else {
+            sSearch = bRegex ? sSearch : _fnEscapeRegex(sSearch);
+            return new RegExp(sSearch, bCaseInsensitive ? "i" : "");
+          }
+        }
+
+
+        /**
+         * Convert raw data into something that the user can search on
+         *  @param {string} sData data to be modified
+         *  @param {string} sType data type
+         *  @returns {string} search string
+         *  @memberof DataTable#oApi
+         */
+        function _fnDataToSearch(sData, sType) {
+          if (typeof DataTable.ext.ofnSearch[sType] === "function") {
+            return DataTable.ext.ofnSearch[sType](sData);
+          }
+          else if (sData === null) {
+            return '';
+          }
+          else if (sType == "html") {
+            return sData.replace(/[\r\n]/g, " ").replace(/<.*?>/g, "");
+          }
+          else if (typeof sData === "string") {
+            return sData.replace(/[\r\n]/g, " ");
+          }
+          return sData;
+        }
+
+
+        /**
+         * scape a string such that it can be used in a regular expression
+         *  @param {string} sVal string to escape
+         *  @returns {string} escaped string
+         *  @memberof DataTable#oApi
+         */
+        function _fnEscapeRegex(sVal) {
+          var acEscape = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^', '-' ];
+          var reReplace = new RegExp('(\\' + acEscape.join('|\\') + ')', 'g');
+          return sVal.replace(reReplace, '\\$1');
+        }
+
+
+        /**
+         * Generate the node required for the info display
+         *  @param {object} oSettings dataTables settings object
+         *  @returns {node} Information element
+         *  @memberof DataTable#oApi
+         */
+        function _fnFeatureHtmlInfo(oSettings) {
+          var nInfo = document.createElement('div');
+          nInfo.className = oSettings.oClasses.sInfo;
+
+          /* Actions that are to be taken once only for this feature */
+          if (!oSettings.aanFeatures.i) {
+            /* Add draw callback */
+            oSettings.aoDrawCallback.push({
+              "fn":_fnUpdateInfo,
+              "sName":"information"
+            });
+
+            /* Add id */
+            nInfo.id = oSettings.sTableId + '_info';
+          }
+          oSettings.nTable.setAttribute('aria-describedby', oSettings.sTableId + '_info');
+
+          return nInfo;
+        }
+
+
+        /**
+         * Update the information elements in the display
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnUpdateInfo(oSettings) {
+          /* Show information about the table */
+          if (!oSettings.oFeatures.bInfo || oSettings.aanFeatures.i.length === 0) {
+            return;
+          }
+
+          var
+            oLang = oSettings.oLanguage,
+            iStart = oSettings._iDisplayStart + 1,
+            iEnd = oSettings.fnDisplayEnd(),
+            iMax = oSettings.fnRecordsTotal(),
+            iTotal = oSettings.fnRecordsDisplay(),
+            sOut;
+
+          if (iTotal === 0) {
+            /* Empty record set */
+            sOut = oLang.sInfoEmpty;
+          }
+          else {
+            /* Normal record set */
+            sOut = oLang.sInfo;
+          }
+
+          if (iTotal != iMax) {
+            /* Record set after filtering */
+            sOut += ' ' + oLang.sInfoFiltered;
+          }
+
+          // Convert the macros
+          sOut += oLang.sInfoPostFix;
+          sOut = _fnInfoMacros(oSettings, sOut);
+
+          if (oLang.fnInfoCallback !== null) {
+            sOut = oLang.fnInfoCallback.call(oSettings.oInstance,
+              oSettings, iStart, iEnd, iMax, iTotal, sOut);
+          }
+
+          var n = oSettings.aanFeatures.i;
+          for (var i = 0, iLen = n.length; i < iLen; i++) {
+            $(n[i]).html(sOut);
+          }
+        }
+
+
+        function _fnInfoMacros(oSettings, str) {
+          var
+            iStart = oSettings._iDisplayStart + 1,
+            sStart = oSettings.fnFormatNumber(iStart),
+            iEnd = oSettings.fnDisplayEnd(),
+            sEnd = oSettings.fnFormatNumber(iEnd),
+            iTotal = oSettings.fnRecordsDisplay(),
+            sTotal = oSettings.fnFormatNumber(iTotal),
+            iMax = oSettings.fnRecordsTotal(),
+            sMax = oSettings.fnFormatNumber(iMax);
+
+          // When infinite scrolling, we are always starting at 1. _iDisplayStart is used only
+          // internally
+          if (oSettings.oScroll.bInfinite) {
+            sStart = oSettings.fnFormatNumber(1);
+          }
+
+          return str.
+            replace(/_START_/g, sStart).
+            replace(/_END_/g, sEnd).
+            replace(/_TOTAL_/g, sTotal).
+            replace(/_MAX_/g, sMax);
+        }
+
+
+        /**
+         * Draw the table for the first time, adding all required features
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnInitialise(oSettings) {
+          var i, iLen, iAjaxStart = oSettings.iInitDisplayStart;
+
+          /* Ensure that the table data is fully initialised */
+          if (oSettings.bInitialised === false) {
+            setTimeout(function () {
+              _fnInitialise(oSettings);
+            }, 200);
+            return;
+          }
+
+          /* Show the display HTML options */
+          _fnAddOptionsHtml(oSettings);
+
+          /* Build and draw the header / footer for the table */
+          _fnBuildHead(oSettings);
+          _fnDrawHead(oSettings, oSettings.aoHeader);
+          if (oSettings.nTFoot) {
+            _fnDrawHead(oSettings, oSettings.aoFooter);
+          }
+
+          /* Okay to show that something is going on now */
+          _fnProcessingDisplay(oSettings, true);
+
+          /* Calculate sizes for columns */
+          if (oSettings.oFeatures.bAutoWidth) {
+            _fnCalculateColumnWidths(oSettings);
+          }
+
+          for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {
+            if (oSettings.aoColumns[i].sWidth !== null) {
+              oSettings.aoColumns[i].nTh.style.width = _fnStringToCss(oSettings.aoColumns[i].sWidth);
+            }
+          }
+
+          /* If there is default sorting required - let's do it. The sort function will do the
+           * drawing for us. Otherwise we draw the table regardless of the Ajax source - this allows
+           * the table to look initialised for Ajax sourcing data (show 'loading' message possibly)
+           */
+          if (oSettings.oFeatures.bSort) {
+            _fnSort(oSettings);
+          }
+          else if (oSettings.oFeatures.bFilter) {
+            _fnFilterComplete(oSettings, oSettings.oPreviousSearch);
+          }
+          else {
+            oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
+            _fnCalculateEnd(oSettings);
+            _fnDraw(oSettings);
+          }
+
+          /* if there is an ajax source load the data */
+          if (oSettings.sAjaxSource !== null && !oSettings.oFeatures.bServerSide) {
+            var aoData = [];
+            _fnServerParams(oSettings, aoData);
+            oSettings.fnServerData.call(oSettings.oInstance, oSettings.sAjaxSource, aoData, function (json) {
+              var aData = (oSettings.sAjaxDataProp !== "") ?
+                _fnGetObjectDataFn(oSettings.sAjaxDataProp)(json) : json;
+
+              /* Got the data - add it to the table */
+              for (i = 0; i < aData.length; i++) {
+                _fnAddData(oSettings, aData[i]);
+              }
+
+              /* Reset the init display for cookie saving. We've already done a filter, and
+               * therefore cleared it before. So we need to make it appear 'fresh'
+               */
+              oSettings.iInitDisplayStart = iAjaxStart;
+
+              if (oSettings.oFeatures.bSort) {
+                _fnSort(oSettings);
+              }
+              else {
+                oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
+                _fnCalculateEnd(oSettings);
+                _fnDraw(oSettings);
+              }
+
+              _fnProcessingDisplay(oSettings, false);
+              _fnInitComplete(oSettings, json);
+            }, oSettings);
+            return;
+          }
+
+          /* Server-side processing initialisation complete is done at the end of _fnDraw */
+          if (!oSettings.oFeatures.bServerSide) {
+            _fnProcessingDisplay(oSettings, false);
+            _fnInitComplete(oSettings);
+          }
+        }
+
+
+        /**
+         * Draw the table for the first time, adding all required features
+         *  @param {object} oSettings dataTables settings object
+         *  @param {object} [json] JSON from the server that completed the table, if using Ajax source
+         *    with client-side processing (optional)
+         *  @memberof DataTable#oApi
+         */
+        function _fnInitComplete(oSettings, json) {
+          oSettings._bInitComplete = true;
+          _fnCallbackFire(oSettings, 'aoInitComplete', 'init', [oSettings, json]);
+        }
+
+
+        /**
+         * Language compatibility - when certain options are given, and others aren't, we
+         * need to duplicate the values over, in order to provide backwards compatibility
+         * with older language files.
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnLanguageCompat(oLanguage) {
+          var oDefaults = DataTable.defaults.oLanguage;
+
+          /* Backwards compatibility - if there is no sEmptyTable given, then use the same as
+           * sZeroRecords - assuming that is given.
+           */
+          if (!oLanguage.sEmptyTable && oLanguage.sZeroRecords &&
+            oDefaults.sEmptyTable === "No data available in table") {
+            _fnMap(oLanguage, oLanguage, 'sZeroRecords', 'sEmptyTable');
+          }
+
+          /* Likewise with loading records */
+          if (!oLanguage.sLoadingRecords && oLanguage.sZeroRecords &&
+            oDefaults.sLoadingRecords === "Loading...") {
+            _fnMap(oLanguage, oLanguage, 'sZeroRecords', 'sLoadingRecords');
+          }
+        }
+
+
+        /**
+         * Generate the node required for user display length changing
+         *  @param {object} oSettings dataTables settings object
+         *  @returns {node} Display length feature node
+         *  @memberof DataTable#oApi
+         */
+        function _fnFeatureHtmlLength(oSettings) {
+          if (oSettings.oScroll.bInfinite) {
+            return null;
+          }
+
+          /* This can be overruled by not using the _MENU_ var/macro in the language variable */
+          var sName = 'name="' + oSettings.sTableId + '_length"';
+          var sStdMenu = '<select size="1" ' + sName + '>';
+          var i, iLen;
+          var aLengthMenu = oSettings.aLengthMenu;
+
+          if (aLengthMenu.length == 2 && typeof aLengthMenu[0] === 'object' &&
+            typeof aLengthMenu[1] === 'object') {
+            for (i = 0, iLen = aLengthMenu[0].length; i < iLen; i++) {
+              sStdMenu += '<option value="' + aLengthMenu[0][i] + '">' + aLengthMenu[1][i] + '</option>';
+            }
+          }
+          else {
+            for (i = 0, iLen = aLengthMenu.length; i < iLen; i++) {
+              sStdMenu += '<option value="' + aLengthMenu[i] + '">' + aLengthMenu[i] + '</option>';
+            }
+          }
+          sStdMenu += '</select>';
+
+          var nLength = document.createElement('div');
+          if (!oSettings.aanFeatures.l) {
+            nLength.id = oSettings.sTableId + '_length';
+          }
+          nLength.className = oSettings.oClasses.sLength;
+          nLength.innerHTML = '<label>' + oSettings.oLanguage.sLengthMenu.replace('_MENU_', sStdMenu) + '</label>';
+
+          /*
+           * Set the length to the current display length - thanks to Andrea Pavlovic for this fix,
+           * and Stefan Skopnik for fixing the fix!
+           */
+          $('select option[value="' + oSettings._iDisplayLength + '"]', nLength).attr("selected", true);
+
+          $('select', nLength).bind('change.DT', function (e) {
+            var iVal = $(this).val();
+
+            /* Update all other length options for the new display */
+            var n = oSettings.aanFeatures.l;
+            for (i = 0, iLen = n.length; i < iLen; i++) {
+              if (n[i] != this.parentNode) {
+                $('select', n[i]).val(iVal);
+              }
+            }
+
+            /* Redraw the table */
+            oSettings._iDisplayLength = parseInt(iVal, 10);
+            _fnCalculateEnd(oSettings);
+
+            /* If we have space to show extra rows (backing up from the end point - then do so */
+            if (oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay()) {
+              oSettings._iDisplayStart = oSettings.fnDisplayEnd() - oSettings._iDisplayLength;
+              if (oSettings._iDisplayStart < 0) {
+                oSettings._iDisplayStart = 0;
+              }
+            }
+
+            if (oSettings._iDisplayLength == -1) {
+              oSettings._iDisplayStart = 0;
+            }
+
+            _fnDraw(oSettings);
+          });
+
+
+          $('select', nLength).attr('aria-controls', oSettings.sTableId);
+
+          return nLength;
+        }
+
+
+        /**
+         * Recalculate the end point based on the start point
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnCalculateEnd(oSettings) {
+          if (oSettings.oFeatures.bPaginate === false) {
+            oSettings._iDisplayEnd = oSettings.aiDisplay.length;
+          }
+          else {
+            /* Set the end point of the display - based on how many elements there are
+             * still to display
+             */
+            if (oSettings._iDisplayStart + oSettings._iDisplayLength > oSettings.aiDisplay.length ||
+              oSettings._iDisplayLength == -1) {
+              oSettings._iDisplayEnd = oSettings.aiDisplay.length;
+            }
+            else {
+              oSettings._iDisplayEnd = oSettings._iDisplayStart + oSettings._iDisplayLength;
+            }
+          }
+        }
+
+
+        /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+         * Note that most of the paging logic is done in 
+         * DataTable.ext.oPagination
+         */
+
+        /**
+         * Generate the node required for default pagination
+         *  @param {object} oSettings dataTables settings object
+         *  @returns {node} Pagination feature node
+         *  @memberof DataTable#oApi
+         */
+        function _fnFeatureHtmlPaginate(oSettings) {
+          if (oSettings.oScroll.bInfinite) {
+            return null;
+          }
+
+          var nPaginate = document.createElement('div');
+          nPaginate.className = oSettings.oClasses.sPaging + oSettings.sPaginationType;
+
+          DataTable.ext.oPagination[ oSettings.sPaginationType ].fnInit(oSettings, nPaginate,
+            function (oSettings) {
+              _fnCalculateEnd(oSettings);
+              _fnDraw(oSettings);
+            }
+          );
+
+          /* Add a draw callback for the pagination on first instance, to update the paging display */
+          if (!oSettings.aanFeatures.p) {
+            oSettings.aoDrawCallback.push({
+              "fn":function (oSettings) {
+                DataTable.ext.oPagination[ oSettings.sPaginationType ].fnUpdate(oSettings, function (oSettings) {
+                  _fnCalculateEnd(oSettings);
+                  _fnDraw(oSettings);
+                });
+              },
+              "sName":"pagination"
+            });
+          }
+          return nPaginate;
+        }
+
+
+        /**
+         * Alter the display settings to change the page
+         *  @param {object} oSettings dataTables settings object
+         *  @param {string|int} mAction Paging action to take: "first", "previous", "next" or "last"
+         *    or page number to jump to (integer)
+         *  @returns {bool} true page has changed, false - no change (no effect) eg 'first' on page 1
+         *  @memberof DataTable#oApi
+         */
+        function _fnPageChange(oSettings, mAction) {
+          var iOldStart = oSettings._iDisplayStart;
+
+          if (typeof mAction === "number") {
+            oSettings._iDisplayStart = mAction * oSettings._iDisplayLength;
+            if (oSettings._iDisplayStart > oSettings.fnRecordsDisplay()) {
+              oSettings._iDisplayStart = 0;
+            }
+          }
+          else if (mAction == "first") {
+            oSettings._iDisplayStart = 0;
+          }
+          else if (mAction == "previous") {
+            oSettings._iDisplayStart = oSettings._iDisplayLength >= 0 ?
+              oSettings._iDisplayStart - oSettings._iDisplayLength :
+              0;
+
+            /* Correct for under-run */
+            if (oSettings._iDisplayStart < 0) {
+              oSettings._iDisplayStart = 0;
+            }
+          }
+          else if (mAction == "next") {
+            if (oSettings._iDisplayLength >= 0) {
+              /* Make sure we are not over running the display array */
+              if (oSettings._iDisplayStart + oSettings._iDisplayLength < oSettings.fnRecordsDisplay()) {
+                oSettings._iDisplayStart += oSettings._iDisplayLength;
+              }
+            }
+            else {
+              oSettings._iDisplayStart = 0;
+            }
+          }
+          else if (mAction == "last") {
+            if (oSettings._iDisplayLength >= 0) {
+              var iPages = parseInt((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength, 10) + 1;
+              oSettings._iDisplayStart = (iPages - 1) * oSettings._iDisplayLength;
+            }
+            else {
+              oSettings._iDisplayStart = 0;
+            }
+          }
+          else {
+            _fnLog(oSettings, 0, "Unknown paging action: " + mAction);
+          }
+          $(oSettings.oInstance).trigger('page', oSettings);
+
+          return iOldStart != oSettings._iDisplayStart;
+        }
+
+
+        /**
+         * Generate the node required for the processing node
+         *  @param {object} oSettings dataTables settings object
+         *  @returns {node} Processing element
+         *  @memberof DataTable#oApi
+         */
+        function _fnFeatureHtmlProcessing(oSettings) {
+          var nProcessing = document.createElement('div');
+
+          if (!oSettings.aanFeatures.r) {
+            nProcessing.id = oSettings.sTableId + '_processing';
+          }
+          nProcessing.innerHTML = oSettings.oLanguage.sProcessing;
+          nProcessing.className = oSettings.oClasses.sProcessing;
+          oSettings.nTable.parentNode.insertBefore(nProcessing, oSettings.nTable);
+
+          return nProcessing;
+        }
+
+
+        /**
+         * Display or hide the processing indicator
+         *  @param {object} oSettings dataTables settings object
+         *  @param {bool} bShow Show the processing indicator (true) or not (false)
+         *  @memberof DataTable#oApi
+         */
+        function _fnProcessingDisplay(oSettings, bShow) {
+          if (oSettings.oFeatures.bProcessing) {
+            var an = oSettings.aanFeatures.r;
+            for (var i = 0, iLen = an.length; i < iLen; i++) {
+              an[i].style.visibility = bShow ? "visible" : "hidden";
+            }
+          }
+
+          $(oSettings.oInstance).trigger('processing', [oSettings, bShow]);
+        }
+
+        /**
+         * Add any control elements for the table - specifically scrolling
+         *  @param {object} oSettings dataTables settings object
+         *  @returns {node} Node to add to the DOM
+         *  @memberof DataTable#oApi
+         */
+        function _fnFeatureHtmlTable(oSettings) {
+          /* Check if scrolling is enabled or not - if not then leave the DOM unaltered */
+          if (oSettings.oScroll.sX === "" && oSettings.oScroll.sY === "") {
+            return oSettings.nTable;
+          }
+
+          /*
+           * The HTML structure that we want to generate in this function is:
+           *  div - nScroller
+           *    div - nScrollHead
+           *      div - nScrollHeadInner
+           *        table - nScrollHeadTable
+           *          thead - nThead
+           *    div - nScrollBody
+           *      table - oSettings.nTable
+           *        thead - nTheadSize
+           *        tbody - nTbody
+           *    div - nScrollFoot
+           *      div - nScrollFootInner
+           *        table - nScrollFootTable
+           *          tfoot - nTfoot
+           */
+          var
+            nScroller = document.createElement('div'),
+            nScrollHead = document.createElement('div'),
+            nScrollHeadInner = document.createElement('div'),
+            nScrollBody = document.createElement('div'),
+            nScrollFoot = document.createElement('div'),
+            nScrollFootInner = document.createElement('div'),
+            nScrollHeadTable = oSettings.nTable.cloneNode(false),
+            nScrollFootTable = oSettings.nTable.cloneNode(false),
+            nThead = oSettings.nTable.getElementsByTagName('thead')[0],
+            nTfoot = oSettings.nTable.getElementsByTagName('tfoot').length === 0 ? null :
+              oSettings.nTable.getElementsByTagName('tfoot')[0],
+            oClasses = oSettings.oClasses;
+
+          nScrollHead.appendChild(nScrollHeadInner);
+          nScrollFoot.appendChild(nScrollFootInner);
+          nScrollBody.appendChild(oSettings.nTable);
+          nScroller.appendChild(nScrollHead);
+          nScroller.appendChild(nScrollBody);
+          nScrollHeadInner.appendChild(nScrollHeadTable);
+          nScrollHeadTable.appendChild(nThead);
+          if (nTfoot !== null) {
+            nScroller.appendChild(nScrollFoot);
+            nScrollFootInner.appendChild(nScrollFootTable);
+            nScrollFootTable.appendChild(nTfoot);
+          }
+
+          nScroller.className = oClasses.sScrollWrapper;
+          nScrollHead.className = oClasses.sScrollHead;
+          nScrollHeadInner.className = oClasses.sScrollHeadInner;
+          nScrollBody.className = oClasses.sScrollBody;
+          nScrollFoot.className = oClasses.sScrollFoot;
+          nScrollFootInner.className = oClasses.sScrollFootInner;
+
+          if (oSettings.oScroll.bAutoCss) {
+            nScrollHead.style.overflow = "hidden";
+            nScrollHead.style.position = "relative";
+            nScrollFoot.style.overflow = "hidden";
+            nScrollBody.style.overflow = "auto";
+          }
+
+          nScrollHead.style.border = "0";
+          nScrollHead.style.width = "100%";
+          nScrollFoot.style.border = "0";
+          nScrollHeadInner.style.width = oSettings.oScroll.sXInner !== "" ?
+            oSettings.oScroll.sXInner : "100%";
+          /* will be overwritten */
+
+          /* Modify attributes to respect the clones */
+          nScrollHeadTable.removeAttribute('id');
+          nScrollHeadTable.style.marginLeft = "0";
+          oSettings.nTable.style.marginLeft = "0";
+          if (nTfoot !== null) {
+            nScrollFootTable.removeAttribute('id');
+            nScrollFootTable.style.marginLeft = "0";
+          }
+
+          /* Move caption elements from the body to the header, footer or leave where it is
+           * depending on the configuration. Note that the DTD says there can be only one caption */
+          var nCaption = $(oSettings.nTable).children('caption');
+          if (nCaption.length > 0) {
+            nCaption = nCaption[0];
+            if (nCaption._captionSide === "top") {
+              nScrollHeadTable.appendChild(nCaption);
+            }
+            else if (nCaption._captionSide === "bottom" && nTfoot) {
+              nScrollFootTable.appendChild(nCaption);
+            }
+          }
+
+          /*
+           * Sizing
+           */
+          /* When x-scrolling add the width and a scroller to move the header with the body */
+          if (oSettings.oScroll.sX !== "") {
+            nScrollHead.style.width = _fnStringToCss(oSettings.oScroll.sX);
+            nScrollBody.style.width = _fnStringToCss(oSettings.oScroll.sX);
+
+            if (nTfoot !== null) {
+              nScrollFoot.style.width = _fnStringToCss(oSettings.oScroll.sX);
+            }
+
+            /* When the body is scrolled, then we also want to scroll the headers */
+            $(nScrollBody).scroll(function (e) {
+              nScrollHead.scrollLeft = this.scrollLeft;
+
+              if (nTfoot !== null) {
+                nScrollFoot.scrollLeft = this.scrollLeft;
+              }
+            });
+          }
+
+          /* When yscrolling, add the height */
+          if (oSettings.oScroll.sY !== "") {
+            nScrollBody.style.height = _fnStringToCss(oSettings.oScroll.sY);
+          }
+
+          /* Redraw - align columns across the tables */
+          oSettings.aoDrawCallback.push({
+            "fn":_fnScrollDraw,
+            "sName":"scrolling"
+          });
+
+          /* Infinite scrolling event handlers */
+          if (oSettings.oScroll.bInfinite) {
+            $(nScrollBody).scroll(function () {
+              /* Use a blocker to stop scrolling from loading more data while other data is still loading */
+              if (!oSettings.bDrawing && $(this).scrollTop() !== 0) {
+                /* Check if we should load the next data set */
+                if ($(this).scrollTop() + $(this).height() >
+                  $(oSettings.nTable).height() - oSettings.oScroll.iLoadGap) {
+                  /* Only do the redraw if we have to - we might be at the end of the data */
+                  if (oSettings.fnDisplayEnd() < oSettings.fnRecordsDisplay()) {
+                    _fnPageChange(oSettings, 'next');
+                    _fnCalculateEnd(oSettings);
+                    _fnDraw(oSettings);
+                  }
+                }
+              }
+            });
+          }
+
+          oSettings.nScrollHead = nScrollHead;
+          oSettings.nScrollFoot = nScrollFoot;
+
+          return nScroller;
+        }
+
+
+        /**
+         * Update the various tables for resizing. It's a bit of a pig this function, but
+         * basically the idea to:
+         *   1. Re-create the table inside the scrolling div
+         *   2. Take live measurements from the DOM
+         *   3. Apply the measurements
+         *   4. Clean up
+         *  @param {object} o dataTables settings object
+         *  @returns {node} Node to add to the DOM
+         *  @memberof DataTable#oApi
+         */
+        function _fnScrollDraw(o) {
+          var
+            nScrollHeadInner = o.nScrollHead.getElementsByTagName('div')[0],
+            nScrollHeadTable = nScrollHeadInner.getElementsByTagName('table')[0],
+            nScrollBody = o.nTable.parentNode,
+            i, iLen, j, jLen, anHeadToSize, anHeadSizers, anFootSizers, anFootToSize, oStyle, iVis,
+            nTheadSize, nTfootSize,
+            iWidth, aApplied = [], aAppliedFooter = [], iSanityWidth,
+            nScrollFootInner = (o.nTFoot !== null) ? o.nScrollFoot.getElementsByTagName('div')[0] : null,
+            nScrollFootTable = (o.nTFoot !== null) ? nScrollFootInner.getElementsByTagName('table')[0] : null,
+            ie67 = o.oBrowser.bScrollOversize,
+            zeroOut = function (nSizer) {
+              oStyle = nSizer.style;
+              oStyle.paddingTop = "0";
+              oStyle.paddingBottom = "0";
+              oStyle.borderTopWidth = "0";
+              oStyle.borderBottomWidth = "0";
+              oStyle.height = 0;
+            };
+
+          /*
+           * 1. Re-create the table inside the scrolling div
+           */
+
+          /* Remove the old minimised thead and tfoot elements in the inner table */
+          $(o.nTable).children('thead, tfoot').remove();
+
+          /* Clone the current header and footer elements and then place it into the inner table */
+          nTheadSize = $(o.nTHead).clone()[0];
+          o.nTable.insertBefore(nTheadSize, o.nTable.childNodes[0]);
+          anHeadToSize = o.nTHead.getElementsByTagName('tr');
+          anHeadSizers = nTheadSize.getElementsByTagName('tr');
+
+          if (o.nTFoot !== null) {
+            nTfootSize = $(o.nTFoot).clone()[0];
+            o.nTable.insertBefore(nTfootSize, o.nTable.childNodes[1]);
+            anFootToSize = o.nTFoot.getElementsByTagName('tr');
+            anFootSizers = nTfootSize.getElementsByTagName('tr');
+          }
+
+          /*
+           * 2. Take live measurements from the DOM - do not alter the DOM itself!
+           */
+
+          /* Remove old sizing and apply the calculated column widths
+           * Get the unique column headers in the newly created (cloned) header. We want to apply the
+           * calculated sizes to this header
+           */
+          if (o.oScroll.sX === "") {
+            nScrollBody.style.width = '100%';
+            nScrollHeadInner.parentNode.style.width = '100%';
+          }
+
+          var nThs = _fnGetUniqueThs(o, nTheadSize);
+          for (i = 0, iLen = nThs.length; i < iLen; i++) {
+            iVis = _fnVisibleToColumnIndex(o, i);
+            nThs[i].style.width = o.aoColumns[iVis].sWidth;
+          }
+
+          if (o.nTFoot !== null) {
+            _fnApplyToChildren(function (n) {
+              n.style.width = "";
+            }, anFootSizers);
+          }
+
+          // If scroll collapse is enabled, when we put the headers back into the body for sizing, we
+          // will end up forcing the scrollbar to appear, making our measurements wrong for when we
+          // then hide it (end of this function), so add the header height to the body scroller.
+          if (o.oScroll.bCollapse && o.oScroll.sY !== "") {
+            nScrollBody.style.height = (nScrollBody.offsetHeight + o.nTHead.offsetHeight) + "px";
+          }
+
+          /* Size the table as a whole */
+          iSanityWidth = $(o.nTable).outerWidth();
+          if (o.oScroll.sX === "") {
+            /* No x scrolling */
+            o.nTable.style.width = "100%";
+
+            /* I know this is rubbish - but IE7 will make the width of the table when 100% include
+             * the scrollbar - which is shouldn't. When there is a scrollbar we need to take this
+             * into account.
+             */
+            if (ie67 && ($('tbody', nScrollBody).height() > nScrollBody.offsetHeight ||
+              $(nScrollBody).css('overflow-y') == "scroll")) {
+              o.nTable.style.width = _fnStringToCss($(o.nTable).outerWidth() - o.oScroll.iBarWidth);
+            }
+          }
+          else {
+            if (o.oScroll.sXInner !== "") {
+              /* x scroll inner has been given - use it */
+              o.nTable.style.width = _fnStringToCss(o.oScroll.sXInner);
+            }
+            else if (iSanityWidth == $(nScrollBody).width() &&
+              $(nScrollBody).height() < $(o.nTable).height()) {
+              /* There is y-scrolling - try to take account of the y scroll bar */
+              o.nTable.style.width = _fnStringToCss(iSanityWidth - o.oScroll.iBarWidth);
+              if ($(o.nTable).outerWidth() > iSanityWidth - o.oScroll.iBarWidth) {
+                /* Not possible to take account of it */
+                o.nTable.style.width = _fnStringToCss(iSanityWidth);
+              }
+            }
+            else {
+              /* All else fails */
+              o.nTable.style.width = _fnStringToCss(iSanityWidth);
+            }
+          }
+
+          /* Recalculate the sanity width - now that we've applied the required width, before it was
+           * a temporary variable. This is required because the column width calculation is done
+           * before this table DOM is created.
+           */
+          iSanityWidth = $(o.nTable).outerWidth();
+
+          /* We want the hidden header to have zero height, so remove padding and borders. Then
+           * set the width based on the real headers
+           */
+
+          // Apply all styles in one pass. Invalidates layout only once because we don't read any 
+          // DOM properties.
+          _fnApplyToChildren(zeroOut, anHeadSizers);
+
+          // Read all widths in next pass. Forces layout only once because we do not change 
+          // any DOM properties.
+          _fnApplyToChildren(function (nSizer) {
+            aApplied.push(_fnStringToCss($(nSizer).width()));
+          }, anHeadSizers);
+
+          // Apply all widths in final pass. Invalidates layout only once because we do not
+          // read any DOM properties.
+          _fnApplyToChildren(function (nToSize, i) {
+            nToSize.style.width = aApplied[i];
+          }, anHeadToSize);
+
+          $(anHeadSizers).height(0);
+
+          /* Same again with the footer if we have one */
+          if (o.nTFoot !== null) {
+            _fnApplyToChildren(zeroOut, anFootSizers);
+
+            _fnApplyToChildren(function (nSizer) {
+              aAppliedFooter.push(_fnStringToCss($(nSizer).width()));
+            }, anFootSizers);
+
+            _fnApplyToChildren(function (nToSize, i) {
+              nToSize.style.width = aAppliedFooter[i];
+            }, anFootToSize);
+
+            $(anFootSizers).height(0);
+          }
+
+          /*
+           * 3. Apply the measurements
+           */
+
+          /* "Hide" the header and footer that we used for the sizing. We want to also fix their width
+           * to what they currently are
+           */
+          _fnApplyToChildren(function (nSizer, i) {
+            nSizer.innerHTML = "";
+            nSizer.style.width = aApplied[i];
+          }, anHeadSizers);
+
+          if (o.nTFoot !== null) {
+            _fnApplyToChildren(function (nSizer, i) {
+              nSizer.innerHTML = "";
+              nSizer.style.width = aAppliedFooter[i];
+            }, anFootSizers);
+          }
+
+          /* Sanity check that the table is of a sensible width. If not then we are going to get
+           * misalignment - try to prevent this by not allowing the table to shrink below its min width
+           */
+          if ($(o.nTable).outerWidth() < iSanityWidth) {
+            /* The min width depends upon if we have a vertical scrollbar visible or not */
+            var iCorrection = ((nScrollBody.scrollHeight > nScrollBody.offsetHeight ||
+              $(nScrollBody).css('overflow-y') == "scroll")) ?
+              iSanityWidth + o.oScroll.iBarWidth : iSanityWidth;
+
+            /* IE6/7 are a law unto themselves... */
+            if (ie67 && (nScrollBody.scrollHeight >
+              nScrollBody.offsetHeight || $(nScrollBody).css('overflow-y') == "scroll")) {
+              o.nTable.style.width = _fnStringToCss(iCorrection - o.oScroll.iBarWidth);
+            }
+
+            /* Apply the calculated minimum width to the table wrappers */
+            nScrollBody.style.width = _fnStringToCss(iCorrection);
+            o.nScrollHead.style.width = _fnStringToCss(iCorrection);
+
+            if (o.nTFoot !== null) {
+              o.nScrollFoot.style.width = _fnStringToCss(iCorrection);
+            }
+
+            /* And give the user a warning that we've stopped the table getting too small */
+            if (o.oScroll.sX === "") {
+              _fnLog(o, 1, "The table cannot fit into the current element which will cause column" +
+                " misalignment. The table has been drawn at its minimum possible width.");
+            }
+            else if (o.oScroll.sXInner !== "") {
+              _fnLog(o, 1, "The table cannot fit into the current element which will cause column" +
+                " misalignment. Increase the sScrollXInner value or remove it to allow automatic" +
+                " calculation");
+            }
+          }
+          else {
+            nScrollBody.style.width = _fnStringToCss('100%');
+            o.nScrollHead.style.width = _fnStringToCss('100%');
+
+            if (o.nTFoot !== null) {
+              o.nScrollFoot.style.width = _fnStringToCss('100%');
+            }
+          }
+
+
+          /*
+           * 4. Clean up
+           */
+          if (o.oScroll.sY === "") {
+            /* IE7< puts a vertical scrollbar in place (when it shouldn't be) due to subtracting
+             * the scrollbar height from the visible display, rather than adding it on. We need to
+             * set the height in order to sort this. Don't want to do it in any other browsers.
+             */
+            if (ie67) {
+              nScrollBody.style.height = _fnStringToCss(o.nTable.offsetHeight + o.oScroll.iBarWidth);
+            }
+          }
+
+          if (o.oScroll.sY !== "" && o.oScroll.bCollapse) {
+            nScrollBody.style.height = _fnStringToCss(o.oScroll.sY);
+
+            var iExtra = (o.oScroll.sX !== "" && o.nTable.offsetWidth > nScrollBody.offsetWidth) ?
+              o.oScroll.iBarWidth : 0;
+            if (o.nTable.offsetHeight < nScrollBody.offsetHeight) {
+              nScrollBody.style.height = _fnStringToCss(o.nTable.offsetHeight + iExtra);
+            }
+          }
+
+          /* Finally set the width's of the header and footer tables */
+          var iOuterWidth = $(o.nTable).outerWidth();
+          nScrollHeadTable.style.width = _fnStringToCss(iOuterWidth);
+          nScrollHeadInner.style.width = _fnStringToCss(iOuterWidth);
+
+          // Figure out if there are scrollbar present - if so then we need a the header and footer to
+          // provide a bit more space to allow "overflow" scrolling (i.e. past the scrollbar)
+          var bScrolling = $(o.nTable).height() > nScrollBody.clientHeight || $(nScrollBody).css('overflow-y') == "scroll";
+          nScrollHeadInner.style.paddingRight = bScrolling ? o.oScroll.iBarWidth + "px" : "0px";
+
+          if (o.nTFoot !== null) {
+            nScrollFootTable.style.width = _fnStringToCss(iOuterWidth);
+            nScrollFootInner.style.width = _fnStringToCss(iOuterWidth);
+            nScrollFootInner.style.paddingRight = bScrolling ? o.oScroll.iBarWidth + "px" : "0px";
+          }
+
+          /* Adjust the position of the header in case we loose the y-scrollbar */
+          $(nScrollBody).scroll();
+
+          /* If sorting or filtering has occurred, jump the scrolling back to the top */
+          if (o.bSorted || o.bFiltered) {
+            nScrollBody.scrollTop = 0;
+          }
+        }
+
+
+        /**
+         * Apply a given function to the display child nodes of an element array (typically
+         * TD children of TR rows
+         *  @param {function} fn Method to apply to the objects
+         *  @param array {nodes} an1 List of elements to look through for display children
+         *  @param array {nodes} an2 Another list (identical structure to the first) - optional
+         *  @memberof DataTable#oApi
+         */
+        function _fnApplyToChildren(fn, an1, an2) {
+          var index = 0, i = 0, iLen = an1.length;
+          var nNode1, nNode2;
+
+          while (i < iLen) {
+            nNode1 = an1[i].firstChild;
+            nNode2 = an2 ? an2[i].firstChild : null;
+            while (nNode1) {
+              if (nNode1.nodeType === 1) {
+                if (an2) {
+                  fn(nNode1, nNode2, index);
+                }
+                else {
+                  fn(nNode1, index);
+                }
+                index++;
+              }
+              nNode1 = nNode1.nextSibling;
+              nNode2 = an2 ? nNode2.nextSibling : null;
+            }
+            i++;
+          }
+        }
+
+        /**
+         * Convert a CSS unit width to pixels (e.g. 2em)
+         *  @param {string} sWidth width to be converted
+         *  @param {node} nParent parent to get the with for (required for relative widths) - optional
+         *  @returns {int} iWidth width in pixels
+         *  @memberof DataTable#oApi
+         */
+        function _fnConvertToWidth(sWidth, nParent) {
+          if (!sWidth || sWidth === null || sWidth === '') {
+            return 0;
+          }
+
+          if (!nParent) {
+            nParent = document.body;
+          }
+
+          var iWidth;
+          var nTmp = document.createElement("div");
+          nTmp.style.width = _fnStringToCss(sWidth);
+
+          nParent.appendChild(nTmp);
+          iWidth = nTmp.offsetWidth;
+          nParent.removeChild(nTmp);
+
+          return ( iWidth );
+        }
+
+
+        /**
+         * Calculate the width of columns for the table
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnCalculateColumnWidths(oSettings) {
+          var iTableWidth = oSettings.nTable.offsetWidth;
+          var iUserInputs = 0;
+          var iTmpWidth;
+          var iVisibleColumns = 0;
+          var iColums = oSettings.aoColumns.length;
+          var i, iIndex, iCorrector, iWidth;
+          var oHeaders = $('th', oSettings.nTHead);
+          var widthAttr = oSettings.nTable.getAttribute('width');
+          var nWrapper = oSettings.nTable.parentNode;
+
+          /* Convert any user input sizes into pixel sizes */
+          for (i = 0; i < iColums; i++) {
+            if (oSettings.aoColumns[i].bVisible) {
+              iVisibleColumns++;
+
+              if (oSettings.aoColumns[i].sWidth !== null) {
+                iTmpWidth = _fnConvertToWidth(oSettings.aoColumns[i].sWidthOrig,
+                  nWrapper);
+                if (iTmpWidth !== null) {
+                  oSettings.aoColumns[i].sWidth = _fnStringToCss(iTmpWidth);
+                }
+
+                iUserInputs++;
+              }
+            }
+          }
+
+          /* If the number of columns in the DOM equals the number that we have to process in 
+           * DataTables, then we can use the offsets that are created by the web-browser. No custom 
+           * sizes can be set in order for this to happen, nor scrolling used
+           */
+          if (iColums == oHeaders.length && iUserInputs === 0 && iVisibleColumns == iColums &&
+            oSettings.oScroll.sX === "" && oSettings.oScroll.sY === "") {
+            for (i = 0; i < oSettings.aoColumns.length; i++) {
+              iTmpWidth = $(oHeaders[i]).width();
+              if (iTmpWidth !== null) {
+                oSettings.aoColumns[i].sWidth = _fnStringToCss(iTmpWidth);
+              }
+            }
+          }
+          else {
+            /* Otherwise we are going to have to do some calculations to get the width of each column.
+             * Construct a 1 row table with the widest node in the data, and any user defined widths,
+             * then insert it into the DOM and allow the browser to do all the hard work of
+             * calculating table widths.
+             */
+            var
+              nCalcTmp = oSettings.nTable.cloneNode(false),
+              nTheadClone = oSettings.nTHead.cloneNode(true),
+              nBody = document.createElement('tbody'),
+              nTr = document.createElement('tr'),
+              nDivSizing;
+
+            nCalcTmp.removeAttribute("id");
+            nCalcTmp.appendChild(nTheadClone);
+            if (oSettings.nTFoot !== null) {
+              nCalcTmp.appendChild(oSettings.nTFoot.cloneNode(true));
+              _fnApplyToChildren(function (n) {
+                n.style.width = "";
+              }, nCalcTmp.getElementsByTagName('tr'));
+            }
+
+            nCalcTmp.appendChild(nBody);
+            nBody.appendChild(nTr);
+
+            /* Remove any sizing that was previously applied by the styles */
+            var jqColSizing = $('thead th', nCalcTmp);
+            if (jqColSizing.length === 0) {
+              jqColSizing = $('tbody tr:eq(0)>td', nCalcTmp);
+            }
+
+            /* Apply custom sizing to the cloned header */
+            var nThs = _fnGetUniqueThs(oSettings, nTheadClone);
+            iCorrector = 0;
+            for (i = 0; i < iColums; i++) {
+              var oColumn = oSettings.aoColumns[i];
+              if (oColumn.bVisible && oColumn.sWidthOrig !== null && oColumn.sWidthOrig !== "") {
+                nThs[i - iCorrector].style.width = _fnStringToCss(oColumn.sWidthOrig);
+              }
+              else if (oColumn.bVisible) {
+                nThs[i - iCorrector].style.width = "";
+              }
+              else {
+                iCorrector++;
+              }
+            }
+
+            /* Find the biggest td for each column and put it into the table */
+            for (i = 0; i < iColums; i++) {
+              if (oSettings.aoColumns[i].bVisible) {
+                var nTd = _fnGetWidestNode(oSettings, i);
+                if (nTd !== null) {
+                  nTd = nTd.cloneNode(true);
+                  if (oSettings.aoColumns[i].sContentPadding !== "") {
+                    nTd.innerHTML += oSettings.aoColumns[i].sContentPadding;
+                  }
+                  nTr.appendChild(nTd);
+                }
+              }
+            }
+
+            /* Build the table and 'display' it */
+            nWrapper.appendChild(nCalcTmp);
+
+            /* When scrolling (X or Y) we want to set the width of the table as appropriate. However,
+             * when not scrolling leave the table width as it is. This results in slightly different,
+             * but I think correct behaviour
+             */
+            if (oSettings.oScroll.sX !== "" && oSettings.oScroll.sXInner !== "") {
+              nCalcTmp.style.width = _fnStringToCss(oSettings.oScroll.sXInner);
+            }
+            else if (oSettings.oScroll.sX !== "") {
+              nCalcTmp.style.width = "";
+              if ($(nCalcTmp).width() < nWrapper.offsetWidth) {
+                nCalcTmp.style.width = _fnStringToCss(nWrapper.offsetWidth);
+              }
+            }
+            else if (oSettings.oScroll.sY !== "") {
+              nCalcTmp.style.width = _fnStringToCss(nWrapper.offsetWidth);
+            }
+            else if (widthAttr) {
+              nCalcTmp.style.width = _fnStringToCss(widthAttr);
+            }
+            nCalcTmp.style.visibility = "hidden";
+
+            /* Scrolling considerations */
+            _fnScrollingWidthAdjust(oSettings, nCalcTmp);
+
+            /* Read the width's calculated by the browser and store them for use by the caller. We
+             * first of all try to use the elements in the body, but it is possible that there are
+             * no elements there, under which circumstances we use the header elements
+             */
+            var oNodes = $("tbody tr:eq(0)", nCalcTmp).children();
+            if (oNodes.length === 0) {
+              oNodes = _fnGetUniqueThs(oSettings, $('thead', nCalcTmp)[0]);
+            }
+
+            /* Browsers need a bit of a hand when a width is assigned to any columns when 
+             * x-scrolling as they tend to collapse the table to the min-width, even if
+             * we sent the column widths. So we need to keep track of what the table width
+             * should be by summing the user given values, and the automatic values
+             */
+            if (oSettings.oScroll.sX !== "") {
+              var iTotal = 0;
+              iCorrector = 0;
+              for (i = 0; i < oSettings.aoColumns.length; i++) {
+                if (oSettings.aoColumns[i].bVisible) {
+                  if (oSettings.aoColumns[i].sWidthOrig === null) {
+                    iTotal += $(oNodes[iCorrector]).outerWidth();
+                  }
+                  else {
+                    iTotal += parseInt(oSettings.aoColumns[i].sWidth.replace('px', ''), 10) +
+                      ($(oNodes[iCorrector]).outerWidth() - $(oNodes[iCorrector]).width());
+                  }
+                  iCorrector++;
+                }
+              }
+
+              nCalcTmp.style.width = _fnStringToCss(iTotal);
+              oSettings.nTable.style.width = _fnStringToCss(iTotal);
+            }
+
+            iCorrector = 0;
+            for (i = 0; i < oSettings.aoColumns.length; i++) {
+              if (oSettings.aoColumns[i].bVisible) {
+                iWidth = $(oNodes[iCorrector]).width();
+                if (iWidth !== null && iWidth > 0) {
+                  oSettings.aoColumns[i].sWidth = _fnStringToCss(iWidth);
+                }
+                iCorrector++;
+              }
+            }
+
+            var cssWidth = $(nCalcTmp).css('width');
+            oSettings.nTable.style.width = (cssWidth.indexOf('%') !== -1) ?
+              cssWidth : _fnStringToCss($(nCalcTmp).outerWidth());
+            nCalcTmp.parentNode.removeChild(nCalcTmp);
+          }
+
+          if (widthAttr) {
+            oSettings.nTable.style.width = _fnStringToCss(widthAttr);
+          }
+        }
+
+
+        /**
+         * Adjust a table's width to take account of scrolling
+         *  @param {object} oSettings dataTables settings object
+         *  @param {node} n table node
+         *  @memberof DataTable#oApi
+         */
+        function _fnScrollingWidthAdjust(oSettings, n) {
+          if (oSettings.oScroll.sX === "" && oSettings.oScroll.sY !== "") {
+            /* When y-scrolling only, we want to remove the width of the scroll bar so the table
+             * + scroll bar will fit into the area avaialble.
+             */
+            var iOrigWidth = $(n).width();
+            n.style.width = _fnStringToCss($(n).outerWidth() - oSettings.oScroll.iBarWidth);
+          }
+          else if (oSettings.oScroll.sX !== "") {
+            /* When x-scrolling both ways, fix the table at it's current size, without adjusting */
+            n.style.width = _fnStringToCss($(n).outerWidth());
+          }
+        }
+
+
+        /**
+         * Get the widest node
+         *  @param {object} oSettings dataTables settings object
+         *  @param {int} iCol column of interest
+         *  @returns {node} widest table node
+         *  @memberof DataTable#oApi
+         */
+        function _fnGetWidestNode(oSettings, iCol) {
+          var iMaxIndex = _fnGetMaxLenString(oSettings, iCol);
+          if (iMaxIndex < 0) {
+            return null;
+          }
+
+          if (oSettings.aoData[iMaxIndex].nTr === null) {
+            var n = document.createElement('td');
+            n.innerHTML = _fnGetCellData(oSettings, iMaxIndex, iCol, '');
+            return n;
+          }
+          return _fnGetTdNodes(oSettings, iMaxIndex)[iCol];
+        }
+
+
+        /**
+         * Get the maximum strlen for each data column
+         *  @param {object} oSettings dataTables settings object
+         *  @param {int} iCol column of interest
+         *  @returns {string} max string length for each column
+         *  @memberof DataTable#oApi
+         */
+        function _fnGetMaxLenString(oSettings, iCol) {
+          var iMax = -1;
+          var iMaxIndex = -1;
+
+          for (var i = 0; i < oSettings.aoData.length; i++) {
+            var s = _fnGetCellData(oSettings, i, iCol, 'display') + "";
+            s = s.replace(/<.*?>/g, "");
+            if (s.length > iMax) {
+              iMax = s.length;
+              iMaxIndex = i;
+            }
+          }
+
+          return iMaxIndex;
+        }
+
+
+        /**
+         * Append a CSS unit (only if required) to a string
+         *  @param {array} aArray1 first array
+         *  @param {array} aArray2 second array
+         *  @returns {int} 0 if match, 1 if length is different, 2 if no match
+         *  @memberof DataTable#oApi
+         */
+        function _fnStringToCss(s) {
+          if (s === null) {
+            return "0px";
+          }
+
+          if (typeof s == 'number') {
+            if (s < 0) {
+              return "0px";
+            }
+            return s + "px";
+          }
+
+          /* Check if the last character is not 0-9 */
+          var c = s.charCodeAt(s.length - 1);
+          if (c < 0x30 || c > 0x39) {
+            return s;
+          }
+          return s + "px";
+        }
+
+
+        /**
+         * Get the width of a scroll bar in this browser being used
+         *  @returns {int} width in pixels
+         *  @memberof DataTable#oApi
+         */
+        function _fnScrollBarWidth() {
+          var inner = document.createElement('p');
+          var style = inner.style;
+          style.width = "100%";
+          style.height = "200px";
+          style.padding = "0px";
+
+          var outer = document.createElement('div');
+          style = outer.style;
+          style.position = "absolute";
+          style.top = "0px";
+          style.left = "0px";
+          style.visibility = "hidden";
+          style.width = "200px";
+          style.height = "150px";
+          style.padding = "0px";
+          style.overflow = "hidden";
+          outer.appendChild(inner);
+
+          document.body.appendChild(outer);
+          var w1 = inner.offsetWidth;
+          outer.style.overflow = 'scroll';
+          var w2 = inner.offsetWidth;
+          if (w1 == w2) {
+            w2 = outer.clientWidth;
+          }
+
+          document.body.removeChild(outer);
+          return (w1 - w2);
+        }
+
+        /**
+         * Change the order of the table
+         *  @param {object} oSettings dataTables settings object
+         *  @param {bool} bApplyClasses optional - should we apply classes or not
+         *  @memberof DataTable#oApi
+         */
+        function _fnSort(oSettings, bApplyClasses) {
+          var
+            i, iLen, j, jLen, k, kLen,
+            sDataType, nTh,
+            aaSort = [],
+            aiOrig = [],
+            oSort = DataTable.ext.oSort,
+            aoData = oSettings.aoData,
+            aoColumns = oSettings.aoColumns,
+            oAria = oSettings.oLanguage.oAria;
+
+          /* No sorting required if server-side or no sorting array */
+          if (!oSettings.oFeatures.bServerSide &&
+            (oSettings.aaSorting.length !== 0 || oSettings.aaSortingFixed !== null)) {
+            aaSort = ( oSettings.aaSortingFixed !== null ) ?
+              oSettings.aaSortingFixed.concat(oSettings.aaSorting) :
+              oSettings.aaSorting.slice();
+
+            /* If there is a sorting data type, and a function belonging to it, then we need to
+             * get the data from the developer's function and apply it for this column
+             */
+            for (i = 0; i < aaSort.length; i++) {
+              var iColumn = aaSort[i][0];
+              var iVisColumn = _fnColumnIndexToVisible(oSettings, iColumn);
+              sDataType = oSettings.aoColumns[ iColumn ].sSortDataType;
+              if (DataTable.ext.afnSortData[sDataType]) {
+                var aData = DataTable.ext.afnSortData[sDataType].call(
+                  oSettings.oInstance, oSettings, iColumn, iVisColumn
+                );
+                if (aData.length === aoData.length) {
+                  for (j = 0, jLen = aoData.length; j < jLen; j++) {
+                    _fnSetCellData(oSettings, j, iColumn, aData[j]);
+                  }
+                }
+                else {
+                  _fnLog(oSettings, 0, "Returned data sort array (col " + iColumn + ") is the wrong length");
+                }
+              }
+            }
+
+            /* Create a value - key array of the current row positions such that we can use their
+             * current position during the sort, if values match, in order to perform stable sorting
+             */
+            for (i = 0, iLen = oSettings.aiDisplayMaster.length; i < iLen; i++) {
+              aiOrig[ oSettings.aiDisplayMaster[i] ] = i;
+            }
+
+            /* Build an internal data array which is specific to the sort, so we can get and prep
+             * the data to be sorted only once, rather than needing to do it every time the sorting
+             * function runs. This make the sorting function a very simple comparison
+             */
+            var iSortLen = aaSort.length;
+            var fnSortFormat, aDataSort;
+            for (i = 0, iLen = aoData.length; i < iLen; i++) {
+              for (j = 0; j < iSortLen; j++) {
+                aDataSort = aoColumns[ aaSort[j][0] ].aDataSort;
+
+                for (k = 0, kLen = aDataSort.length; k < kLen; k++) {
+                  sDataType = aoColumns[ aDataSort[k] ].sType;
+                  fnSortFormat = oSort[ (sDataType ? sDataType : 'string') + "-pre" ];
+
+                  aoData[i]._aSortData[ aDataSort[k] ] = fnSortFormat ?
+                    fnSortFormat(_fnGetCellData(oSettings, i, aDataSort[k], 'sort')) :
+                    _fnGetCellData(oSettings, i, aDataSort[k], 'sort');
+                }
+              }
+            }
+
+            /* Do the sort - here we want multi-column sorting based on a given data source (column)
+             * and sorting function (from oSort) in a certain direction. It's reasonably complex to
+             * follow on it's own, but this is what we want (example two column sorting):
+             *  fnLocalSorting = function(a,b){
+             *  	var iTest;
+             *  	iTest = oSort['string-asc']('data11', 'data12');
+             *  	if (iTest !== 0)
+             *  		return iTest;
+             *    iTest = oSort['numeric-desc']('data21', 'data22');
+             *    if (iTest !== 0)
+             *  		return iTest;
+             *  	return oSort['numeric-asc']( aiOrig[a], aiOrig[b] );
+             *  }
+             * Basically we have a test for each sorting column, if the data in that column is equal,
+             * test the next column. If all columns match, then we use a numeric sort on the row 
+             * positions in the original data array to provide a stable sort.
+             */
+            oSettings.aiDisplayMaster.sort(function (a, b) {
+              var k, l, lLen, iTest, aDataSort, sDataType;
+              for (k = 0; k < iSortLen; k++) {
+                aDataSort = aoColumns[ aaSort[k][0] ].aDataSort;
+
+                for (l = 0, lLen = aDataSort.length; l < lLen; l++) {
+                  sDataType = aoColumns[ aDataSort[l] ].sType;
+
+                  iTest = oSort[ (sDataType ? sDataType : 'string') + "-" + aaSort[k][1] ](
+                    aoData[a]._aSortData[ aDataSort[l] ],
+                    aoData[b]._aSortData[ aDataSort[l] ]
+                  );
+
+                  if (iTest !== 0) {
+                    return iTest;
+                  }
+                }
+              }
+
+              return oSort['numeric-asc'](aiOrig[a], aiOrig[b]);
+            });
+          }
+
+          /* Alter the sorting classes to take account of the changes */
+          if ((bApplyClasses === undefined || bApplyClasses) && !oSettings.oFeatures.bDeferRender) {
+            _fnSortingClasses(oSettings);
+          }
+
+          for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {
+            var sTitle = aoColumns[i].sTitle.replace(/<.*?>/g, "");
+            nTh = aoColumns[i].nTh;
+            nTh.removeAttribute('aria-sort');
+            nTh.removeAttribute('aria-label');
+
+            /* In ARIA only the first sorting column can be marked as sorting - no multi-sort option */
+            if (aoColumns[i].bSortable) {
+              if (aaSort.length > 0 && aaSort[0][0] == i) {
+                nTh.setAttribute('aria-sort', aaSort[0][1] == "asc" ? "ascending" : "descending");
+
+                var nextSort = (aoColumns[i].asSorting[ aaSort[0][2] + 1 ]) ?
+                  aoColumns[i].asSorting[ aaSort[0][2] + 1 ] : aoColumns[i].asSorting[0];
+                nTh.setAttribute('aria-label', sTitle +
+                  (nextSort == "asc" ? oAria.sSortAscending : oAria.sSortDescending));
+              }
+              else {
+                nTh.setAttribute('aria-label', sTitle +
+                  (aoColumns[i].asSorting[0] == "asc" ? oAria.sSortAscending : oAria.sSortDescending));
+              }
+            }
+            else {
+              nTh.setAttribute('aria-label', sTitle);
+            }
+          }
+
+          /* Tell the draw function that we have sorted the data */
+          oSettings.bSorted = true;
+          $(oSettings.oInstance).trigger('sort', oSettings);
+
+          /* Copy the master data into the draw array and re-draw */
+          if (oSettings.oFeatures.bFilter) {
+            /* _fnFilter() will redraw the table for us */
+            _fnFilterComplete(oSettings, oSettings.oPreviousSearch, 1);
+          }
+          else {
+            oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
+            oSettings._iDisplayStart = 0;
+            /* reset display back to page 0 */
+            _fnCalculateEnd(oSettings);
+            _fnDraw(oSettings);
+          }
+        }
+
+
+        /**
+         * Attach a sort handler (click) to a node
+         *  @param {object} oSettings dataTables settings object
+         *  @param {node} nNode node to attach the handler to
+         *  @param {int} iDataIndex column sorting index
+         *  @param {function} [fnCallback] callback function
+         *  @memberof DataTable#oApi
+         */
+        function _fnSortAttachListener(oSettings, nNode, iDataIndex, fnCallback) {
+          _fnBindAction(nNode, {}, function (e) {
+            /* If the column is not sortable - don't to anything */
+            if (oSettings.aoColumns[iDataIndex].bSortable === false) {
+              return;
+            }
+
+            /*
+             * This is a little bit odd I admit... I declare a temporary function inside the scope of
+             * _fnBuildHead and the click handler in order that the code presented here can be used 
+             * twice - once for when bProcessing is enabled, and another time for when it is 
+             * disabled, as we need to perform slightly different actions.
+             *   Basically the issue here is that the Javascript engine in modern browsers don't 
+             * appear to allow the rendering engine to update the display while it is still executing
+             * it's thread (well - it does but only after long intervals). This means that the 
+             * 'processing' display doesn't appear for a table sort. To break the js thread up a bit
+             * I force an execution break by using setTimeout - but this breaks the expected 
+             * thread continuation for the end-developer's point of view (their code would execute
+             * too early), so we only do it when we absolutely have to.
+             */
+            var fnInnerSorting = function () {
+              var iColumn, iNextSort;
+
+              /* If the shift key is pressed then we are multiple column sorting */
+              if (e.shiftKey) {
+                /* Are we already doing some kind of sort on this column? */
+                var bFound = false;
+                for (var i = 0; i < oSettings.aaSorting.length; i++) {
+                  if (oSettings.aaSorting[i][0] == iDataIndex) {
+                    bFound = true;
+                    iColumn = oSettings.aaSorting[i][0];
+                    iNextSort = oSettings.aaSorting[i][2] + 1;
+
+                    if (!oSettings.aoColumns[iColumn].asSorting[iNextSort]) {
+                      /* Reached the end of the sorting options, remove from multi-col sort */
+                      oSettings.aaSorting.splice(i, 1);
+                    }
+                    else {
+                      /* Move onto next sorting direction */
+                      oSettings.aaSorting[i][1] = oSettings.aoColumns[iColumn].asSorting[iNextSort];
+                      oSettings.aaSorting[i][2] = iNextSort;
+                    }
+                    break;
+                  }
+                }
+
+                /* No sort yet - add it in */
+                if (bFound === false) {
+                  oSettings.aaSorting.push([ iDataIndex,
+                    oSettings.aoColumns[iDataIndex].asSorting[0], 0 ]);
+                }
+              }
+              else {
+                /* If no shift key then single column sort */
+                if (oSettings.aaSorting.length == 1 && oSettings.aaSorting[0][0] == iDataIndex) {
+                  iColumn = oSettings.aaSorting[0][0];
+                  iNextSort = oSettings.aaSorting[0][2] + 1;
+                  if (!oSettings.aoColumns[iColumn].asSorting[iNextSort]) {
+                    iNextSort = 0;
+                  }
+                  oSettings.aaSorting[0][1] = oSettings.aoColumns[iColumn].asSorting[iNextSort];
+                  oSettings.aaSorting[0][2] = iNextSort;
+                }
+                else {
+                  oSettings.aaSorting.splice(0, oSettings.aaSorting.length);
+                  oSettings.aaSorting.push([ iDataIndex,
+                    oSettings.aoColumns[iDataIndex].asSorting[0], 0 ]);
+                }
+              }
+
+              /* Run the sort */
+              _fnSort(oSettings);
+            };
+            /* /fnInnerSorting */
+
+            if (!oSettings.oFeatures.bProcessing) {
+              fnInnerSorting();
+            }
+            else {
+              _fnProcessingDisplay(oSettings, true);
+              setTimeout(function () {
+                fnInnerSorting();
+                if (!oSettings.oFeatures.bServerSide) {
+                  _fnProcessingDisplay(oSettings, false);
+                }
+              }, 0);
+            }
+
+            /* Call the user specified callback function - used for async user interaction */
+            if (typeof fnCallback == 'function') {
+              fnCallback(oSettings);
+            }
+          });
+        }
+
+
+        /**
+         * Set the sorting classes on the header, Note: it is safe to call this function
+         * when bSort and bSortClasses are false
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnSortingClasses(oSettings) {
+          var i, iLen, j, jLen, iFound;
+          var aaSort, sClass;
+          var iColumns = oSettings.aoColumns.length;
+          var oClasses = oSettings.oClasses;
+
+          for (i = 0; i < iColumns; i++) {
+            if (oSettings.aoColumns[i].bSortable) {
+              $(oSettings.aoColumns[i].nTh).removeClass(oClasses.sSortAsc + " " + oClasses.sSortDesc +
+                " " + oSettings.aoColumns[i].sSortingClass);
+            }
+          }
+
+          if (oSettings.aaSortingFixed !== null) {
+            aaSort = oSettings.aaSortingFixed.concat(oSettings.aaSorting);
+          }
+          else {
+            aaSort = oSettings.aaSorting.slice();
+          }
+
+          /* Apply the required classes to the header */
+          for (i = 0; i < oSettings.aoColumns.length; i++) {
+            if (oSettings.aoColumns[i].bSortable) {
+              sClass = oSettings.aoColumns[i].sSortingClass;
+              iFound = -1;
+              for (j = 0; j < aaSort.length; j++) {
+                if (aaSort[j][0] == i) {
+                  sClass = ( aaSort[j][1] == "asc" ) ?
+                    oClasses.sSortAsc : oClasses.sSortDesc;
+                  iFound = j;
+                  break;
+                }
+              }
+              $(oSettings.aoColumns[i].nTh).addClass(sClass);
+
+              if (oSettings.bJUI) {
+                /* jQuery UI uses extra markup */
+                var jqSpan = $("span." + oClasses.sSortIcon, oSettings.aoColumns[i].nTh);
+                jqSpan.removeClass(oClasses.sSortJUIAsc + " " + oClasses.sSortJUIDesc + " " +
+                  oClasses.sSortJUI + " " + oClasses.sSortJUIAscAllowed + " " + oClasses.sSortJUIDescAllowed);
+
+                var sSpanClass;
+                if (iFound == -1) {
+                  sSpanClass = oSettings.aoColumns[i].sSortingClassJUI;
+                }
+                else if (aaSort[iFound][1] == "asc") {
+                  sSpanClass = oClasses.sSortJUIAsc;
+                }
+                else {
+                  sSpanClass = oClasses.sSortJUIDesc;
+                }
+
+                jqSpan.addClass(sSpanClass);
+              }
+            }
+            else {
+              /* No sorting on this column, so add the base class. This will have been assigned by
+               * _fnAddColumn
+               */
+              $(oSettings.aoColumns[i].nTh).addClass(oSettings.aoColumns[i].sSortingClass);
+            }
+          }
+
+          /* 
+           * Apply the required classes to the table body
+           * Note that this is given as a feature switch since it can significantly slow down a sort
+           * on large data sets (adding and removing of classes is always slow at the best of times..)
+           * Further to this, note that this code is admittedly fairly ugly. It could be made a lot 
+           * simpler using jQuery selectors and add/removeClass, but that is significantly slower
+           * (on the order of 5 times slower) - hence the direct DOM manipulation here.
+           * Note that for deferred drawing we do use jQuery - the reason being that taking the first
+           * row found to see if the whole column needs processed can miss classes since the first
+           * column might be new.
+           */
+          sClass = oClasses.sSortColumn;
+
+          if (oSettings.oFeatures.bSort && oSettings.oFeatures.bSortClasses) {
+            var nTds = _fnGetTdNodes(oSettings);
+
+            /* Determine what the sorting class for each column should be */
+            var iClass, iTargetCol;
+            var asClasses = [];
+            for (i = 0; i < iColumns; i++) {
+              asClasses.push("");
+            }
+            for (i = 0, iClass = 1; i < aaSort.length; i++) {
+              iTargetCol = parseInt(aaSort[i][0], 10);
+              asClasses[iTargetCol] = sClass + iClass;
+
+              if (iClass < 3) {
+                iClass++;
+              }
+            }
+
+            /* Make changes to the classes for each cell as needed */
+            var reClass = new RegExp(sClass + "[123]");
+            var sTmpClass, sCurrentClass, sNewClass;
+            for (i = 0, iLen = nTds.length; i < iLen; i++) {
+              /* Determine which column we're looking at */
+              iTargetCol = i % iColumns;
+
+              /* What is the full list of classes now */
+              sCurrentClass = nTds[i].className;
+              /* What sorting class should be applied? */
+              sNewClass = asClasses[iTargetCol];
+              /* What would the new full list be if we did a replacement? */
+              sTmpClass = sCurrentClass.replace(reClass, sNewClass);
+
+              if (sTmpClass != sCurrentClass) {
+                /* We changed something */
+                nTds[i].className = $.trim(sTmpClass);
+              }
+              else if (sNewClass.length > 0 && sCurrentClass.indexOf(sNewClass) == -1) {
+                /* We need to add a class */
+                nTds[i].className = sCurrentClass + " " + sNewClass;
+              }
+            }
+          }
+        }
+
+
+        /**
+         * Save the state of a table in a cookie such that the page can be reloaded
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnSaveState(oSettings) {
+          if (!oSettings.oFeatures.bStateSave || oSettings.bDestroying) {
+            return;
+          }
+
+          /* Store the interesting variables */
+          var i, iLen, bInfinite = oSettings.oScroll.bInfinite;
+          var oState = {
+            "iCreate":new Date().getTime(),
+            "iStart":(bInfinite ? 0 : oSettings._iDisplayStart),
+            "iEnd":(bInfinite ? oSettings._iDisplayLength : oSettings._iDisplayEnd),
+            "iLength":oSettings._iDisplayLength,
+            "aaSorting":$.extend(true, [], oSettings.aaSorting),
+            "oSearch":$.extend(true, {}, oSettings.oPreviousSearch),
+            "aoSearchCols":$.extend(true, [], oSettings.aoPreSearchCols),
+            "abVisCols":[]
+          };
+
+          for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {
+            oState.abVisCols.push(oSettings.aoColumns[i].bVisible);
+          }
+
+          _fnCallbackFire(oSettings, "aoStateSaveParams", 'stateSaveParams', [oSettings, oState]);
+
+          oSettings.fnStateSave.call(oSettings.oInstance, oSettings, oState);
+        }
+
+
+        /**
+         * Attempt to load a saved table state from a cookie
+         *  @param {object} oSettings dataTables settings object
+         *  @param {object} oInit DataTables init object so we can override settings
+         *  @memberof DataTable#oApi
+         */
+        function _fnLoadState(oSettings, oInit) {
+          if (!oSettings.oFeatures.bStateSave) {
+            return;
+          }
+
+          var oData = oSettings.fnStateLoad.call(oSettings.oInstance, oSettings);
+          if (!oData) {
+            return;
+          }
+
+          /* Allow custom and plug-in manipulation functions to alter the saved data set and
+           * cancelling of loading by returning false
+           */
+          var abStateLoad = _fnCallbackFire(oSettings, 'aoStateLoadParams', 'stateLoadParams', [oSettings, oData]);
+          if ($.inArray(false, abStateLoad) !== -1) {
+            return;
+          }
+
+          /* Store the saved state so it might be accessed at any time */
+          oSettings.oLoadedState = $.extend(true, {}, oData);
+
+          /* Restore key features */
+          oSettings._iDisplayStart = oData.iStart;
+          oSettings.iInitDisplayStart = oData.iStart;
+          oSettings._iDisplayEnd = oData.iEnd;
+          oSettings._iDisplayLength = oData.iLength;
+          oSettings.aaSorting = oData.aaSorting.slice();
+          oSettings.saved_aaSorting = oData.aaSorting.slice();
+
+          /* Search filtering  */
+          $.extend(oSettings.oPreviousSearch, oData.oSearch);
+          $.extend(true, oSettings.aoPreSearchCols, oData.aoSearchCols);
+
+          /* Column visibility state
+           * Pass back visibility settings to the init handler, but to do not here override
+           * the init object that the user might have passed in
+           */
+          oInit.saved_aoColumns = [];
+          for (var i = 0; i < oData.abVisCols.length; i++) {
+            oInit.saved_aoColumns[i] = {};
+            oInit.saved_aoColumns[i].bVisible = oData.abVisCols[i];
+          }
+
+          _fnCallbackFire(oSettings, 'aoStateLoaded', 'stateLoaded', [oSettings, oData]);
+        }
+
+
+        /**
+         * Create a new cookie with a value to store the state of a table
+         *  @param {string} sName name of the cookie to create
+         *  @param {string} sValue the value the cookie should take
+         *  @param {int} iSecs duration of the cookie
+         *  @param {string} sBaseName sName is made up of the base + file name - this is the base
+         *  @param {function} fnCallback User definable function to modify the cookie
+         *  @memberof DataTable#oApi
+         */
+        function _fnCreateCookie(sName, sValue, iSecs, sBaseName, fnCallback) {
+          var date = new Date();
+          date.setTime(date.getTime() + (iSecs * 1000));
+
+          /* 
+           * Shocking but true - it would appear IE has major issues with having the path not having
+           * a trailing slash on it. We need the cookie to be available based on the path, so we
+           * have to append the file name to the cookie name. Appalling. Thanks to vex for adding the
+           * patch to use at least some of the path
+           */
+          var aParts = window.location.pathname.split('/');
+          var sNameFile = sName + '_' + aParts.pop().replace(/[\/:]/g, "").toLowerCase();
+          var sFullCookie, oData;
+
+          if (fnCallback !== null) {
+            oData = (typeof $.parseJSON === 'function') ?
+              $.parseJSON(sValue) : eval('(' + sValue + ')');
+            sFullCookie = fnCallback(sNameFile, oData, date.toGMTString(),
+              aParts.join('/') + "/");
+          }
+          else {
+            sFullCookie = sNameFile + "=" + encodeURIComponent(sValue) +
+              "; expires=" + date.toGMTString() + "; path=" + aParts.join('/') + "/";
+          }
+
+          /* Are we going to go over the cookie limit of 4KiB? If so, try to delete a cookies
+           * belonging to DataTables.
+           */
+          var
+            aCookies = document.cookie.split(';'),
+            iNewCookieLen = sFullCookie.split(';')[0].length,
+            aOldCookies = [];
+
+          if (iNewCookieLen + document.cookie.length + 10 > 4096) /* Magic 10 for padding */
+          {
+            for (var i = 0, iLen = aCookies.length; i < iLen; i++) {
+              if (aCookies[i].indexOf(sBaseName) != -1) {
+                /* It's a DataTables cookie, so eval it and check the time stamp */
+                var aSplitCookie = aCookies[i].split('=');
+                try {
+                  oData = eval('(' + decodeURIComponent(aSplitCookie[1]) + ')');
+
+                  if (oData && oData.iCreate) {
+                    aOldCookies.push({
+                      "name":aSplitCookie[0],
+                      "time":oData.iCreate
+                    });
+                  }
+                }
+                catch (e) {
+                }
+              }
+            }
+
+            // Make sure we delete the oldest ones first
+            aOldCookies.sort(function (a, b) {
+              return b.time - a.time;
+            });
+
+            // Eliminate as many old DataTables cookies as we need to
+            while (iNewCookieLen + document.cookie.length + 10 > 4096) {
+              if (aOldCookies.length === 0) {
+                // Deleted all DT cookies and still not enough space. Can't state save
+                return;
+              }
+
+              var old = aOldCookies.pop();
+              document.cookie = old.name + "=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=" +
+                aParts.join('/') + "/";
+            }
+          }
+
+          document.cookie = sFullCookie;
+        }
+
+
+        /**
+         * Read an old cookie to get a cookie with an old table state
+         *  @param {string} sName name of the cookie to read
+         *  @returns {string} contents of the cookie - or null if no cookie with that name found
+         *  @memberof DataTable#oApi
+         */
+        function _fnReadCookie(sName) {
+          var
+            aParts = window.location.pathname.split('/'),
+            sNameEQ = sName + '_' + aParts[aParts.length - 1].replace(/[\/:]/g, "").toLowerCase() + '=',
+            sCookieContents = document.cookie.split(';');
+
+          for (var i = 0; i < sCookieContents.length; i++) {
+            var c = sCookieContents[i];
+
+            while (c.charAt(0) == ' ') {
+              c = c.substring(1, c.length);
+            }
+
+            if (c.indexOf(sNameEQ) === 0) {
+              return decodeURIComponent(c.substring(sNameEQ.length, c.length));
+            }
+          }
+          return null;
+        }
+
+
+        /**
+         * Return the settings object for a particular table
+         *  @param {node} nTable table we are using as a dataTable
+         *  @returns {object} Settings object - or null if not found
+         *  @memberof DataTable#oApi
+         */
+        function _fnSettingsFromNode(nTable) {
+          for (var i = 0; i < DataTable.settings.length; i++) {
+            if (DataTable.settings[i].nTable === nTable) {
+              return DataTable.settings[i];
+            }
+          }
+
+          return null;
+        }
+
+
+        /**
+         * Return an array with the TR nodes for the table
+         *  @param {object} oSettings dataTables settings object
+         *  @returns {array} TR array
+         *  @memberof DataTable#oApi
+         */
+        function _fnGetTrNodes(oSettings) {
+          var aNodes = [];
+          var aoData = oSettings.aoData;
+          for (var i = 0, iLen = aoData.length; i < iLen; i++) {
+            if (aoData[i].nTr !== null) {
+              aNodes.push(aoData[i].nTr);
+            }
+          }
+          return aNodes;
+        }
+
+
+        /**
+         * Return an flat array with all TD nodes for the table, or row
+         *  @param {object} oSettings dataTables settings object
+         *  @param {int} [iIndividualRow] aoData index to get the nodes for - optional
+         *    if not given then the return array will contain all nodes for the table
+         *  @returns {array} TD array
+         *  @memberof DataTable#oApi
+         */
+        function _fnGetTdNodes(oSettings, iIndividualRow) {
+          var anReturn = [];
+          var iCorrector;
+          var anTds, nTd;
+          var iRow, iRows = oSettings.aoData.length,
+            iColumn, iColumns, oData, sNodeName, iStart = 0, iEnd = iRows;
+
+          /* Allow the collection to be limited to just one row */
+          if (iIndividualRow !== undefined) {
+            iStart = iIndividualRow;
+            iEnd = iIndividualRow + 1;
+          }
+
+          for (iRow = iStart; iRow < iEnd; iRow++) {
+            oData = oSettings.aoData[iRow];
+            if (oData.nTr !== null) {
+              /* get the TD child nodes - taking into account text etc nodes */
+              anTds = [];
+              nTd = oData.nTr.firstChild;
+              while (nTd) {
+                sNodeName = nTd.nodeName.toLowerCase();
+                if (sNodeName == 'td' || sNodeName == 'th') {
+                  anTds.push(nTd);
+                }
+                nTd = nTd.nextSibling;
+              }
+
+              iCorrector = 0;
+              for (iColumn = 0, iColumns = oSettings.aoColumns.length; iColumn < iColumns; iColumn++) {
+                if (oSettings.aoColumns[iColumn].bVisible) {
+                  anReturn.push(anTds[iColumn - iCorrector]);
+                }
+                else {
+                  anReturn.push(oData._anHidden[iColumn]);
+                  iCorrector++;
+                }
+              }
+            }
+          }
+
+          return anReturn;
+        }
+
+
+        /**
+         * Log an error message
+         *  @param {object} oSettings dataTables settings object
+         *  @param {int} iLevel log error messages, or display them to the user
+         *  @param {string} sMesg error message
+         *  @memberof DataTable#oApi
+         */
+        function _fnLog(oSettings, iLevel, sMesg) {
+          var sAlert = (oSettings === null) ?
+            "DataTables warning: " + sMesg :
+            "DataTables warning (table id = '" + oSettings.sTableId + "'): " + sMesg;
+
+          if (iLevel === 0) {
+            if (DataTable.ext.sErrMode == 'alert') {
+              alert(sAlert);
+            }
+            else {
+              throw new Error(sAlert);
+            }
+            return;
+          }
+          else if (window.console && console.log) {
+            console.log(sAlert);
+          }
+        }
+
+
+        /**
+         * See if a property is defined on one object, if so assign it to the other object
+         *  @param {object} oRet target object
+         *  @param {object} oSrc source object
+         *  @param {string} sName property
+         *  @param {string} [sMappedName] name to map too - optional, sName used if not given
+         *  @memberof DataTable#oApi
+         */
+        function _fnMap(oRet, oSrc, sName, sMappedName) {
+          if (sMappedName === undefined) {
+            sMappedName = sName;
+          }
+          if (oSrc[sName] !== undefined) {
+            oRet[sMappedName] = oSrc[sName];
+          }
+        }
+
+
+        /**
+         * Extend objects - very similar to jQuery.extend, but deep copy objects, and shallow
+         * copy arrays. The reason we need to do this, is that we don't want to deep copy array
+         * init values (such as aaSorting) since the dev wouldn't be able to override them, but
+         * we do want to deep copy arrays.
+         *  @param {object} oOut Object to extend
+         *  @param {object} oExtender Object from which the properties will be applied to oOut
+         *  @returns {object} oOut Reference, just for convenience - oOut === the return.
+         *  @memberof DataTable#oApi
+         *  @todo This doesn't take account of arrays inside the deep copied objects.
+         */
+        function _fnExtend(oOut, oExtender) {
+          var val;
+
+          for (var prop in oExtender) {
+            if (oExtender.hasOwnProperty(prop)) {
+              val = oExtender[prop];
+
+              if (typeof oInit[prop] === 'object' && val !== null && $.isArray(val) === false) {
+                $.extend(true, oOut[prop], val);
+              }
+              else {
+                oOut[prop] = val;
+              }
+            }
+          }
+
+          return oOut;
+        }
+
+
+        /**
+         * Bind an event handers to allow a click or return key to activate the callback.
+         * This is good for accessibility since a return on the keyboard will have the
+         * same effect as a click, if the element has focus.
+         *  @param {element} n Element to bind the action to
+         *  @param {object} oData Data object to pass to the triggered function
+         *  @param {function} fn Callback function for when the event is triggered
+         *  @memberof DataTable#oApi
+         */
+        function _fnBindAction(n, oData, fn) {
+          $(n)
+            .bind('click.DT', oData, function (e) {
+              n.blur(); // Remove focus outline for mouse users
+              fn(e);
+            })
+            .bind('keypress.DT', oData, function (e) {
+              if (e.which === 13) {
+                fn(e);
+              }
+            })
+            .bind('selectstart.DT', function () {
+              /* Take the brutal approach to cancelling text selection */
+              return false;
+            });
+        }
+
+
+        /**
+         * Register a callback function. Easily allows a callback function to be added to
+         * an array store of callback functions that can then all be called together.
+         *  @param {object} oSettings dataTables settings object
+         *  @param {string} sStore Name of the array storage for the callbacks in oSettings
+         *  @param {function} fn Function to be called back
+         *  @param {string} sName Identifying name for the callback (i.e. a label)
+         *  @memberof DataTable#oApi
+         */
+        function _fnCallbackReg(oSettings, sStore, fn, sName) {
+          if (fn) {
+            oSettings[sStore].push({
+              "fn":fn,
+              "sName":sName
+            });
+          }
+        }
+
+
+        /**
+         * Fire callback functions and trigger events. Note that the loop over the callback
+         * array store is done backwards! Further note that you do not want to fire off triggers
+         * in time sensitive applications (for example cell creation) as its slow.
+         *  @param {object} oSettings dataTables settings object
+         *  @param {string} sStore Name of the array storage for the callbacks in oSettings
+         *  @param {string} sTrigger Name of the jQuery custom event to trigger. If null no trigger
+         *    is fired
+         *  @param {array} aArgs Array of arguments to pass to the callback function / trigger
+         *  @memberof DataTable#oApi
+         */
+        function _fnCallbackFire(oSettings, sStore, sTrigger, aArgs) {
+          var aoStore = oSettings[sStore];
+          var aRet = [];
+
+          for (var i = aoStore.length - 1; i >= 0; i--) {
+            aRet.push(aoStore[i].fn.apply(oSettings.oInstance, aArgs));
+          }
+
+          if (sTrigger !== null) {
+            $(oSettings.oInstance).trigger(sTrigger, aArgs);
+          }
+
+          return aRet;
+        }
+
+
+        /**
+         * JSON stringify. If JSON.stringify it provided by the browser, json2.js or any other
+         * library, then we use that as it is fast, safe and accurate. If the function isn't
+         * available then we need to built it ourselves - the inspiration for this function comes
+         * from Craig Buckler ( http://www.sitepoint.com/javascript-json-serialization/ ). It is
+         * not perfect and absolutely should not be used as a replacement to json2.js - but it does
+         * do what we need, without requiring a dependency for DataTables.
+         *  @param {object} o JSON object to be converted
+         *  @returns {string} JSON string
+         *  @memberof DataTable#oApi
+         */
+        var _fnJsonString = (window.JSON) ? JSON.stringify : function (o) {
+          /* Not an object or array */
+          var sType = typeof o;
+          if (sType !== "object" || o === null) {
+            // simple data type
+            if (sType === "string") {
+              o = '"' + o + '"';
+            }
+            return o + "";
+          }
+
+          /* If object or array, need to recurse over it */
+          var
+            sProp, mValue,
+            json = [],
+            bArr = $.isArray(o);
+
+          for (sProp in o) {
+            mValue = o[sProp];
+            sType = typeof mValue;
+
+            if (sType === "string") {
+              mValue = '"' + mValue + '"';
+            }
+            else if (sType === "object" && mValue !== null) {
+              mValue = _fnJsonString(mValue);
+            }
+
+            json.push((bArr ? "" : '"' + sProp + '":') + mValue);
+          }
+
+          return (bArr ? "[" : "{") + json + (bArr ? "]" : "}");
+        };
+
+
+        /**
+         * From some browsers (specifically IE6/7) we need special handling to work around browser
+         * bugs - this function is used to detect when these workarounds are needed.
+         *  @param {object} oSettings dataTables settings object
+         *  @memberof DataTable#oApi
+         */
+        function _fnBrowserDetect(oSettings) {
+          /* IE6/7 will oversize a width 100% element inside a scrolling element, to include the
+           * width of the scrollbar, while other browsers ensure the inner element is contained
+           * without forcing scrolling
+           */
+          var n = $(
+            '<div style="position:absolute; top:0; left:0; height:1px; width:1px; overflow:hidden">' +
+              '<div style="position:absolute; top:1px; left:1px; width:100px; overflow:scroll;">' +
+              '<div id="DT_BrowserTest" style="width:100%; height:10px;"></div>' +
+              '</div>' +
+              '</div>')[0];
+
+          document.body.appendChild(n);
+          oSettings.oBrowser.bScrollOversize = $('#DT_BrowserTest', n)[0].offsetWidth === 100 ? true : false;
+          document.body.removeChild(n);
+        }
+
+
+        /**
+         * Perform a jQuery selector action on the table's TR elements (from the tbody) and
+         * return the resulting jQuery object.
+         *  @param {string|node|jQuery} sSelector jQuery selector or node collection to act on
+         *  @param {object} [oOpts] Optional parameters for modifying the rows to be included
+         *  @param {string} [oOpts.filter=none] Select TR elements that meet the current filter
+         *    criterion ("applied") or all TR elements (i.e. no filter).
+         *  @param {string} [oOpts.order=current] Order of the TR elements in the processed array.
+         *    Can be either 'current', whereby the current sorting of the table is used, or
+         *    'original' whereby the original order the data was read into the table is used.
+         *  @param {string} [oOpts.page=all] Limit the selection to the currently displayed page
+         *    ("current") or not ("all"). If 'current' is given, then order is assumed to be
+         *    'current' and filter is 'applied', regardless of what they might be given as.
+         *  @returns {object} jQuery object, filtered by the given selector.
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *
+		 *      // Highlight every second row
+		 *      oTable.$('tr:odd').css('backgroundColor', 'blue');
+		 *    } );
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *
+		 *      // Filter to rows with 'Webkit' in them, add a background colour and then
+		 *      // remove the filter, thus highlighting the 'Webkit' rows only.
+		 *      oTable.fnFilter('Webkit');
+		 *      oTable.$('tr', {"filter": "applied"}).css('backgroundColor', 'blue');
+		 *      oTable.fnFilter('');
+		 *    } );
+         */
+        this.$ = function (sSelector, oOpts) {
+          var i, iLen, a = [], tr;
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+          var aoData = oSettings.aoData;
+          var aiDisplay = oSettings.aiDisplay;
+          var aiDisplayMaster = oSettings.aiDisplayMaster;
+
+          if (!oOpts) {
+            oOpts = {};
+          }
+
+          oOpts = $.extend({}, {
+            "filter":"none", // applied
+            "order":"current", // "original"
+            "page":"all" // current
+          }, oOpts);
+
+          // Current page implies that order=current and fitler=applied, since it is fairly
+          // senseless otherwise
+          if (oOpts.page == 'current') {
+            for (i = oSettings._iDisplayStart, iLen = oSettings.fnDisplayEnd(); i < iLen; i++) {
+              tr = aoData[ aiDisplay[i] ].nTr;
+              if (tr) {
+                a.push(tr);
+              }
+            }
+          }
+          else if (oOpts.order == "current" && oOpts.filter == "none") {
+            for (i = 0, iLen = aiDisplayMaster.length; i < iLen; i++) {
+              tr = aoData[ aiDisplayMaster[i] ].nTr;
+              if (tr) {
+                a.push(tr);
+              }
+            }
+          }
+          else if (oOpts.order == "current" && oOpts.filter == "applied") {
+            for (i = 0, iLen = aiDisplay.length; i < iLen; i++) {
+              tr = aoData[ aiDisplay[i] ].nTr;
+              if (tr) {
+                a.push(tr);
+              }
+            }
+          }
+          else if (oOpts.order == "original" && oOpts.filter == "none") {
+            for (i = 0, iLen = aoData.length; i < iLen; i++) {
+              tr = aoData[ i ].nTr;
+              if (tr) {
+                a.push(tr);
+              }
+            }
+          }
+          else if (oOpts.order == "original" && oOpts.filter == "applied") {
+            for (i = 0, iLen = aoData.length; i < iLen; i++) {
+              tr = aoData[ i ].nTr;
+              if ($.inArray(i, aiDisplay) !== -1 && tr) {
+                a.push(tr);
+              }
+            }
+          }
+          else {
+            _fnLog(oSettings, 1, "Unknown selection options");
+          }
+
+          /* We need to filter on the TR elements and also 'find' in their descendants
+           * to make the selector act like it would in a full table - so we need
+           * to build both results and then combine them together
+           */
+          var jqA = $(a);
+          var jqTRs = jqA.filter(sSelector);
+          var jqDescendants = jqA.find(sSelector);
+
+          return $([].concat($.makeArray(jqTRs), $.makeArray(jqDescendants)));
+        };
+
+
+        /**
+         * Almost identical to $ in operation, but in this case returns the data for the matched
+         * rows - as such, the jQuery selector used should match TR row nodes or TD/TH cell nodes
+         * rather than any descendants, so the data can be obtained for the row/cell. If matching
+         * rows are found, the data returned is the original data array/object that was used to
+         * create the row (or a generated array if from a DOM source).
+         *
+         * This method is often useful in-combination with $ where both functions are given the
+         * same parameters and the array indexes will match identically.
+         *  @param {string|node|jQuery} sSelector jQuery selector or node collection to act on
+         *  @param {object} [oOpts] Optional parameters for modifying the rows to be included
+         *  @param {string} [oOpts.filter=none] Select elements that meet the current filter
+         *    criterion ("applied") or all elements (i.e. no filter).
+         *  @param {string} [oOpts.order=current] Order of the data in the processed array.
+         *    Can be either 'current', whereby the current sorting of the table is used, or
+         *    'original' whereby the original order the data was read into the table is used.
+         *  @param {string} [oOpts.page=all] Limit the selection to the currently displayed page
+         *    ("current") or not ("all"). If 'current' is given, then order is assumed to be
+         *    'current' and filter is 'applied', regardless of what they might be given as.
+         *  @returns {array} Data for the matched elements. If any elements, as a result of the
+         *    selector, were not TR, TD or TH elements in the DataTable, they will have a null
+         *    entry in the array.
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *
+		 *      // Get the data from the first row in the table
+		 *      var data = oTable._('tr:first');
+		 *
+		 *      // Do something useful with the data
+		 *      alert( "First cell is: "+data[0] );
+		 *    } );
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *
+		 *      // Filter to 'Webkit' and get all data for 
+		 *      oTable.fnFilter('Webkit');
+		 *      var data = oTable._('tr', {"filter": "applied"});
+		 *      
+		 *      // Do something with the data
+		 *      alert( data.length+" rows matched the filter" );
+		 *    } );
+         */
+        this._ = function (sSelector, oOpts) {
+          var aOut = [];
+          var i, iLen, iIndex;
+          var aTrs = this.$(sSelector, oOpts);
+
+          for (i = 0, iLen = aTrs.length; i < iLen; i++) {
+            aOut.push(this.fnGetData(aTrs[i]));
+          }
+
+          return aOut;
+        };
+
+
+        /**
+         * Add a single new row or multiple rows of data to the table. Please note
+         * that this is suitable for client-side processing only - if you are using
+         * server-side processing (i.e. "bServerSide": true), then to add data, you
+         * must add it to the data source, i.e. the server-side, through an Ajax call.
+         *  @param {array|object} mData The data to be added to the table. This can be:
+         *    <ul>
+         *      <li>1D array of data - add a single row with the data provided</li>
+         *      <li>2D array of arrays - add multiple rows in a single call</li>
+         *      <li>object - data object when using <i>mData</i></li>
+         *      <li>array of objects - multiple data objects when using <i>mData</i></li>
+         *    </ul>
+         *  @param {bool} [bRedraw=true] redraw the table or not
+         *  @returns {array} An array of integers, representing the list of indexes in
+         *    <i>aoData</i> ({@link DataTable.models.oSettings}) that have been added to
+         *    the table.
+         *  @dtopt API
+         *
+         *  @example
+         *    // Global var for counter
+         *    var giCount = 2;
+         *
+         *    $(document).ready(function() {
+		 *      $('#example').dataTable();
+		 *    } );
+         *
+         *    function fnClickAddRow() {
+		 *      $('#example').dataTable().fnAddData( [
+		 *        giCount+".1",
+		 *        giCount+".2",
+		 *        giCount+".3",
+		 *        giCount+".4" ]
+		 *      );
+		 *        
+		 *      giCount++;
+		 *    }
+         */
+        this.fnAddData = function (mData, bRedraw) {
+          if (mData.length === 0) {
+            return [];
+          }
+
+          var aiReturn = [];
+          var iTest;
+
+          /* Find settings from table node */
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+
+          /* Check if we want to add multiple rows or not */
+          if (typeof mData[0] === "object" && mData[0] !== null) {
+            for (var i = 0; i < mData.length; i++) {
+              iTest = _fnAddData(oSettings, mData[i]);
+              if (iTest == -1) {
+                return aiReturn;
+              }
+              aiReturn.push(iTest);
+            }
+          }
+          else {
+            iTest = _fnAddData(oSettings, mData);
+            if (iTest == -1) {
+              return aiReturn;
+            }
+            aiReturn.push(iTest);
+          }
+
+          oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
+
+          if (bRedraw === undefined || bRedraw) {
+            _fnReDraw(oSettings);
+          }
+          return aiReturn;
+        };
+
+
+        /**
+         * This function will make DataTables recalculate the column sizes, based on the data
+         * contained in the table and the sizes applied to the columns (in the DOM, CSS or
+         * through the sWidth parameter). This can be useful when the width of the table's
+         * parent element changes (for example a window resize).
+         *  @param {boolean} [bRedraw=true] Redraw the table or not, you will typically want to
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable( {
+		 *        "sScrollY": "200px",
+		 *        "bPaginate": false
+		 *      } );
+		 *      
+		 *      $(window).bind('resize', function () {
+		 *        oTable.fnAdjustColumnSizing();
+		 *      } );
+		 *    } );
+         */
+        this.fnAdjustColumnSizing = function (bRedraw) {
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+          _fnAdjustColumnSizing(oSettings);
+
+          if (bRedraw === undefined || bRedraw) {
+            this.fnDraw(false);
+          }
+          else if (oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "") {
+            /* If not redrawing, but scrolling, we want to apply the new column sizes anyway */
+            this.oApi._fnScrollDraw(oSettings);
+          }
+        };
+
+
+        /**
+         * Quickly and simply clear a table
+         *  @param {bool} [bRedraw=true] redraw the table or not
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *      
+		 *      // Immediately 'nuke' the current rows (perhaps waiting for an Ajax callback...)
+		 *      oTable.fnClearTable();
+		 *    } );
+         */
+        this.fnClearTable = function (bRedraw) {
+          /* Find settings from table node */
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+          _fnClearTable(oSettings);
+
+          if (bRedraw === undefined || bRedraw) {
+            _fnDraw(oSettings);
+          }
+        };
+
+
+        /**
+         * The exact opposite of 'opening' a row, this function will close any rows which
+         * are currently 'open'.
+         *  @param {node} nTr the table row to 'close'
+         *  @returns {int} 0 on success, or 1 if failed (can't find the row)
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable;
+		 *      
+		 *      // 'open' an information row when a row is clicked on
+		 *      $('#example tbody tr').click( function () {
+		 *        if ( oTable.fnIsOpen(this) ) {
+		 *          oTable.fnClose( this );
+		 *        } else {
+		 *          oTable.fnOpen( this, "Temporary row opened", "info_row" );
+		 *        }
+		 *      } );
+		 *      
+		 *      oTable = $('#example').dataTable();
+		 *    } );
+         */
+        this.fnClose = function (nTr) {
+          /* Find settings from table node */
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+
+          for (var i = 0; i < oSettings.aoOpenRows.length; i++) {
+            if (oSettings.aoOpenRows[i].nParent == nTr) {
+              var nTrParent = oSettings.aoOpenRows[i].nTr.parentNode;
+              if (nTrParent) {
+                /* Remove it if it is currently on display */
+                nTrParent.removeChild(oSettings.aoOpenRows[i].nTr);
+              }
+              oSettings.aoOpenRows.splice(i, 1);
+              return 0;
+            }
+          }
+          return 1;
+        };
+
+
+        /**
+         * Remove a row for the table
+         *  @param {mixed} mTarget The index of the row from aoData to be deleted, or
+         *    the TR element you want to delete
+         *  @param {function|null} [fnCallBack] Callback function
+         *  @param {bool} [bRedraw=true] Redraw the table or not
+         *  @returns {array} The row that was deleted
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *      
+		 *      // Immediately remove the first row
+		 *      oTable.fnDeleteRow( 0 );
+		 *    } );
+         */
+        this.fnDeleteRow = function (mTarget, fnCallBack, bRedraw) {
+          /* Find settings from table node */
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+          var i, iLen, iAODataIndex;
+
+          iAODataIndex = (typeof mTarget === 'object') ?
+            _fnNodeToDataIndex(oSettings, mTarget) : mTarget;
+
+          /* Return the data array from this row */
+          var oData = oSettings.aoData.splice(iAODataIndex, 1);
+
+          /* Update the _DT_RowIndex parameter */
+          for (i = 0, iLen = oSettings.aoData.length; i < iLen; i++) {
+            if (oSettings.aoData[i].nTr !== null) {
+              oSettings.aoData[i].nTr._DT_RowIndex = i;
+            }
+          }
+
+          /* Remove the target row from the search array */
+          var iDisplayIndex = $.inArray(iAODataIndex, oSettings.aiDisplay);
+          oSettings.asDataSearch.splice(iDisplayIndex, 1);
+
+          /* Delete from the display arrays */
+          _fnDeleteIndex(oSettings.aiDisplayMaster, iAODataIndex);
+          _fnDeleteIndex(oSettings.aiDisplay, iAODataIndex);
+
+          /* If there is a user callback function - call it */
+          if (typeof fnCallBack === "function") {
+            fnCallBack.call(this, oSettings, oData);
+          }
+
+          /* Check for an 'overflow' they case for displaying the table */
+          if (oSettings._iDisplayStart >= oSettings.fnRecordsDisplay()) {
+            oSettings._iDisplayStart -= oSettings._iDisplayLength;
+            if (oSettings._iDisplayStart < 0) {
+              oSettings._iDisplayStart = 0;
+            }
+          }
+
+          if (bRedraw === undefined || bRedraw) {
+            _fnCalculateEnd(oSettings);
+            _fnDraw(oSettings);
+          }
+
+          return oData;
+        };
+
+
+        /**
+         * Restore the table to it's original state in the DOM by removing all of DataTables
+         * enhancements, alterations to the DOM structure of the table and event listeners.
+         *  @param {boolean} [bRemove=false] Completely remove the table from the DOM
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      // This example is fairly pointless in reality, but shows how fnDestroy can be used
+		 *      var oTable = $('#example').dataTable();
+		 *      oTable.fnDestroy();
+		 *    } );
+         */
+        this.fnDestroy = function (bRemove) {
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+          var nOrig = oSettings.nTableWrapper.parentNode;
+          var nBody = oSettings.nTBody;
+          var i, iLen;
+
+          bRemove = (bRemove === undefined) ? false : bRemove;
+
+          /* Flag to note that the table is currently being destroyed - no action should be taken */
+          oSettings.bDestroying = true;
+
+          /* Fire off the destroy callbacks for plug-ins etc */
+          _fnCallbackFire(oSettings, "aoDestroyCallback", "destroy", [oSettings]);
+
+          /* If the table is not being removed, restore the hidden columns */
+          if (!bRemove) {
+            for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {
+              if (oSettings.aoColumns[i].bVisible === false) {
+                this.fnSetColumnVis(i, true);
+              }
+            }
+          }
+
+          /* Blitz all DT events */
+          $(oSettings.nTableWrapper).find('*').andSelf().unbind('.DT');
+
+          /* If there is an 'empty' indicator row, remove it */
+          $('tbody>tr>td.' + oSettings.oClasses.sRowEmpty, oSettings.nTable).parent().remove();
+
+          /* When scrolling we had to break the table up - restore it */
+          if (oSettings.nTable != oSettings.nTHead.parentNode) {
+            $(oSettings.nTable).children('thead').remove();
+            oSettings.nTable.appendChild(oSettings.nTHead);
+          }
+
+          if (oSettings.nTFoot && oSettings.nTable != oSettings.nTFoot.parentNode) {
+            $(oSettings.nTable).children('tfoot').remove();
+            oSettings.nTable.appendChild(oSettings.nTFoot);
+          }
+
+          /* Remove the DataTables generated nodes, events and classes */
+          oSettings.nTable.parentNode.removeChild(oSettings.nTable);
+          $(oSettings.nTableWrapper).remove();
+
+          oSettings.aaSorting = [];
+          oSettings.aaSortingFixed = [];
+          _fnSortingClasses(oSettings);
+
+          $(_fnGetTrNodes(oSettings)).removeClass(oSettings.asStripeClasses.join(' '));
+
+          $('th, td', oSettings.nTHead).removeClass([
+            oSettings.oClasses.sSortable,
+            oSettings.oClasses.sSortableAsc,
+            oSettings.oClasses.sSortableDesc,
+            oSettings.oClasses.sSortableNone ].join(' ')
+          );
+          if (oSettings.bJUI) {
+            $('th span.' + oSettings.oClasses.sSortIcon
+              + ', td span.' + oSettings.oClasses.sSortIcon, oSettings.nTHead).remove();
+
+            $('th, td', oSettings.nTHead).each(function () {
+              var jqWrapper = $('div.' + oSettings.oClasses.sSortJUIWrapper, this);
+              var kids = jqWrapper.contents();
+              $(this).append(kids);
+              jqWrapper.remove();
+            });
+          }
+
+          /* Add the TR elements back into the table in their original order */
+          if (!bRemove && oSettings.nTableReinsertBefore) {
+            nOrig.insertBefore(oSettings.nTable, oSettings.nTableReinsertBefore);
+          }
+          else if (!bRemove) {
+            nOrig.appendChild(oSettings.nTable);
+          }
+
+          for (i = 0, iLen = oSettings.aoData.length; i < iLen; i++) {
+            if (oSettings.aoData[i].nTr !== null) {
+              nBody.appendChild(oSettings.aoData[i].nTr);
+            }
+          }
+
+          /* Restore the width of the original table */
+          if (oSettings.oFeatures.bAutoWidth === true) {
+            oSettings.nTable.style.width = _fnStringToCss(oSettings.sDestroyWidth);
+          }
+
+          /* If the were originally stripe classes - then we add them back here. Note
+           * this is not fool proof (for example if not all rows had stripe classes - but
+           * it's a good effort without getting carried away
+           */
+          iLen = oSettings.asDestroyStripes.length;
+          if (iLen) {
+            var anRows = $(nBody).children('tr');
+            for (i = 0; i < iLen; i++) {
+              anRows.filter(':nth-child(' + iLen + 'n + ' + i + ')').addClass(oSettings.asDestroyStripes[i]);
+            }
+          }
+
+          /* Remove the settings object from the settings array */
+          for (i = 0, iLen = DataTable.settings.length; i < iLen; i++) {
+            if (DataTable.settings[i] == oSettings) {
+              DataTable.settings.splice(i, 1);
+            }
+          }
+
+          /* End it all */
+          oSettings = null;
+          oInit = null;
+        };
+
+
+        /**
+         * Redraw the table
+         *  @param {bool} [bComplete=true] Re-filter and resort (if enabled) the table before the draw.
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *      
+		 *      // Re-draw the table - you wouldn't want to do it here, but it's an example :-)
+		 *      oTable.fnDraw();
+		 *    } );
+         */
+        this.fnDraw = function (bComplete) {
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+          if (bComplete === false) {
+            _fnCalculateEnd(oSettings);
+            _fnDraw(oSettings);
+          }
+          else {
+            _fnReDraw(oSettings);
+          }
+        };
+
+
+        /**
+         * Filter the input based on data
+         *  @param {string} sInput String to filter the table on
+         *  @param {int|null} [iColumn] Column to limit filtering to
+         *  @param {bool} [bRegex=false] Treat as regular expression or not
+         *  @param {bool} [bSmart=true] Perform smart filtering or not
+         *  @param {bool} [bShowGlobal=true] Show the input global filter in it's input box(es)
+         *  @param {bool} [bCaseInsensitive=true] Do case-insensitive matching (true) or not (false)
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *      
+		 *      // Sometime later - filter...
+		 *      oTable.fnFilter( 'test string' );
+		 *    } );
+         */
+        this.fnFilter = function (sInput, iColumn, bRegex, bSmart, bShowGlobal, bCaseInsensitive) {
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+
+          if (!oSettings.oFeatures.bFilter) {
+            return;
+          }
+
+          if (bRegex === undefined || bRegex === null) {
+            bRegex = false;
+          }
+
+          if (bSmart === undefined || bSmart === null) {
+            bSmart = true;
+          }
+
+          if (bShowGlobal === undefined || bShowGlobal === null) {
+            bShowGlobal = true;
+          }
+
+          if (bCaseInsensitive === undefined || bCaseInsensitive === null) {
+            bCaseInsensitive = true;
+          }
+
+          if (iColumn === undefined || iColumn === null) {
+            /* Global filter */
+            _fnFilterComplete(oSettings, {
+              "sSearch":sInput + "",
+              "bRegex":bRegex,
+              "bSmart":bSmart,
+              "bCaseInsensitive":bCaseInsensitive
+            }, 1);
+
+            if (bShowGlobal && oSettings.aanFeatures.f) {
+              var n = oSettings.aanFeatures.f;
+              for (var i = 0, iLen = n.length; i < iLen; i++) {
+                // IE9 throws an 'unknown error' if document.activeElement is used
+                // inside an iframe or frame...
+                try {
+                  if (n[i]._DT_Input != document.activeElement) {
+                    $(n[i]._DT_Input).val(sInput);
+                  }
+                }
+                catch (e) {
+                  $(n[i]._DT_Input).val(sInput);
+                }
+              }
+            }
+          }
+          else {
+            /* Single column filter */
+            $.extend(oSettings.aoPreSearchCols[ iColumn ], {
+              "sSearch":sInput + "",
+              "bRegex":bRegex,
+              "bSmart":bSmart,
+              "bCaseInsensitive":bCaseInsensitive
+            });
+            _fnFilterComplete(oSettings, oSettings.oPreviousSearch, 1);
+          }
+        };
+
+
+        /**
+         * Get the data for the whole table, an individual row or an individual cell based on the
+         * provided parameters.
+         *  @param {int|node} [mRow] A TR row node, TD/TH cell node or an integer. If given as
+         *    a TR node then the data source for the whole row will be returned. If given as a
+         *    TD/TH cell node then iCol will be automatically calculated and the data for the
+         *    cell returned. If given as an integer, then this is treated as the aoData internal
+         *    data index for the row (see fnGetPosition) and the data for that row used.
+         *  @param {int} [iCol] Optional column index that you want the data of.
+         *  @returns {array|object|string} If mRow is undefined, then the data for all rows is
+         *    returned. If mRow is defined, just data for that row, and is iCol is
+         *    defined, only data for the designated cell is returned.
+         *  @dtopt API
+         *
+         *  @example
+         *    // Row data
+         *    $(document).ready(function() {
+		 *      oTable = $('#example').dataTable();
+		 *
+		 *      oTable.$('tr').click( function () {
+		 *        var data = oTable.fnGetData( this );
+		 *        // ... do something with the array / object of data for the row
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Individual cell data
+         *    $(document).ready(function() {
+		 *      oTable = $('#example').dataTable();
+		 *
+		 *      oTable.$('td').click( function () {
+		 *        var sData = oTable.fnGetData( this );
+		 *        alert( 'The cell clicked on had the value of '+sData );
+		 *      } );
+		 *    } );
+         */
+        this.fnGetData = function (mRow, iCol) {
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+
+          if (mRow !== undefined) {
+            var iRow = mRow;
+            if (typeof mRow === 'object') {
+              var sNode = mRow.nodeName.toLowerCase();
+              if (sNode === "tr") {
+                iRow = _fnNodeToDataIndex(oSettings, mRow);
+              }
+              else if (sNode === "td") {
+                iRow = _fnNodeToDataIndex(oSettings, mRow.parentNode);
+                iCol = _fnNodeToColumnIndex(oSettings, iRow, mRow);
+              }
+            }
+
+            if (iCol !== undefined) {
+              return _fnGetCellData(oSettings, iRow, iCol, '');
+            }
+            return (oSettings.aoData[iRow] !== undefined) ?
+              oSettings.aoData[iRow]._aData : null;
+          }
+          return _fnGetDataMaster(oSettings);
+        };
+
+
+        /**
+         * Get an array of the TR nodes that are used in the table's body. Note that you will
+         * typically want to use the '$' API method in preference to this as it is more
+         * flexible.
+         *  @param {int} [iRow] Optional row index for the TR element you want
+         *  @returns {array|node} If iRow is undefined, returns an array of all TR elements
+         *    in the table's body, or iRow is defined, just the TR element requested.
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *      
+		 *      // Get the nodes from the table
+		 *      var nNodes = oTable.fnGetNodes( );
+		 *    } );
+         */
+        this.fnGetNodes = function (iRow) {
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+
+          if (iRow !== undefined) {
+            return (oSettings.aoData[iRow] !== undefined) ?
+              oSettings.aoData[iRow].nTr : null;
+          }
+          return _fnGetTrNodes(oSettings);
+        };
+
+
+        /**
+         * Get the array indexes of a particular cell from it's DOM element
+         * and column index including hidden columns
+         *  @param {node} nNode this can either be a TR, TD or TH in the table's body
+         *  @returns {int} If nNode is given as a TR, then a single index is returned, or
+         *    if given as a cell, an array of [row index, column index (visible),
+         *    column index (all)] is given.
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      $('#example tbody td').click( function () {
+		 *        // Get the position of the current data from the node
+		 *        var aPos = oTable.fnGetPosition( this );
+		 *        
+		 *        // Get the data array for this row
+		 *        var aData = oTable.fnGetData( aPos[0] );
+		 *        
+		 *        // Update the data array and return the value
+		 *        aData[ aPos[1] ] = 'clicked';
+		 *        this.innerHTML = 'clicked';
+		 *      } );
+		 *      
+		 *      // Init DataTables
+		 *      oTable = $('#example').dataTable();
+		 *    } );
+         */
+        this.fnGetPosition = function (nNode) {
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+          var sNodeName = nNode.nodeName.toUpperCase();
+
+          if (sNodeName == "TR") {
+            return _fnNodeToDataIndex(oSettings, nNode);
+          }
+          else if (sNodeName == "TD" || sNodeName == "TH") {
+            var iDataIndex = _fnNodeToDataIndex(oSettings, nNode.parentNode);
+            var iColumnIndex = _fnNodeToColumnIndex(oSettings, iDataIndex, nNode);
+            return [ iDataIndex, _fnColumnIndexToVisible(oSettings, iColumnIndex), iColumnIndex ];
+          }
+          return null;
+        };
+
+
+        /**
+         * Check to see if a row is 'open' or not.
+         *  @param {node} nTr the table row to check
+         *  @returns {boolean} true if the row is currently open, false otherwise
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable;
+		 *      
+		 *      // 'open' an information row when a row is clicked on
+		 *      $('#example tbody tr').click( function () {
+		 *        if ( oTable.fnIsOpen(this) ) {
+		 *          oTable.fnClose( this );
+		 *        } else {
+		 *          oTable.fnOpen( this, "Temporary row opened", "info_row" );
+		 *        }
+		 *      } );
+		 *      
+		 *      oTable = $('#example').dataTable();
+		 *    } );
+         */
+        this.fnIsOpen = function (nTr) {
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+          var aoOpenRows = oSettings.aoOpenRows;
+
+          for (var i = 0; i < oSettings.aoOpenRows.length; i++) {
+            if (oSettings.aoOpenRows[i].nParent == nTr) {
+              return true;
+            }
+          }
+          return false;
+        };
+
+
+        /**
+         * This function will place a new row directly after a row which is currently
+         * on display on the page, with the HTML contents that is passed into the
+         * function. This can be used, for example, to ask for confirmation that a
+         * particular record should be deleted.
+         *  @param {node} nTr The table row to 'open'
+         *  @param {string|node|jQuery} mHtml The HTML to put into the row
+         *  @param {string} sClass Class to give the new TD cell
+         *  @returns {node} The row opened. Note that if the table row passed in as the
+         *    first parameter, is not found in the table, this method will silently
+         *    return.
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable;
+		 *      
+		 *      // 'open' an information row when a row is clicked on
+		 *      $('#example tbody tr').click( function () {
+		 *        if ( oTable.fnIsOpen(this) ) {
+		 *          oTable.fnClose( this );
+		 *        } else {
+		 *          oTable.fnOpen( this, "Temporary row opened", "info_row" );
+		 *        }
+		 *      } );
+		 *      
+		 *      oTable = $('#example').dataTable();
+		 *    } );
+         */
+        this.fnOpen = function (nTr, mHtml, sClass) {
+          /* Find settings from table node */
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+
+          /* Check that the row given is in the table */
+          var nTableRows = _fnGetTrNodes(oSettings);
+          if ($.inArray(nTr, nTableRows) === -1) {
+            return;
+          }
+
+          /* the old open one if there is one */
+          this.fnClose(nTr);
+
+          var nNewRow = document.createElement("tr");
+          var nNewCell = document.createElement("td");
+          nNewRow.appendChild(nNewCell);
+          nNewCell.className = sClass;
+          nNewCell.colSpan = _fnVisbleColumns(oSettings);
+
+          if (typeof mHtml === "string") {
+            nNewCell.innerHTML = mHtml;
+          }
+          else {
+            $(nNewCell).html(mHtml);
+          }
+
+          /* If the nTr isn't on the page at the moment - then we don't insert at the moment */
+          var nTrs = $('tr', oSettings.nTBody);
+          if ($.inArray(nTr, nTrs) != -1) {
+            $(nNewRow).insertAfter(nTr);
+          }
+
+          oSettings.aoOpenRows.push({
+            "nTr":nNewRow,
+            "nParent":nTr
+          });
+
+          return nNewRow;
+        };
+
+
+        /**
+         * Change the pagination - provides the internal logic for pagination in a simple API
+         * function. With this function you can have a DataTables table go to the next,
+         * previous, first or last pages.
+         *  @param {string|int} mAction Paging action to take: "first", "previous", "next" or "last"
+         *    or page number to jump to (integer), note that page 0 is the first page.
+         *  @param {bool} [bRedraw=true] Redraw the table or not
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *      oTable.fnPageChange( 'next' );
+		 *    } );
+         */
+        this.fnPageChange = function (mAction, bRedraw) {
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+          _fnPageChange(oSettings, mAction);
+          _fnCalculateEnd(oSettings);
+
+          if (bRedraw === undefined || bRedraw) {
+            _fnDraw(oSettings);
+          }
+        };
+
+
+        /**
+         * Show a particular column
+         *  @param {int} iCol The column whose display should be changed
+         *  @param {bool} bShow Show (true) or hide (false) the column
+         *  @param {bool} [bRedraw=true] Redraw the table or not
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *      
+		 *      // Hide the second column after initialisation
+		 *      oTable.fnSetColumnVis( 1, false );
+		 *    } );
+         */
+        this.fnSetColumnVis = function (iCol, bShow, bRedraw) {
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+          var i, iLen;
+          var aoColumns = oSettings.aoColumns;
+          var aoData = oSettings.aoData;
+          var nTd, bAppend, iBefore;
+
+          /* No point in doing anything if we are requesting what is already true */
+          if (aoColumns[iCol].bVisible == bShow) {
+            return;
+          }
+
+          /* Show the column */
+          if (bShow) {
+            var iInsert = 0;
+            for (i = 0; i < iCol; i++) {
+              if (aoColumns[i].bVisible) {
+                iInsert++;
+              }
+            }
+
+            /* Need to decide if we should use appendChild or insertBefore */
+            bAppend = (iInsert >= _fnVisbleColumns(oSettings));
+
+            /* Which coloumn should we be inserting before? */
+            if (!bAppend) {
+              for (i = iCol; i < aoColumns.length; i++) {
+                if (aoColumns[i].bVisible) {
+                  iBefore = i;
+                  break;
+                }
+              }
+            }
+
+            for (i = 0, iLen = aoData.length; i < iLen; i++) {
+              if (aoData[i].nTr !== null) {
+                if (bAppend) {
+                  aoData[i].nTr.appendChild(
+                    aoData[i]._anHidden[iCol]
+                  );
+                }
+                else {
+                  aoData[i].nTr.insertBefore(
+                    aoData[i]._anHidden[iCol],
+                    _fnGetTdNodes(oSettings, i)[iBefore]);
+                }
+              }
+            }
+          }
+          else {
+            /* Remove a column from display */
+            for (i = 0, iLen = aoData.length; i < iLen; i++) {
+              if (aoData[i].nTr !== null) {
+                nTd = _fnGetTdNodes(oSettings, i)[iCol];
+                aoData[i]._anHidden[iCol] = nTd;
+                nTd.parentNode.removeChild(nTd);
+              }
+            }
+          }
+
+          /* Clear to set the visible flag */
+          aoColumns[iCol].bVisible = bShow;
+
+          /* Redraw the header and footer based on the new column visibility */
+          _fnDrawHead(oSettings, oSettings.aoHeader);
+          if (oSettings.nTFoot) {
+            _fnDrawHead(oSettings, oSettings.aoFooter);
+          }
+
+          /* If there are any 'open' rows, then we need to alter the colspan for this col change */
+          for (i = 0, iLen = oSettings.aoOpenRows.length; i < iLen; i++) {
+            oSettings.aoOpenRows[i].nTr.colSpan = _fnVisbleColumns(oSettings);
+          }
+
+          /* Do a redraw incase anything depending on the table columns needs it 
+           * (built-in: scrolling) 
+           */
+          if (bRedraw === undefined || bRedraw) {
+            _fnAdjustColumnSizing(oSettings);
+            _fnDraw(oSettings);
+          }
+
+          _fnSaveState(oSettings);
+        };
+
+
+        /**
+         * Get the settings for a particular table for external manipulation
+         *  @returns {object} DataTables settings object. See
+         *    {@link DataTable.models.oSettings}
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *      var oSettings = oTable.fnSettings();
+		 *      
+		 *      // Show an example parameter from the settings
+		 *      alert( oSettings._iDisplayStart );
+		 *    } );
+         */
+        this.fnSettings = function () {
+          return _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+        };
+
+
+        /**
+         * Sort the table by a particular column
+         *  @param {int} iCol the data index to sort on. Note that this will not match the
+         *    'display index' if you have hidden data entries
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *      
+		 *      // Sort immediately with columns 0 and 1
+		 *      oTable.fnSort( [ [0,'asc'], [1,'asc'] ] );
+		 *    } );
+         */
+        this.fnSort = function (aaSort) {
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+          oSettings.aaSorting = aaSort;
+          _fnSort(oSettings);
+        };
+
+
+        /**
+         * Attach a sort listener to an element for a given column
+         *  @param {node} nNode the element to attach the sort listener to
+         *  @param {int} iColumn the column that a click on this node will sort on
+         *  @param {function} [fnCallback] callback function when sort is run
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *      
+		 *      // Sort on column 1, when 'sorter' is clicked on
+		 *      oTable.fnSortListener( document.getElementById('sorter'), 1 );
+		 *    } );
+         */
+        this.fnSortListener = function (nNode, iColumn, fnCallback) {
+          _fnSortAttachListener(_fnSettingsFromNode(this[DataTable.ext.iApiIndex]), nNode, iColumn,
+            fnCallback);
+        };
+
+
+        /**
+         * Update a table cell or row - this method will accept either a single value to
+         * update the cell with, an array of values with one element for each column or
+         * an object in the same format as the original data source. The function is
+         * self-referencing in order to make the multi column updates easier.
+         *  @param {object|array|string} mData Data to update the cell/row with
+         *  @param {node|int} mRow TR element you want to update or the aoData index
+         *  @param {int} [iColumn] The column to update (not used of mData is an array or object)
+         *  @param {bool} [bRedraw=true] Redraw the table or not
+         *  @param {bool} [bAction=true] Perform pre-draw actions or not
+         *  @returns {int} 0 on success, 1 on error
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *      oTable.fnUpdate( 'Example update', 0, 0 ); // Single cell
+		 *      oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], 1, 0 ); // Row
+		 *    } );
+         */
+        this.fnUpdate = function (mData, mRow, iColumn, bRedraw, bAction) {
+          var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
+          var i, iLen, sDisplay;
+          var iRow = (typeof mRow === 'object') ?
+            _fnNodeToDataIndex(oSettings, mRow) : mRow;
+
+          if ($.isArray(mData) && iColumn === undefined) {
+            /* Array update - update the whole row */
+            oSettings.aoData[iRow]._aData = mData.slice();
+
+            /* Flag to the function that we are recursing */
+            for (i = 0; i < oSettings.aoColumns.length; i++) {
+              this.fnUpdate(_fnGetCellData(oSettings, iRow, i), iRow, i, false, false);
+            }
+          }
+          else if ($.isPlainObject(mData) && iColumn === undefined) {
+            /* Object update - update the whole row - assume the developer gets the object right */
+            oSettings.aoData[iRow]._aData = $.extend(true, {}, mData);
+
+            for (i = 0; i < oSettings.aoColumns.length; i++) {
+              this.fnUpdate(_fnGetCellData(oSettings, iRow, i), iRow, i, false, false);
+            }
+          }
+          else {
+            /* Individual cell update */
+            _fnSetCellData(oSettings, iRow, iColumn, mData);
+            sDisplay = _fnGetCellData(oSettings, iRow, iColumn, 'display');
+
+            var oCol = oSettings.aoColumns[iColumn];
+            if (oCol.fnRender !== null) {
+              sDisplay = _fnRender(oSettings, iRow, iColumn);
+              if (oCol.bUseRendered) {
+                _fnSetCellData(oSettings, iRow, iColumn, sDisplay);
+              }
+            }
+
+            if (oSettings.aoData[iRow].nTr !== null) {
+              /* Do the actual HTML update */
+              _fnGetTdNodes(oSettings, iRow)[iColumn].innerHTML = sDisplay;
+            }
+          }
+
+          /* Modify the search index for this row (strictly this is likely not needed, since fnReDraw
+           * will rebuild the search array - however, the redraw might be disabled by the user)
+           */
+          var iDisplayIndex = $.inArray(iRow, oSettings.aiDisplay);
+          oSettings.asDataSearch[iDisplayIndex] = _fnBuildSearchRow(
+            oSettings,
+            _fnGetRowData(oSettings, iRow, 'filter', _fnGetColumns(oSettings, 'bSearchable'))
+          );
+
+          /* Perform pre-draw actions */
+          if (bAction === undefined || bAction) {
+            _fnAdjustColumnSizing(oSettings);
+          }
+
+          /* Redraw the table */
+          if (bRedraw === undefined || bRedraw) {
+            _fnReDraw(oSettings);
+          }
+          return 0;
+        };
+
+
+        /**
+         * Provide a common method for plug-ins to check the version of DataTables being used, in order
+         * to ensure compatibility.
+         *  @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note that the
+         *    formats "X" and "X.Y" are also acceptable.
+         *  @returns {boolean} true if this version of DataTables is greater or equal to the required
+         *    version, or false if this version of DataTales is not suitable
+         *  @method
+         *  @dtopt API
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *      alert( oTable.fnVersionCheck( '1.9.0' ) );
+		 *    } );
+         */
+        this.fnVersionCheck = DataTable.ext.fnVersionCheck;
+
+
+        /*
+         * This is really a good bit rubbish this method of exposing the internal methods
+         * publicly... - To be fixed in 2.0 using methods on the prototype
+         */
+
+
+        /**
+         * Create a wrapper function for exporting an internal functions to an external API.
+         *  @param {string} sFunc API function name
+         *  @returns {function} wrapped function
+         *  @memberof DataTable#oApi
+         */
+        function _fnExternApiFunc(sFunc) {
+          return function () {
+            var aArgs = [_fnSettingsFromNode(this[DataTable.ext.iApiIndex])].concat(
+              Array.prototype.slice.call(arguments));
+            return DataTable.ext.oApi[sFunc].apply(this, aArgs);
+          };
+        }
+
+
+        /**
+         * Reference to internal functions for use by plug-in developers. Note that these
+         * methods are references to internal functions and are considered to be private.
+         * If you use these methods, be aware that they are liable to change between versions
+         * (check the upgrade notes).
+         *  @namespace
+         */
+        this.oApi = {
+          "_fnExternApiFunc":_fnExternApiFunc,
+          "_fnInitialise":_fnInitialise,
+          "_fnInitComplete":_fnInitComplete,
+          "_fnLanguageCompat":_fnLanguageCompat,
+          "_fnAddColumn":_fnAddColumn,
+          "_fnColumnOptions":_fnColumnOptions,
+          "_fnAddData":_fnAddData,
+          "_fnCreateTr":_fnCreateTr,
+          "_fnGatherData":_fnGatherData,
+          "_fnBuildHead":_fnBuildHead,
+          "_fnDrawHead":_fnDrawHead,
+          "_fnDraw":_fnDraw,
+          "_fnReDraw":_fnReDraw,
+          "_fnAjaxUpdate":_fnAjaxUpdate,
+          "_fnAjaxParameters":_fnAjaxParameters,
+          "_fnAjaxUpdateDraw":_fnAjaxUpdateDraw,
+          "_fnServerParams":_fnServerParams,
+          "_fnAddOptionsHtml":_fnAddOptionsHtml,
+          "_fnFeatureHtmlTable":_fnFeatureHtmlTable,
+          "_fnScrollDraw":_fnScrollDraw,
+          "_fnAdjustColumnSizing":_fnAdjustColumnSizing,
+          "_fnFeatureHtmlFilter":_fnFeatureHtmlFilter,
+          "_fnFilterComplete":_fnFilterComplete,
+          "_fnFilterCustom":_fnFilterCustom,
+          "_fnFilterColumn":_fnFilterColumn,
+          "_fnFilter":_fnFilter,
+          "_fnBuildSearchArray":_fnBuildSearchArray,
+          "_fnBuildSearchRow":_fnBuildSearchRow,
+          "_fnFilterCreateSearch":_fnFilterCreateSearch,
+          "_fnDataToSearch":_fnDataToSearch,
+          "_fnSort":_fnSort,
+          "_fnSortAttachListener":_fnSortAttachListener,
+          "_fnSortingClasses":_fnSortingClasses,
+          "_fnFeatureHtmlPaginate":_fnFeatureHtmlPaginate,
+          "_fnPageChange":_fnPageChange,
+          "_fnFeatureHtmlInfo":_fnFeatureHtmlInfo,
+          "_fnUpdateInfo":_fnUpdateInfo,
+          "_fnFeatureHtmlLength":_fnFeatureHtmlLength,
+          "_fnFeatureHtmlProcessing":_fnFeatureHtmlProcessing,
+          "_fnProcessingDisplay":_fnProcessingDisplay,
+          "_fnVisibleToColumnIndex":_fnVisibleToColumnIndex,
+          "_fnColumnIndexToVisible":_fnColumnIndexToVisible,
+          "_fnNodeToDataIndex":_fnNodeToDataIndex,
+          "_fnVisbleColumns":_fnVisbleColumns,
+          "_fnCalculateEnd":_fnCalculateEnd,
+          "_fnConvertToWidth":_fnConvertToWidth,
+          "_fnCalculateColumnWidths":_fnCalculateColumnWidths,
+          "_fnScrollingWidthAdjust":_fnScrollingWidthAdjust,
+          "_fnGetWidestNode":_fnGetWidestNode,
+          "_fnGetMaxLenString":_fnGetMaxLenString,
+          "_fnStringToCss":_fnStringToCss,
+          "_fnDetectType":_fnDetectType,
+          "_fnSettingsFromNode":_fnSettingsFromNode,
+          "_fnGetDataMaster":_fnGetDataMaster,
+          "_fnGetTrNodes":_fnGetTrNodes,
+          "_fnGetTdNodes":_fnGetTdNodes,
+          "_fnEscapeRegex":_fnEscapeRegex,
+          "_fnDeleteIndex":_fnDeleteIndex,
+          "_fnReOrderIndex":_fnReOrderIndex,
+          "_fnColumnOrdering":_fnColumnOrdering,
+          "_fnLog":_fnLog,
+          "_fnClearTable":_fnClearTable,
+          "_fnSaveState":_fnSaveState,
+          "_fnLoadState":_fnLoadState,
+          "_fnCreateCookie":_fnCreateCookie,
+          "_fnReadCookie":_fnReadCookie,
+          "_fnDetectHeader":_fnDetectHeader,
+          "_fnGetUniqueThs":_fnGetUniqueThs,
+          "_fnScrollBarWidth":_fnScrollBarWidth,
+          "_fnApplyToChildren":_fnApplyToChildren,
+          "_fnMap":_fnMap,
+          "_fnGetRowData":_fnGetRowData,
+          "_fnGetCellData":_fnGetCellData,
+          "_fnSetCellData":_fnSetCellData,
+          "_fnGetObjectDataFn":_fnGetObjectDataFn,
+          "_fnSetObjectDataFn":_fnSetObjectDataFn,
+          "_fnApplyColumnDefs":_fnApplyColumnDefs,
+          "_fnBindAction":_fnBindAction,
+          "_fnExtend":_fnExtend,
+          "_fnCallbackReg":_fnCallbackReg,
+          "_fnCallbackFire":_fnCallbackFire,
+          "_fnJsonString":_fnJsonString,
+          "_fnRender":_fnRender,
+          "_fnNodeToColumnIndex":_fnNodeToColumnIndex,
+          "_fnInfoMacros":_fnInfoMacros,
+          "_fnBrowserDetect":_fnBrowserDetect,
+          "_fnGetColumns":_fnGetColumns
+        };
+
+        $.extend(DataTable.ext.oApi, this.oApi);
+
+        for (var sFunc in DataTable.ext.oApi) {
+          if (sFunc) {
+            this[sFunc] = _fnExternApiFunc(sFunc);
+          }
+        }
+
+
+        var _that = this;
+        this.each(function () {
+          var i = 0, iLen, j, jLen, k, kLen;
+          var sId = this.getAttribute('id');
+          var bInitHandedOff = false;
+          var bUsePassedData = false;
+
+
+          /* Sanity check */
+          if (this.nodeName.toLowerCase() != 'table') {
+            _fnLog(null, 0, "Attempted to initialise DataTables on a node which is not a " +
+              "table: " + this.nodeName);
+            return;
+          }
+
+          /* Check to see if we are re-initialising a table */
+          for (i = 0, iLen = DataTable.settings.length; i < iLen; i++) {
+            /* Base check on table node */
+            if (DataTable.settings[i].nTable == this) {
+              if (oInit === undefined || oInit.bRetrieve) {
+                return DataTable.settings[i].oInstance;
+              }
+              else if (oInit.bDestroy) {
+                DataTable.settings[i].oInstance.fnDestroy();
+                break;
+              }
+              else {
+                _fnLog(DataTable.settings[i], 0, "Cannot reinitialise DataTable.\n\n" +
+                  "To retrieve the DataTables object for this table, pass no arguments or see " +
+                  "the docs for bRetrieve and bDestroy");
+                return;
+              }
+            }
+
+            /* If the element we are initialising has the same ID as a table which was previously
+             * initialised, but the table nodes don't match (from before) then we destroy the old
+             * instance by simply deleting it. This is under the assumption that the table has been
+             * destroyed by other methods. Anyone using non-id selectors will need to do this manually
+             */
+            if (DataTable.settings[i].sTableId == this.id) {
+              DataTable.settings.splice(i, 1);
+              break;
+            }
+          }
+
+          /* Ensure the table has an ID - required for accessibility */
+          if (sId === null || sId === "") {
+            sId = "DataTables_Table_" + (DataTable.ext._oExternConfig.iNextUnique++);
+            this.id = sId;
+          }
+
+          /* Create the settings object for this table and set some of the default parameters */
+          var oSettings = $.extend(true, {}, DataTable.models.oSettings, {
+            "nTable":this,
+            "oApi":_that.oApi,
+            "oInit":oInit,
+            "sDestroyWidth":$(this).width(),
+            "sInstance":sId,
+            "sTableId":sId
+          });
+          DataTable.settings.push(oSettings);
+
+          // Need to add the instance after the instance after the settings object has been added
+          // to the settings array, so we can self reference the table instance if more than one
+          oSettings.oInstance = (_that.length === 1) ? _that : $(this).dataTable();
+
+          /* Setting up the initialisation object */
+          if (!oInit) {
+            oInit = {};
+          }
+
+          // Backwards compatibility, before we apply all the defaults
+          if (oInit.oLanguage) {
+            _fnLanguageCompat(oInit.oLanguage);
+          }
+
+          oInit = _fnExtend($.extend(true, {}, DataTable.defaults), oInit);
+
+          // Map the initialisation options onto the settings object
+          _fnMap(oSettings.oFeatures, oInit, "bPaginate");
+          _fnMap(oSettings.oFeatures, oInit, "bLengthChange");
+          _fnMap(oSettings.oFeatures, oInit, "bFilter");
+          _fnMap(oSettings.oFeatures, oInit, "bSort");
+          _fnMap(oSettings.oFeatures, oInit, "bInfo");
+          _fnMap(oSettings.oFeatures, oInit, "bProcessing");
+          _fnMap(oSettings.oFeatures, oInit, "bAutoWidth");
+          _fnMap(oSettings.oFeatures, oInit, "bSortClasses");
+          _fnMap(oSettings.oFeatures, oInit, "bServerSide");
+          _fnMap(oSettings.oFeatures, oInit, "bDeferRender");
+          _fnMap(oSettings.oScroll, oInit, "sScrollX", "sX");
+          _fnMap(oSettings.oScroll, oInit, "sScrollXInner", "sXInner");
+          _fnMap(oSettings.oScroll, oInit, "sScrollY", "sY");
+          _fnMap(oSettings.oScroll, oInit, "bScrollCollapse", "bCollapse");
+          _fnMap(oSettings.oScroll, oInit, "bScrollInfinite", "bInfinite");
+          _fnMap(oSettings.oScroll, oInit, "iScrollLoadGap", "iLoadGap");
+          _fnMap(oSettings.oScroll, oInit, "bScrollAutoCss", "bAutoCss");
+          _fnMap(oSettings, oInit, "asStripeClasses");
+          _fnMap(oSettings, oInit, "asStripClasses", "asStripeClasses"); // legacy
+          _fnMap(oSettings, oInit, "fnServerData");
+          _fnMap(oSettings, oInit, "fnFormatNumber");
+          _fnMap(oSettings, oInit, "sServerMethod");
+          _fnMap(oSettings, oInit, "aaSorting");
+          _fnMap(oSettings, oInit, "aaSortingFixed");
+          _fnMap(oSettings, oInit, "aLengthMenu");
+          _fnMap(oSettings, oInit, "sPaginationType");
+          _fnMap(oSettings, oInit, "sAjaxSource");
+          _fnMap(oSettings, oInit, "sAjaxDataProp");
+          _fnMap(oSettings, oInit, "iCookieDuration");
+          _fnMap(oSettings, oInit, "sCookiePrefix");
+          _fnMap(oSettings, oInit, "sDom");
+          _fnMap(oSettings, oInit, "bSortCellsTop");
+          _fnMap(oSettings, oInit, "iTabIndex");
+          _fnMap(oSettings, oInit, "oSearch", "oPreviousSearch");
+          _fnMap(oSettings, oInit, "aoSearchCols", "aoPreSearchCols");
+          _fnMap(oSettings, oInit, "iDisplayLength", "_iDisplayLength");
+          _fnMap(oSettings, oInit, "bJQueryUI", "bJUI");
+          _fnMap(oSettings, oInit, "fnCookieCallback");
+          _fnMap(oSettings, oInit, "fnStateLoad");
+          _fnMap(oSettings, oInit, "fnStateSave");
+          _fnMap(oSettings.oLanguage, oInit, "fnInfoCallback");
+
+          /* Callback functions which are array driven */
+          _fnCallbackReg(oSettings, 'aoDrawCallback', oInit.fnDrawCallback, 'user');
+          _fnCallbackReg(oSettings, 'aoServerParams', oInit.fnServerParams, 'user');
+          _fnCallbackReg(oSettings, 'aoStateSaveParams', oInit.fnStateSaveParams, 'user');
+          _fnCallbackReg(oSettings, 'aoStateLoadParams', oInit.fnStateLoadParams, 'user');
+          _fnCallbackReg(oSettings, 'aoStateLoaded', oInit.fnStateLoaded, 'user');
+          _fnCallbackReg(oSettings, 'aoRowCallback', oInit.fnRowCallback, 'user');
+          _fnCallbackReg(oSettings, 'aoRowCreatedCallback', oInit.fnCreatedRow, 'user');
+          _fnCallbackReg(oSettings, 'aoHeaderCallback', oInit.fnHeaderCallback, 'user');
+          _fnCallbackReg(oSettings, 'aoFooterCallback', oInit.fnFooterCallback, 'user');
+          _fnCallbackReg(oSettings, 'aoInitComplete', oInit.fnInitComplete, 'user');
+          _fnCallbackReg(oSettings, 'aoPreDrawCallback', oInit.fnPreDrawCallback, 'user');
+
+          if (oSettings.oFeatures.bServerSide && oSettings.oFeatures.bSort &&
+            oSettings.oFeatures.bSortClasses) {
+            /* Enable sort classes for server-side processing. Safe to do it here, since server-side
+             * processing must be enabled by the developer
+             */
+            _fnCallbackReg(oSettings, 'aoDrawCallback', _fnSortingClasses, 'server_side_sort_classes');
+          }
+          else if (oSettings.oFeatures.bDeferRender) {
+            _fnCallbackReg(oSettings, 'aoDrawCallback', _fnSortingClasses, 'defer_sort_classes');
+          }
+
+          if (oInit.bJQueryUI) {
+            /* Use the JUI classes object for display. You could clone the oStdClasses object if 
+             * you want to have multiple tables with multiple independent classes 
+             */
+            $.extend(oSettings.oClasses, DataTable.ext.oJUIClasses);
+
+            if (oInit.sDom === DataTable.defaults.sDom && DataTable.defaults.sDom === "lfrtip") {
+              /* Set the DOM to use a layout suitable for jQuery UI's theming */
+              oSettings.sDom = '<"H"lfr>t<"F"ip>';
+            }
+          }
+          else {
+            $.extend(oSettings.oClasses, DataTable.ext.oStdClasses);
+          }
+          $(this).addClass(oSettings.oClasses.sTable);
+
+          /* Calculate the scroll bar width and cache it for use later on */
+          if (oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "") {
+            oSettings.oScroll.iBarWidth = _fnScrollBarWidth();
+          }
+
+          if (oSettings.iInitDisplayStart === undefined) {
+            /* Display start point, taking into account the save saving */
+            oSettings.iInitDisplayStart = oInit.iDisplayStart;
+            oSettings._iDisplayStart = oInit.iDisplayStart;
+          }
+
+          /* Must be done after everything which can be overridden by a cookie! */
+          if (oInit.bStateSave) {
+            oSettings.oFeatures.bStateSave = true;
+            _fnLoadState(oSettings, oInit);
+            _fnCallbackReg(oSettings, 'aoDrawCallback', _fnSaveState, 'state_save');
+          }
+
+          if (oInit.iDeferLoading !== null) {
+            oSettings.bDeferLoading = true;
+            var tmp = $.isArray(oInit.iDeferLoading);
+            oSettings._iRecordsDisplay = tmp ? oInit.iDeferLoading[0] : oInit.iDeferLoading;
+            oSettings._iRecordsTotal = tmp ? oInit.iDeferLoading[1] : oInit.iDeferLoading;
+          }
+
+          if (oInit.aaData !== null) {
+            bUsePassedData = true;
+          }
+
+          /* Language definitions */
+          if (oInit.oLanguage.sUrl !== "") {
+            /* Get the language definitions from a file - because this Ajax call makes the language
+             * get async to the remainder of this function we use bInitHandedOff to indicate that 
+             * _fnInitialise will be fired by the returned Ajax handler, rather than the constructor
+             */
+            oSettings.oLanguage.sUrl = oInit.oLanguage.sUrl;
+            $.getJSON(oSettings.oLanguage.sUrl, null, function (json) {
+              _fnLanguageCompat(json);
+              $.extend(true, oSettings.oLanguage, oInit.oLanguage, json);
+              _fnInitialise(oSettings);
+            });
+            bInitHandedOff = true;
+          }
+          else {
+            $.extend(true, oSettings.oLanguage, oInit.oLanguage);
+          }
+
+
+          /*
+           * Stripes
+           */
+          if (oInit.asStripeClasses === null) {
+            oSettings.asStripeClasses = [
+              oSettings.oClasses.sStripeOdd,
+              oSettings.oClasses.sStripeEven
+            ];
+          }
+
+          /* Remove row stripe classes if they are already on the table row */
+          iLen = oSettings.asStripeClasses.length;
+          oSettings.asDestroyStripes = [];
+          if (iLen) {
+            var bStripeRemove = false;
+            var anRows = $(this).children('tbody').children('tr:lt(' + iLen + ')');
+            for (i = 0; i < iLen; i++) {
+              if (anRows.hasClass(oSettings.asStripeClasses[i])) {
+                bStripeRemove = true;
+
+                /* Store the classes which we are about to remove so they can be re-added on destroy */
+                oSettings.asDestroyStripes.push(oSettings.asStripeClasses[i]);
+              }
+            }
+
+            if (bStripeRemove) {
+              anRows.removeClass(oSettings.asStripeClasses.join(' '));
+            }
+          }
+
+          /*
+           * Columns
+           * See if we should load columns automatically or use defined ones
+           */
+          var anThs = [];
+          var aoColumnsInit;
+          var nThead = this.getElementsByTagName('thead');
+          if (nThead.length !== 0) {
+            _fnDetectHeader(oSettings.aoHeader, nThead[0]);
+            anThs = _fnGetUniqueThs(oSettings);
+          }
+
+          /* If not given a column array, generate one with nulls */
+          if (oInit.aoColumns === null) {
+            aoColumnsInit = [];
+            for (i = 0, iLen = anThs.length; i < iLen; i++) {
+              aoColumnsInit.push(null);
+            }
+          }
+          else {
+            aoColumnsInit = oInit.aoColumns;
+          }
+
+          /* Add the columns */
+          for (i = 0, iLen = aoColumnsInit.length; i < iLen; i++) {
+            /* Short cut - use the loop to check if we have column visibility state to restore */
+            if (oInit.saved_aoColumns !== undefined && oInit.saved_aoColumns.length == iLen) {
+              if (aoColumnsInit[i] === null) {
+                aoColumnsInit[i] = {};
+              }
+              aoColumnsInit[i].bVisible = oInit.saved_aoColumns[i].bVisible;
+            }
+
+            _fnAddColumn(oSettings, anThs ? anThs[i] : null);
+          }
+
+          /* Apply the column definitions */
+          _fnApplyColumnDefs(oSettings, oInit.aoColumnDefs, aoColumnsInit, function (iCol, oDef) {
+            _fnColumnOptions(oSettings, iCol, oDef);
+          });
+
+
+          /*
+           * Sorting
+           * Check the aaSorting array
+           */
+          for (i = 0, iLen = oSettings.aaSorting.length; i < iLen; i++) {
+            if (oSettings.aaSorting[i][0] >= oSettings.aoColumns.length) {
+              oSettings.aaSorting[i][0] = 0;
+            }
+            var oColumn = oSettings.aoColumns[ oSettings.aaSorting[i][0] ];
+
+            /* Add a default sorting index */
+            if (oSettings.aaSorting[i][2] === undefined) {
+              oSettings.aaSorting[i][2] = 0;
+            }
+
+            /* If aaSorting is not defined, then we use the first indicator in asSorting */
+            if (oInit.aaSorting === undefined && oSettings.saved_aaSorting === undefined) {
+              oSettings.aaSorting[i][1] = oColumn.asSorting[0];
+            }
+
+            /* Set the current sorting index based on aoColumns.asSorting */
+            for (j = 0, jLen = oColumn.asSorting.length; j < jLen; j++) {
+              if (oSettings.aaSorting[i][1] == oColumn.asSorting[j]) {
+                oSettings.aaSorting[i][2] = j;
+                break;
+              }
+            }
+          }
+
+          /* Do a first pass on the sorting classes (allows any size changes to be taken into
+           * account, and also will apply sorting disabled classes if disabled
+           */
+          _fnSortingClasses(oSettings);
+
+
+          /*
+           * Final init
+           * Cache the header, body and footer as required, creating them if needed
+           */
+
+          /* Browser support detection */
+          _fnBrowserDetect(oSettings);
+
+          // Work around for Webkit bug 83867 - store the caption-side before removing from doc
+          var captions = $(this).children('caption').each(function () {
+            this._captionSide = $(this).css('caption-side');
+          });
+
+          var thead = $(this).children('thead');
+          if (thead.length === 0) {
+            thead = [ document.createElement('thead') ];
+            this.appendChild(thead[0]);
+          }
+          oSettings.nTHead = thead[0];
+
+          var tbody = $(this).children('tbody');
+          if (tbody.length === 0) {
+            tbody = [ document.createElement('tbody') ];
+            this.appendChild(tbody[0]);
+          }
+          oSettings.nTBody = tbody[0];
+          oSettings.nTBody.setAttribute("role", "alert");
+          oSettings.nTBody.setAttribute("aria-live", "polite");
+          oSettings.nTBody.setAttribute("aria-relevant", "all");
+
+          var tfoot = $(this).children('tfoot');
+          if (tfoot.length === 0 && captions.length > 0 && (oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "")) {
+            // If we are a scrolling table, and no footer has been given, then we need to create
+            // a tfoot element for the caption element to be appended to
+            tfoot = [ document.createElement('tfoot') ];
+            this.appendChild(tfoot[0]);
+          }
+
+          if (tfoot.length > 0) {
+            oSettings.nTFoot = tfoot[0];
+            _fnDetectHeader(oSettings.aoFooter, oSettings.nTFoot);
+          }
+
+          /* Check if there is data passing into the constructor */
+          if (bUsePassedData) {
+            for (i = 0; i < oInit.aaData.length; i++) {
+              _fnAddData(oSettings, oInit.aaData[ i ]);
+            }
+          }
+          else {
+            /* Grab the data from the page */
+            _fnGatherData(oSettings);
+          }
+
+          /* Copy the data index array */
+          oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
+
+          /* Initialisation complete - table can be drawn */
+          oSettings.bInitialised = true;
+
+          /* Check if we need to initialise the table (it might not have been handed off to the
+           * language processor)
+           */
+          if (bInitHandedOff === false) {
+            _fnInitialise(oSettings);
+          }
+        });
+        _that = null;
+        return this;
+      };
+
+
+      /**
+       * Provide a common method for plug-ins to check the version of DataTables being used, in order
+       * to ensure compatibility.
+       *  @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note that the
+       *    formats "X" and "X.Y" are also acceptable.
+       *  @returns {boolean} true if this version of DataTables is greater or equal to the required
+       *    version, or false if this version of DataTales is not suitable
+       *  @static
+       *  @dtopt API-Static
+       *
+       *  @example
+       *    alert( $.fn.dataTable.fnVersionCheck( '1.9.0' ) );
+       */
+      DataTable.fnVersionCheck = function (sVersion) {
+        /* This is cheap, but effective */
+        var fnZPad = function (Zpad, count) {
+          while (Zpad.length < count) {
+            Zpad += '0';
+          }
+          return Zpad;
+        };
+        var aThis = DataTable.ext.sVersion.split('.');
+        var aThat = sVersion.split('.');
+        var sThis = '', sThat = '';
+
+        for (var i = 0, iLen = aThat.length; i < iLen; i++) {
+          sThis += fnZPad(aThis[i], 3);
+          sThat += fnZPad(aThat[i], 3);
+        }
+
+        return parseInt(sThis, 10) >= parseInt(sThat, 10);
+      };
+
+
+      /**
+       * Check if a TABLE node is a DataTable table already or not.
+       *  @param {node} nTable The TABLE node to check if it is a DataTable or not (note that other
+       *    node types can be passed in, but will always return false).
+       *  @returns {boolean} true the table given is a DataTable, or false otherwise
+       *  @static
+       *  @dtopt API-Static
+       *
+       *  @example
+       *    var ex = document.getElementById('example');
+       *    if ( ! $.fn.DataTable.fnIsDataTable( ex ) ) {
+	 *      $(ex).dataTable();
+	 *    }
+       */
+      DataTable.fnIsDataTable = function (nTable) {
+        var o = DataTable.settings;
+
+        for (var i = 0; i < o.length; i++) {
+          if (o[i].nTable === nTable || o[i].nScrollHead === nTable || o[i].nScrollFoot === nTable) {
+            return true;
+          }
+        }
+
+        return false;
+      };
+
+
+      /**
+       * Get all DataTable tables that have been initialised - optionally you can select to
+       * get only currently visible tables.
+       *  @param {boolean} [bVisible=false] Flag to indicate if you want all (default) or
+       *    visible tables only.
+       *  @returns {array} Array of TABLE nodes (not DataTable instances) which are DataTables
+       *  @static
+       *  @dtopt API-Static
+       *
+       *  @example
+       *    var table = $.fn.dataTable.fnTables(true);
+       *    if ( table.length > 0 ) {
+	 *      $(table).dataTable().fnAdjustColumnSizing();
+	 *    }
+       */
+      DataTable.fnTables = function (bVisible) {
+        var out = [];
+
+        jQuery.each(DataTable.settings, function (i, o) {
+          if (!bVisible || (bVisible === true && $(o.nTable).is(':visible'))) {
+            out.push(o.nTable);
+          }
+        });
+
+        return out;
+      };
+
+
+      /**
+       * Version string for plug-ins to check compatibility. Allowed format is
+       * a.b.c.d.e where: a:int, b:int, c:int, d:string(dev|beta), e:int. d and
+       * e are optional
+       *  @member
+       *  @type string
+       *  @default Version number
+       */
+      DataTable.version = "1.9.4";
+
+      /**
+       * Private data store, containing all of the settings objects that are created for the
+       * tables on a given page.
+       *
+       * Note that the <i>DataTable.settings</i> object is aliased to <i>jQuery.fn.dataTableExt</i>
+       * through which it may be accessed and manipulated, or <i>jQuery.fn.dataTable.settings</i>.
+       *  @member
+       *  @type array
+       *  @default []
+       *  @private
+       */
+      DataTable.settings = [];
+
+      /**
+       * Object models container, for the various models that DataTables has available
+       * to it. These models define the objects that are used to hold the active state
+       * and configuration of the table.
+       *  @namespace
+       */
+      DataTable.models = {};
+
+
+      /**
+       * DataTables extension options and plug-ins. This namespace acts as a collection "area"
+       * for plug-ins that can be used to extend the default DataTables behaviour - indeed many
+       * of the build in methods use this method to provide their own capabilities (sorting methods
+       * for example).
+       *
+       * Note that this namespace is aliased to jQuery.fn.dataTableExt so it can be readily accessed
+       * and modified by plug-ins.
+       *  @namespace
+       */
+      DataTable.models.ext = {
+        /**
+         * Plug-in filtering functions - this method of filtering is complimentary to the default
+         * type based filtering, and a lot more comprehensive as it allows you complete control
+         * over the filtering logic. Each element in this array is a function (parameters
+         * described below) that is called for every row in the table, and your logic decides if
+         * it should be included in the filtered data set or not.
+         *   <ul>
+         *     <li>
+         *       Function input parameters:
+         *       <ul>
+         *         <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
+         *         <li>{array|object} Data for the row to be processed (same as the original format
+         *           that was passed in as the data source, or an array from a DOM data source</li>
+         *         <li>{int} Row index in aoData ({@link DataTable.models.oSettings.aoData}), which can
+         *           be useful to retrieve the TR element if you need DOM interaction.</li>
+         *       </ul>
+         *     </li>
+         *     <li>
+         *       Function return:
+         *       <ul>
+         *         <li>{boolean} Include the row in the filtered result set (true) or not (false)</li>
+         *       </ul>
+         *     </il>
+         *   </ul>
+         *  @type array
+         *  @default []
+         *
+         *  @example
+         *    // The following example shows custom filtering being applied to the fourth column (i.e.
+         *    // the aData[3] index) based on two input values from the end-user, matching the data in
+         *    // a certain range.
+         *    $.fn.dataTableExt.afnFiltering.push(
+         *      function( oSettings, aData, iDataIndex ) {
+		 *        var iMin = document.getElementById('min').value * 1;
+		 *        var iMax = document.getElementById('max').value * 1;
+		 *        var iVersion = aData[3] == "-" ? 0 : aData[3]*1;
+		 *        if ( iMin == "" && iMax == "" ) {
+		 *          return true;
+		 *        }
+		 *        else if ( iMin == "" && iVersion < iMax ) {
+		 *          return true;
+		 *        }
+		 *        else if ( iMin < iVersion && "" == iMax ) {
+		 *          return true;
+		 *        }
+		 *        else if ( iMin < iVersion && iVersion < iMax ) {
+		 *          return true;
+		 *        }
+		 *        return false;
+		 *      }
+         *    );
+         */
+        "afnFiltering":[],
+
+
+        /**
+         * Plug-in sorting functions - this method of sorting is complimentary to the default type
+         * based sorting that DataTables does automatically, allowing much greater control over the
+         * the data that is being used to sort a column. This is useful if you want to do sorting
+         * based on live data (for example the contents of an 'input' element) rather than just the
+         * static string that DataTables knows of. The way these plug-ins work is that you create
+         * an array of the values you wish to be sorted for the column in question and then return
+         * that array. Which pre-sorting function is run here depends on the sSortDataType parameter
+         * that is used for the column (if any). This is the corollary of <i>ofnSearch</i> for sort
+         * data.
+         *   <ul>
+         *     <li>
+         *       Function input parameters:
+         *       <ul>
+         *         <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
+         *         <li>{int} Target column index</li>
+         *       </ul>
+         *     </li>
+         *     <li>
+         *       Function return:
+         *       <ul>
+         *         <li>{array} Data for the column to be sorted upon</li>
+         *       </ul>
+         *     </il>
+         *   </ul>
+         *
+         * Note that as of v1.9, it is typically preferable to use <i>mData</i> to prepare data for
+         * the different uses that DataTables can put the data to. Specifically <i>mData</i> when
+         * used as a function will give you a 'type' (sorting, filtering etc) that you can use to
+         * prepare the data as required for the different types. As such, this method is deprecated.
+         *  @type array
+         *  @default []
+         *  @deprecated
+         *
+         *  @example
+         *    // Updating the cached sorting information with user entered values in HTML input elements
+         *    jQuery.fn.dataTableExt.afnSortData['dom-text'] = function ( oSettings, iColumn )
+         *    {
+		 *      var aData = [];
+		 *      $( 'td:eq('+iColumn+') input', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
+		 *        aData.push( this.value );
+		 *      } );
+		 *      return aData;
+		 *    }
+         */
+        "afnSortData":[],
+
+
+        /**
+         * Feature plug-ins - This is an array of objects which describe the feature plug-ins that are
+         * available to DataTables. These feature plug-ins are accessible through the sDom initialisation
+         * option. As such, each feature plug-in must describe a function that is used to initialise
+         * itself (fnInit), a character so the feature can be enabled by sDom (cFeature) and the name
+         * of the feature (sFeature). Thus the objects attached to this method must provide:
+         *   <ul>
+         *     <li>{function} fnInit Initialisation of the plug-in
+         *       <ul>
+         *         <li>
+         *           Function input parameters:
+         *           <ul>
+         *             <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
+         *           </ul>
+         *         </li>
+         *         <li>
+         *           Function return:
+         *           <ul>
+         *             <li>{node|null} The element which contains your feature. Note that the return
+         *                may also be void if your plug-in does not require to inject any DOM elements
+         *                into DataTables control (sDom) - for example this might be useful when
+         *                developing a plug-in which allows table control via keyboard entry.</li>
+         *           </ul>
+         *         </il>
+         *       </ul>
+         *     </li>
+         *     <li>{character} cFeature Character that will be matched in sDom - case sensitive</li>
+         *     <li>{string} sFeature Feature name</li>
+         *   </ul>
+         *  @type array
+         *  @default []
+         *
+         *  @example
+         *    // How TableTools initialises itself.
+         *    $.fn.dataTableExt.aoFeatures.push( {
+		 *      "fnInit": function( oSettings ) {
+		 *        return new TableTools( { "oDTSettings": oSettings } );
+		 *      },
+		 *      "cFeature": "T",
+		 *      "sFeature": "TableTools"
+		 *    } );
+         */
+        "aoFeatures":[],
+
+
+        /**
+         * Type detection plug-in functions - DataTables utilises types to define how sorting and
+         * filtering behave, and types can be either  be defined by the developer (sType for the
+         * column) or they can be automatically detected by the methods in this array. The functions
+         * defined in the array are quite simple, taking a single parameter (the data to analyse)
+         * and returning the type if it is a known type, or null otherwise.
+         *   <ul>
+         *     <li>
+         *       Function input parameters:
+         *       <ul>
+         *         <li>{*} Data from the column cell to be analysed</li>
+         *       </ul>
+         *     </li>
+         *     <li>
+         *       Function return:
+         *       <ul>
+         *         <li>{string|null} Data type detected, or null if unknown (and thus pass it
+         *           on to the other type detection functions.</li>
+         *       </ul>
+         *     </il>
+         *   </ul>
+         *  @type array
+         *  @default []
+         *
+         *  @example
+         *    // Currency type detection plug-in:
+         *    jQuery.fn.dataTableExt.aTypes.push(
+         *      function ( sData ) {
+		 *        var sValidChars = "0123456789.-";
+		 *        var Char;
+		 *        
+		 *        // Check the numeric part
+		 *        for ( i=1 ; i<sData.length ; i++ ) {
+		 *          Char = sData.charAt(i); 
+		 *          if (sValidChars.indexOf(Char) == -1) {
+		 *            return null;
+		 *          }
+		 *        }
+		 *        
+		 *        // Check prefixed by currency
+		 *        if ( sData.charAt(0) == '$' || sData.charAt(0) == '&pound;' ) {
+		 *          return 'currency';
+		 *        }
+		 *        return null;
+		 *      }
+         *    );
+         */
+        "aTypes":[],
+
+
+        /**
+         * Provide a common method for plug-ins to check the version of DataTables being used,
+         * in order to ensure compatibility.
+         *  @type function
+         *  @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note
+         *    that the formats "X" and "X.Y" are also acceptable.
+         *  @returns {boolean} true if this version of DataTables is greater or equal to the
+         *    required version, or false if this version of DataTales is not suitable
+         *
+         *  @example
+         *    $(document).ready(function() {
+		 *      var oTable = $('#example').dataTable();
+		 *      alert( oTable.fnVersionCheck( '1.9.0' ) );
+		 *    } );
+         */
+        "fnVersionCheck":DataTable.fnVersionCheck,
+
+
+        /**
+         * Index for what 'this' index API functions should use
+         *  @type int
+         *  @default 0
+         */
+        "iApiIndex":0,
+
+
+        /**
+         * Pre-processing of filtering data plug-ins - When you assign the sType for a column
+         * (or have it automatically detected for you by DataTables or a type detection plug-in),
+         * you will typically be using this for custom sorting, but it can also be used to provide
+         * custom filtering by allowing you to pre-processing the data and returning the data in
+         * the format that should be filtered upon. This is done by adding functions this object
+         * with a parameter name which matches the sType for that target column. This is the
+         * corollary of <i>afnSortData</i> for filtering data.
+         *   <ul>
+         *     <li>
+         *       Function input parameters:
+         *       <ul>
+         *         <li>{*} Data from the column cell to be prepared for filtering</li>
+         *       </ul>
+         *     </li>
+         *     <li>
+         *       Function return:
+         *       <ul>
+         *         <li>{string|null} Formatted string that will be used for the filtering.</li>
+         *       </ul>
+         *     </il>
+         *   </ul>
+         *
+         * Note that as of v1.9, it is typically preferable to use <i>mData</i> to prepare data for
+         * the different uses that DataTables can put the data to. Specifically <i>mData</i> when
+         * used as a function will give you a 'type' (sorting, filtering etc) that you can use to
+         * prepare the data as required for the different types. As such, this method is deprecated.
+         *  @type object
+         *  @default {}
+         *  @deprecated
+         *
+         *  @example
+         *    $.fn.dataTableExt.ofnSearch['title-numeric'] = function ( sData ) {
+		 *      return sData.replace(/\n/g," ").replace( /<.*?>/g, "" );
+		 *    }
+         */
+        "ofnSearch":{},
+
+
+        /**
+         * Container for all private functions in DataTables so they can be exposed externally
+         *  @type object
+         *  @default {}
+         */
+        "oApi":{},
+
+
+        /**
+         * Storage for the various classes that DataTables uses
+         *  @type object
+         *  @default {}
+         */
+        "oStdClasses":{},
+
+
+        /**
+         * Storage for the various classes that DataTables uses - jQuery UI suitable
+         *  @type object
+         *  @default {}
+         */
+        "oJUIClasses":{},
+
+
+        /**
+         * Pagination plug-in methods - The style and controls of the pagination can significantly
+         * impact on how the end user interacts with the data in your table, and DataTables allows
+         * the addition of pagination controls by extending this object, which can then be enabled
+         * through the <i>sPaginationType</i> initialisation parameter. Each pagination type that
+         * is added is an object (the property name of which is what <i>sPaginationType</i> refers
+         * to) that has two properties, both methods that are used by DataTables to update the
+         * control's state.
+         *   <ul>
+         *     <li>
+         *       fnInit -  Initialisation of the paging controls. Called only during initialisation
+         *         of the table. It is expected that this function will add the required DOM elements
+         *         to the page for the paging controls to work. The element pointer
+         *         'oSettings.aanFeatures.p' array is provided by DataTables to contain the paging
+         *         controls (note that this is a 2D array to allow for multiple instances of each
+         *         DataTables DOM element). It is suggested that you add the controls to this element
+         *         as children
+         *       <ul>
+         *         <li>
+         *           Function input parameters:
+         *           <ul>
+         *             <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
+         *             <li>{node} Container into which the pagination controls must be inserted</li>
+         *             <li>{function} Draw callback function - whenever the controls cause a page
+         *               change, this method must be called to redraw the table.</li>
+         *           </ul>
+         *         </li>
+         *         <li>
+         *           Function return:
+         *           <ul>
+         *             <li>No return required</li>
+         *           </ul>
+         *         </il>
+         *       </ul>
+         *     </il>
+         *     <li>
+         *       fnInit -  This function is called whenever the paging status of the table changes and is
+         *         typically used to update classes and/or text of the paging controls to reflex the new
+         *         status.
+         *       <ul>
+         *         <li>
+         *           Function input parameters:
+         *           <ul>
+         *             <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
+         *             <li>{function} Draw callback function - in case you need to redraw the table again
+         *               or attach new event listeners</li>
+         *           </ul>
+         *         </li>
+         *         <li>
+         *           Function return:
+         *           <ul>
+         *             <li>No return required</li>
+         *           </ul>
+         *         </il>
+         *       </ul>
+         *     </il>
+         *   </ul>
+         *  @type object
+         *  @default {}
+         *
+         *  @example
+         *    $.fn.dataTableExt.oPagination.four_button = {
+		 *      "fnInit": function ( oSettings, nPaging, fnCallbackDraw ) {
+		 *        nFirst = document.createElement( 'span' );
+		 *        nPrevious = document.createElement( 'span' );
+		 *        nNext = document.createElement( 'span' );
+		 *        nLast = document.createElement( 'span' );
+		 *        
+		 *        nFirst.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sFirst ) );
+		 *        nPrevious.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sPrevious ) );
+		 *        nNext.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sNext ) );
+		 *        nLast.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sLast ) );
+		 *        
+		 *        nFirst.className = "paginate_button first";
+		 *        nPrevious.className = "paginate_button previous";
+		 *        nNext.className="paginate_button next";
+		 *        nLast.className = "paginate_button last";
+		 *        
+		 *        nPaging.appendChild( nFirst );
+		 *        nPaging.appendChild( nPrevious );
+		 *        nPaging.appendChild( nNext );
+		 *        nPaging.appendChild( nLast );
+		 *        
+		 *        $(nFirst).click( function () {
+		 *          oSettings.oApi._fnPageChange( oSettings, "first" );
+		 *          fnCallbackDraw( oSettings );
+		 *        } );
+		 *        
+		 *        $(nPrevious).click( function() {
+		 *          oSettings.oApi._fnPageChange( oSettings, "previous" );
+		 *          fnCallbackDraw( oSettings );
+		 *        } );
+		 *        
+		 *        $(nNext).click( function() {
+		 *          oSettings.oApi._fnPageChange( oSettings, "next" );
+		 *          fnCallbackDraw( oSettings );
+		 *        } );
+		 *        
+		 *        $(nLast).click( function() {
+		 *          oSettings.oApi._fnPageChange( oSettings, "last" );
+		 *          fnCallbackDraw( oSettings );
+		 *        } );
+		 *        
+		 *        $(nFirst).bind( 'selectstart', function () { return false; } );
+		 *        $(nPrevious).bind( 'selectstart', function () { return false; } );
+		 *        $(nNext).bind( 'selectstart', function () { return false; } );
+		 *        $(nLast).bind( 'selectstart', function () { return false; } );
+		 *      },
+		 *      
+		 *      "fnUpdate": function ( oSettings, fnCallbackDraw ) {
+		 *        if ( !oSettings.aanFeatures.p ) {
+		 *          return;
+		 *        }
+		 *        
+		 *        // Loop over each instance of the pager
+		 *        var an = oSettings.aanFeatures.p;
+		 *        for ( var i=0, iLen=an.length ; i<iLen ; i++ ) {
+		 *          var buttons = an[i].getElementsByTagName('span');
+		 *          if ( oSettings._iDisplayStart === 0 ) {
+		 *            buttons[0].className = "paginate_disabled_previous";
+		 *            buttons[1].className = "paginate_disabled_previous";
+		 *          }
+		 *          else {
+		 *            buttons[0].className = "paginate_enabled_previous";
+		 *            buttons[1].className = "paginate_enabled_previous";
+		 *          }
+		 *          
+		 *          if ( oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay() ) {
+		 *            buttons[2].className = "paginate_disabled_next";
+		 *            buttons[3].className = "paginate_disabled_next";
+		 *          }
+		 *          else {
+		 *            buttons[2].className = "paginate_enabled_next";
+		 *            buttons[3].className = "paginate_enabled_next";
+		 *          }
+		 *        }
+		 *      }
+		 *    };
+         */
+        "oPagination":{},
+
+
+        /**
+         * Sorting plug-in methods - Sorting in DataTables is based on the detected type of the
+         * data column (you can add your own type detection functions, or override automatic
+         * detection using sType). With this specific type given to the column, DataTables will
+         * apply the required sort from the functions in the object. Each sort type must provide
+         * two mandatory methods, one each for ascending and descending sorting, and can optionally
+         * provide a pre-formatting method that will help speed up sorting by allowing DataTables
+         * to pre-format the sort data only once (rather than every time the actual sort functions
+         * are run). The two sorting functions are typical Javascript sort methods:
+         *   <ul>
+         *     <li>
+         *       Function input parameters:
+         *       <ul>
+         *         <li>{*} Data to compare to the second parameter</li>
+         *         <li>{*} Data to compare to the first parameter</li>
+         *       </ul>
+         *     </li>
+         *     <li>
+         *       Function return:
+         *       <ul>
+         *         <li>{int} Sorting match: <0 if first parameter should be sorted lower than
+         *           the second parameter, ===0 if the two parameters are equal and >0 if
+         *           the first parameter should be sorted height than the second parameter.</li>
+         *       </ul>
+         *     </il>
+         *   </ul>
+         *  @type object
+         *  @default {}
+         *
+         *  @example
+         *    // Case-sensitive string sorting, with no pre-formatting method
+         *    $.extend( $.fn.dataTableExt.oSort, {
+		 *      "string-case-asc": function(x,y) {
+		 *        return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+		 *      },
+		 *      "string-case-desc": function(x,y) {
+		 *        return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+		 *      }
+		 *    } );
+         *
+         *  @example
+         *    // Case-insensitive string sorting, with pre-formatting
+         *    $.extend( $.fn.dataTableExt.oSort, {
+		 *      "string-pre": function(x) {
+		 *        return x.toLowerCase();
+		 *      },
+		 *      "string-asc": function(x,y) {
+		 *        return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+		 *      },
+		 *      "string-desc": function(x,y) {
+		 *        return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+		 *      }
+		 *    } );
+         */
+        "oSort":{},
+
+
+        /**
+         * Version string for plug-ins to check compatibility. Allowed format is
+         * a.b.c.d.e where: a:int, b:int, c:int, d:string(dev|beta), e:int. d and
+         * e are optional
+         *  @type string
+         *  @default Version number
+         */
+        "sVersion":DataTable.version,
+
+
+        /**
+         * How should DataTables report an error. Can take the value 'alert' or 'throw'
+         *  @type string
+         *  @default alert
+         */
+        "sErrMode":"alert",
+
+
+        /**
+         * Store information for DataTables to access globally about other instances
+         *  @namespace
+         *  @private
+         */
+        "_oExternConfig":{
+          /* int:iNextUnique - next unique number for an instance */
+          "iNextUnique":0
+        }
+      };
+
+
+      /**
+       * Template object for the way in which DataTables holds information about
+       * search information for the global filter and individual column filters.
+       *  @namespace
+       */
+      DataTable.models.oSearch = {
+        /**
+         * Flag to indicate if the filtering should be case insensitive or not
+         *  @type boolean
+         *  @default true
+         */
+        "bCaseInsensitive":true,
+
+        /**
+         * Applied search term
+         *  @type string
+         *  @default <i>Empty string</i>
+         */
+        "sSearch":"",
+
+        /**
+         * Flag to indicate if the search term should be interpreted as a
+         * regular expression (true) or not (false) and therefore and special
+         * regex characters escaped.
+         *  @type boolean
+         *  @default false
+         */
+        "bRegex":false,
+
+        /**
+         * Flag to indicate if DataTables is to use its smart filtering or not.
+         *  @type boolean
+         *  @default true
+         */
+        "bSmart":true
+      };
+
+
+      /**
+       * Template object for the way in which DataTables holds information about
+       * each individual row. This is the object format used for the settings
+       * aoData array.
+       *  @namespace
+       */
+      DataTable.models.oRow = {
+        /**
+         * TR element for the row
+         *  @type node
+         *  @default null
+         */
+        "nTr":null,
+
+        /**
+         * Data object from the original data source for the row. This is either
+         * an array if using the traditional form of DataTables, or an object if
+         * using mData options. The exact type will depend on the passed in
+         * data from the data source, or will be an array if using DOM a data
+         * source.
+         *  @type array|object
+         *  @default []
+         */
+        "_aData":[],
+
+        /**
+         * Sorting data cache - this array is ostensibly the same length as the
+         * number of columns (although each index is generated only as it is
+         * needed), and holds the data that is used for sorting each column in the
+         * row. We do this cache generation at the start of the sort in order that
+         * the formatting of the sort data need be done only once for each cell
+         * per sort. This array should not be read from or written to by anything
+         * other than the master sorting methods.
+         *  @type array
+         *  @default []
+         *  @private
+         */
+        "_aSortData":[],
+
+        /**
+         * Array of TD elements that are cached for hidden rows, so they can be
+         * reinserted into the table if a column is made visible again (or to act
+         * as a store if a column is made hidden). Only hidden columns have a
+         * reference in the array. For non-hidden columns the value is either
+         * undefined or null.
+         *  @type array nodes
+         *  @default []
+         *  @private
+         */
+        "_anHidden":[],
+
+        /**
+         * Cache of the class name that DataTables has applied to the row, so we
+         * can quickly look at this variable rather than needing to do a DOM check
+         * on className for the nTr property.
+         *  @type string
+         *  @default <i>Empty string</i>
+         *  @private
+         */
+        "_sRowStripe":""
+      };
+
+
+      /**
+       * Template object for the column information object in DataTables. This object
+       * is held in the settings aoColumns array and contains all the information that
+       * DataTables needs about each individual column.
+       *
+       * Note that this object is related to {@link DataTable.defaults.columns}
+       * but this one is the internal data store for DataTables's cache of columns.
+       * It should NOT be manipulated outside of DataTables. Any configuration should
+       * be done through the initialisation options.
+       *  @namespace
+       */
+      DataTable.models.oColumn = {
+        /**
+         * A list of the columns that sorting should occur on when this column
+         * is sorted. That this property is an array allows multi-column sorting
+         * to be defined for a column (for example first name / last name columns
+         * would benefit from this). The values are integers pointing to the
+         * columns to be sorted on (typically it will be a single integer pointing
+         * at itself, but that doesn't need to be the case).
+         *  @type array
+         */
+        "aDataSort":null,
+
+        /**
+         * Define the sorting directions that are applied to the column, in sequence
+         * as the column is repeatedly sorted upon - i.e. the first value is used
+         * as the sorting direction when the column if first sorted (clicked on).
+         * Sort it again (click again) and it will move on to the next index.
+         * Repeat until loop.
+         *  @type array
+         */
+        "asSorting":null,
+
+        /**
+         * Flag to indicate if the column is searchable, and thus should be included
+         * in the filtering or not.
+         *  @type boolean
+         */
+        "bSearchable":null,
+
+        /**
+         * Flag to indicate if the column is sortable or not.
+         *  @type boolean
+         */
+        "bSortable":null,
+
+        /**
+         * <code>Deprecated</code> When using fnRender, you have two options for what
+         * to do with the data, and this property serves as the switch. Firstly, you
+         * can have the sorting and filtering use the rendered value (true - default),
+         * or you can have the sorting and filtering us the original value (false).
+         *
+         * Please note that this option has now been deprecated and will be removed
+         * in the next version of DataTables. Please use mRender / mData rather than
+         * fnRender.
+         *  @type boolean
+         *  @deprecated
+         */
+        "bUseRendered":null,
+
+        /**
+         * Flag to indicate if the column is currently visible in the table or not
+         *  @type boolean
+         */
+        "bVisible":null,
+
+        /**
+         * Flag to indicate to the type detection method if the automatic type
+         * detection should be used, or if a column type (sType) has been specified
+         *  @type boolean
+         *  @default true
+         *  @private
+         */
+        "_bAutoType":true,
+
+        /**
+         * Developer definable function that is called whenever a cell is created (Ajax source,
+         * etc) or processed for input (DOM source). This can be used as a compliment to mRender
+         * allowing you to modify the DOM element (add background colour for example) when the
+         * element is available.
+         *  @type function
+         *  @param {element} nTd The TD node that has been created
+         *  @param {*} sData The Data for the cell
+         *  @param {array|object} oData The data for the whole row
+         *  @param {int} iRow The row index for the aoData data store
+         *  @default null
+         */
+        "fnCreatedCell":null,
+
+        /**
+         * Function to get data from a cell in a column. You should <b>never</b>
+         * access data directly through _aData internally in DataTables - always use
+         * the method attached to this property. It allows mData to function as
+         * required. This function is automatically assigned by the column
+         * initialisation method
+         *  @type function
+         *  @param {array|object} oData The data array/object for the array
+         *    (i.e. aoData[]._aData)
+         *  @param {string} sSpecific The specific data type you want to get -
+         *    'display', 'type' 'filter' 'sort'
+         *  @returns {*} The data for the cell from the given row's data
+         *  @default null
+         */
+        "fnGetData":null,
+
+        /**
+         * <code>Deprecated</code> Custom display function that will be called for the
+         * display of each cell in this column.
+         *
+         * Please note that this option has now been deprecated and will be removed
+         * in the next version of DataTables. Please use mRender / mData rather than
+         * fnRender.
+         *  @type function
+         *  @param {object} o Object with the following parameters:
+         *  @param {int}    o.iDataRow The row in aoData
+         *  @param {int}    o.iDataColumn The column in question
+         *  @param {array}  o.aData The data for the row in question
+         *  @param {object} o.oSettings The settings object for this DataTables instance
+         *  @returns {string} The string you which to use in the display
+         *  @default null
+         *  @deprecated
+         */
+        "fnRender":null,
+
+        /**
+         * Function to set data for a cell in the column. You should <b>never</b>
+         * set the data directly to _aData internally in DataTables - always use
+         * this method. It allows mData to function as required. This function
+         * is automatically assigned by the column initialisation method
+         *  @type function
+         *  @param {array|object} oData The data array/object for the array
+         *    (i.e. aoData[]._aData)
+         *  @param {*} sValue Value to set
+         *  @default null
+         */
+        "fnSetData":null,
+
+        /**
+         * Property to read the value for the cells in the column from the data
+         * source array / object. If null, then the default content is used, if a
+         * function is given then the return from the function is used.
+         *  @type function|int|string|null
+         *  @default null
+         */
+        "mData":null,
+
+        /**
+         * Partner property to mData which is used (only when defined) to get
+         * the data - i.e. it is basically the same as mData, but without the
+         * 'set' option, and also the data fed to it is the result from mData.
+         * This is the rendering method to match the data method of mData.
+         *  @type function|int|string|null
+         *  @default null
+         */
+        "mRender":null,
+
+        /**
+         * Unique header TH/TD element for this column - this is what the sorting
+         * listener is attached to (if sorting is enabled.)
+         *  @type node
+         *  @default null
+         */
+        "nTh":null,
+
+        /**
+         * Unique footer TH/TD element for this column (if there is one). Not used
+         * in DataTables as such, but can be used for plug-ins to reference the
+         * footer for each column.
+         *  @type node
+         *  @default null
+         */
+        "nTf":null,
+
+        /**
+         * The class to apply to all TD elements in the table's TBODY for the column
+         *  @type string
+         *  @default null
+         */
+        "sClass":null,
+
+        /**
+         * When DataTables calculates the column widths to assign to each column,
+         * it finds the longest string in each column and then constructs a
+         * temporary table and reads the widths from that. The problem with this
+         * is that "mmm" is much wider then "iiii", but the latter is a longer
+         * string - thus the calculation can go wrong (doing it properly and putting
+         * it into an DOM object and measuring that is horribly(!) slow). Thus as
+         * a "work around" we provide this option. It will append its value to the
+         * text that is found to be the longest string for the column - i.e. padding.
+         *  @type string
+         */
+        "sContentPadding":null,
+
+        /**
+         * Allows a default value to be given for a column's data, and will be used
+         * whenever a null data source is encountered (this can be because mData
+         * is set to null, or because the data source itself is null).
+         *  @type string
+         *  @default null
+         */
+        "sDefaultContent":null,
+
+        /**
+         * Name for the column, allowing reference to the column by name as well as
+         * by index (needs a lookup to work by name).
+         *  @type string
+         */
+        "sName":null,
+
+        /**
+         * Custom sorting data type - defines which of the available plug-ins in
+         * afnSortData the custom sorting will use - if any is defined.
+         *  @type string
+         *  @default std
+         */
+        "sSortDataType":'std',
+
+        /**
+         * Class to be applied to the header element when sorting on this column
+         *  @type string
+         *  @default null
+         */
+        "sSortingClass":null,
+
+        /**
+         * Class to be applied to the header element when sorting on this column -
+         * when jQuery UI theming is used.
+         *  @type string
+         *  @default null
+         */
+        "sSortingClassJUI":null,
+
+        /**
+         * Title of the column - what is seen in the TH element (nTh).
+         *  @type string
+         */
+        "sTitle":null,
+
+        /**
+         * Column sorting and filtering type
+         *  @type string
+         *  @default null
+         */
+        "sType":null,
+
+        /**
+         * Width of the column
+         *  @type string
+         *  @default null
+         */
+        "sWidth":null,
+
+        /**
+         * Width of the column when it was first "encountered"
+         *  @type string
+         *  @default null
+         */
+        "sWidthOrig":null
+      };
+
+
+      /**
+       * Initialisation options that can be given to DataTables at initialisation
+       * time.
+       *  @namespace
+       */
+      DataTable.defaults = {
+        /**
+         * An array of data to use for the table, passed in at initialisation which
+         * will be used in preference to any data which is already in the DOM. This is
+         * particularly useful for constructing tables purely in Javascript, for
+         * example with a custom Ajax call.
+         *  @type array
+         *  @default null
+         *  @dtopt Option
+         *
+         *  @example
+         *    // Using a 2D array data source
+         *    $(document).ready( function () {
+		 *      $('#example').dataTable( {
+		 *        "aaData": [
+		 *          ['Trident', 'Internet Explorer 4.0', 'Win 95+', 4, 'X'],
+		 *          ['Trident', 'Internet Explorer 5.0', 'Win 95+', 5, 'C'],
+		 *        ],
+		 *        "aoColumns": [
+		 *          { "sTitle": "Engine" },
+		 *          { "sTitle": "Browser" },
+		 *          { "sTitle": "Platform" },
+		 *          { "sTitle": "Version" },
+		 *          { "sTitle": "Grade" }
+		 *        ]
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Using an array of objects as a data source (mData)
+         *    $(document).ready( function () {
+		 *      $('#example').dataTable( {
+		 *        "aaData": [
+		 *          {
+		 *            "engine":   "Trident",
+		 *            "browser":  "Internet Explorer 4.0",
+		 *            "platform": "Win 95+",
+		 *            "version":  4,
+		 *            "grade":    "X"
+		 *          },
+		 *          {
+		 *            "engine":   "Trident",
+		 *            "browser":  "Internet Explorer 5.0",
+		 *            "platform": "Win 95+",
+		 *            "version":  5,
+		 *            "grade":    "C"
+		 *          }
+		 *        ],
+		 *        "aoColumns": [
+		 *          { "sTitle": "Engine",   "mData": "engine" },
+		 *          { "sTitle": "Browser",  "mData": "browser" },
+		 *          { "sTitle": "Platform", "mData": "platform" },
+		 *          { "sTitle": "Version",  "mData": "version" },
+		 *          { "sTitle": "Grade",    "mData": "grade" }
+		 *        ]
+		 *      } );
+		 *    } );
+         */
+        "aaData":null,
+
+
+        /**
+         * If sorting is enabled, then DataTables will perform a first pass sort on
+         * initialisation. You can define which column(s) the sort is performed upon,
+         * and the sorting direction, with this variable. The aaSorting array should
+         * contain an array for each column to be sorted initially containing the
+         * column's index and a direction string ('asc' or 'desc').
+         *  @type array
+         *  @default [[0,'asc']]
+         *  @dtopt Option
+         *
+         *  @example
+         *    // Sort by 3rd column first, and then 4th column
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aaSorting": [[2,'asc'], [3,'desc']]
+		 *      } );
+		 *    } );
+         *
+         *    // No initial sorting
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aaSorting": []
+		 *      } );
+		 *    } );
+         */
+        "aaSorting":[
+          [0, 'asc']
+        ],
+
+
+        /**
+         * This parameter is basically identical to the aaSorting parameter, but
+         * cannot be overridden by user interaction with the table. What this means
+         * is that you could have a column (visible or hidden) which the sorting will
+         * always be forced on first - any sorting after that (from the user) will
+         * then be performed as required. This can be useful for grouping rows
+         * together.
+         *  @type array
+         *  @default null
+         *  @dtopt Option
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aaSortingFixed": [[0,'asc']]
+		 *      } );
+		 *    } )
+         */
+        "aaSortingFixed":null,
+
+
+        /**
+         * This parameter allows you to readily specify the entries in the length drop
+         * down menu that DataTables shows when pagination is enabled. It can be
+         * either a 1D array of options which will be used for both the displayed
+         * option and the value, or a 2D array which will use the array in the first
+         * position as the value, and the array in the second position as the
+         * displayed options (useful for language strings such as 'All').
+         *  @type array
+         *  @default [ 10, 25, 50, 100 ]
+         *  @dtopt Option
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Setting the default display length as well as length menu
+         *    // This is likely to be wanted if you remove the '10' option which
+         *    // is the iDisplayLength default.
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "iDisplayLength": 25,
+		 *        "aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]]
+		 *      } );
+		 *    } );
+         */
+        "aLengthMenu":[ 10, 25, 50, 100 ],
+
+
+        /**
+         * The aoColumns option in the initialisation parameter allows you to define
+         * details about the way individual columns behave. For a full list of
+         * column options that can be set, please see
+         * {@link DataTable.defaults.columns}. Note that if you use aoColumns to
+         * define your columns, you must have an entry in the array for every single
+         * column that you have in your table (these can be null if you don't which
+         * to specify any options).
+         *  @member
+         */
+        "aoColumns":null,
+
+        /**
+         * Very similar to aoColumns, aoColumnDefs allows you to target a specific
+         * column, multiple columns, or all columns, using the aTargets property of
+         * each object in the array. This allows great flexibility when creating
+         * tables, as the aoColumnDefs arrays can be of any length, targeting the
+         * columns you specifically want. aoColumnDefs may use any of the column
+         * options available: {@link DataTable.defaults.columns}, but it _must_
+         * have aTargets defined in each object in the array. Values in the aTargets
+         * array may be:
+         *   <ul>
+         *     <li>a string - class name will be matched on the TH for the column</li>
+         *     <li>0 or a positive integer - column index counting from the left</li>
+         *     <li>a negative integer - column index counting from the right</li>
+         *     <li>the string "_all" - all columns (i.e. assign a default)</li>
+         *   </ul>
+         *  @member
+         */
+        "aoColumnDefs":null,
+
+
+        /**
+         * Basically the same as oSearch, this parameter defines the individual column
+         * filtering state at initialisation time. The array must be of the same size
+         * as the number of columns, and each element be an object with the parameters
+         * "sSearch" and "bEscapeRegex" (the latter is optional). 'null' is also
+         * accepted and the default will be used.
+         *  @type array
+         *  @default []
+         *  @dtopt Option
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoSearchCols": [
+		 *          null,
+		 *          { "sSearch": "My filter" },
+		 *          null,
+		 *          { "sSearch": "^[0-9]", "bEscapeRegex": false }
+		 *        ]
+		 *      } );
+		 *    } )
+         */
+        "aoSearchCols":[],
+
+
+        /**
+         * An array of CSS classes that should be applied to displayed rows. This
+         * array may be of any length, and DataTables will apply each class
+         * sequentially, looping when required.
+         *  @type array
+         *  @default null <i>Will take the values determined by the oClasses.sStripe*
+         *    options</i>
+         *  @dtopt Option
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "asStripeClasses": [ 'strip1', 'strip2', 'strip3' ]
+		 *      } );
+		 *    } )
+         */
+        "asStripeClasses":null,
+
+
+        /**
+         * Enable or disable automatic column width calculation. This can be disabled
+         * as an optimisation (it takes some time to calculate the widths) if the
+         * tables widths are passed in using aoColumns.
+         *  @type boolean
+         *  @default true
+         *  @dtopt Features
+         *
+         *  @example
+         *    $(document).ready( function () {
+		 *      $('#example').dataTable( {
+		 *        "bAutoWidth": false
+		 *      } );
+		 *    } );
+         */
+        "bAutoWidth":true,
+
+
+        /**
+         * Deferred rendering can provide DataTables with a huge speed boost when you
+         * are using an Ajax or JS data source for the table. This option, when set to
+         * true, will cause DataTables to defer the creation of the table elements for
+         * each row until they are needed for a draw - saving a significant amount of
+         * time.
+         *  @type boolean
+         *  @default false
+         *  @dtopt Features
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      var oTable = $('#example').dataTable( {
+		 *        "sAjaxSource": "sources/arrays.txt",
+		 *        "bDeferRender": true
+		 *      } );
+		 *    } );
+         */
+        "bDeferRender":false,
+
+
+        /**
+         * Replace a DataTable which matches the given selector and replace it with
+         * one which has the properties of the new initialisation object passed. If no
+         * table matches the selector, then the new DataTable will be constructed as
+         * per normal.
+         *  @type boolean
+         *  @default false
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "sScrollY": "200px",
+		 *        "bPaginate": false
+		 *      } );
+		 *      
+		 *      // Some time later....
+		 *      $('#example').dataTable( {
+		 *        "bFilter": false,
+		 *        "bDestroy": true
+		 *      } );
+		 *    } );
+         */
+        "bDestroy":false,
+
+
+        /**
+         * Enable or disable filtering of data. Filtering in DataTables is "smart" in
+         * that it allows the end user to input multiple words (space separated) and
+         * will match a row containing those words, even if not in the order that was
+         * specified (this allow matching across multiple columns). Note that if you
+         * wish to use filtering in DataTables this must remain 'true' - to remove the
+         * default filtering input box and retain filtering abilities, please use
+         * {@link DataTable.defaults.sDom}.
+         *  @type boolean
+         *  @default true
+         *  @dtopt Features
+         *
+         *  @example
+         *    $(document).ready( function () {
+		 *      $('#example').dataTable( {
+		 *        "bFilter": false
+		 *      } );
+		 *    } );
+         */
+        "bFilter":true,
+
+
+        /**
+         * Enable or disable the table information display. This shows information
+         * about the data that is currently visible on the page, including information
+         * about filtered data if that action is being performed.
+         *  @type boolean
+         *  @default true
+         *  @dtopt Features
+         *
+         *  @example
+         *    $(document).ready( function () {
+		 *      $('#example').dataTable( {
+		 *        "bInfo": false
+		 *      } );
+		 *    } );
+         */
+        "bInfo":true,
+
+
+        /**
+         * Enable jQuery UI ThemeRoller support (required as ThemeRoller requires some
+         * slightly different and additional mark-up from what DataTables has
+         * traditionally used).
+         *  @type boolean
+         *  @default false
+         *  @dtopt Features
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bJQueryUI": true
+		 *      } );
+		 *    } );
+         */
+        "bJQueryUI":false,
+
+
+        /**
+         * Allows the end user to select the size of a formatted page from a select
+         * menu (sizes are 10, 25, 50 and 100). Requires pagination (bPaginate).
+         *  @type boolean
+         *  @default true
+         *  @dtopt Features
+         *
+         *  @example
+         *    $(document).ready( function () {
+		 *      $('#example').dataTable( {
+		 *        "bLengthChange": false
+		 *      } );
+		 *    } );
+         */
+        "bLengthChange":true,
+
+
+        /**
+         * Enable or disable pagination.
+         *  @type boolean
+         *  @default true
+         *  @dtopt Features
+         *
+         *  @example
+         *    $(document).ready( function () {
+		 *      $('#example').dataTable( {
+		 *        "bPaginate": false
+		 *      } );
+		 *    } );
+         */
+        "bPaginate":true,
+
+
+        /**
+         * Enable or disable the display of a 'processing' indicator when the table is
+         * being processed (e.g. a sort). This is particularly useful for tables with
+         * large amounts of data where it can take a noticeable amount of time to sort
+         * the entries.
+         *  @type boolean
+         *  @default false
+         *  @dtopt Features
+         *
+         *  @example
+         *    $(document).ready( function () {
+		 *      $('#example').dataTable( {
+		 *        "bProcessing": true
+		 *      } );
+		 *    } );
+         */
+        "bProcessing":false,
+
+
+        /**
+         * Retrieve the DataTables object for the given selector. Note that if the
+         * table has already been initialised, this parameter will cause DataTables
+         * to simply return the object that has already been set up - it will not take
+         * account of any changes you might have made to the initialisation object
+         * passed to DataTables (setting this parameter to true is an acknowledgement
+         * that you understand this). bDestroy can be used to reinitialise a table if
+         * you need.
+         *  @type boolean
+         *  @default false
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      initTable();
+		 *      tableActions();
+		 *    } );
+         *
+         *    function initTable ()
+         *    {
+		 *      return $('#example').dataTable( {
+		 *        "sScrollY": "200px",
+		 *        "bPaginate": false,
+		 *        "bRetrieve": true
+		 *      } );
+		 *    }
+         *
+         *    function tableActions ()
+         *    {
+		 *      var oTable = initTable();
+		 *      // perform API operations with oTable 
+		 *    }
+         */
+        "bRetrieve":false,
+
+
+        /**
+         * Indicate if DataTables should be allowed to set the padding / margin
+         * etc for the scrolling header elements or not. Typically you will want
+         * this.
+         *  @type boolean
+         *  @default true
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bScrollAutoCss": false,
+		 *        "sScrollY": "200px"
+		 *      } );
+		 *    } );
+         */
+        "bScrollAutoCss":true,
+
+
+        /**
+         * When vertical (y) scrolling is enabled, DataTables will force the height of
+         * the table's viewport to the given height at all times (useful for layout).
+         * However, this can look odd when filtering data down to a small data set,
+         * and the footer is left "floating" further down. This parameter (when
+         * enabled) will cause DataTables to collapse the table's viewport down when
+         * the result set will fit within the given Y height.
+         *  @type boolean
+         *  @default false
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "sScrollY": "200",
+		 *        "bScrollCollapse": true
+		 *      } );
+		 *    } );
+         */
+        "bScrollCollapse":false,
+
+
+        /**
+         * Enable infinite scrolling for DataTables (to be used in combination with
+         * sScrollY). Infinite scrolling means that DataTables will continually load
+         * data as a user scrolls through a table, which is very useful for large
+         * dataset. This cannot be used with pagination, which is automatically
+         * disabled. Note - the Scroller extra for DataTables is recommended in
+         * in preference to this option.
+         *  @type boolean
+         *  @default false
+         *  @dtopt Features
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bScrollInfinite": true,
+		 *        "bScrollCollapse": true,
+		 *        "sScrollY": "200px"
+		 *      } );
+		 *    } );
+         */
+        "bScrollInfinite":false,
+
+
+        /**
+         * Configure DataTables to use server-side processing. Note that the
+         * sAjaxSource parameter must also be given in order to give DataTables a
+         * source to obtain the required data for each draw.
+         *  @type boolean
+         *  @default false
+         *  @dtopt Features
+         *  @dtopt Server-side
+         *
+         *  @example
+         *    $(document).ready( function () {
+		 *      $('#example').dataTable( {
+		 *        "bServerSide": true,
+		 *        "sAjaxSource": "xhr.php"
+		 *      } );
+		 *    } );
+         */
+        "bServerSide":false,
+
+
+        /**
+         * Enable or disable sorting of columns. Sorting of individual columns can be
+         * disabled by the "bSortable" option for each column.
+         *  @type boolean
+         *  @default true
+         *  @dtopt Features
+         *
+         *  @example
+         *    $(document).ready( function () {
+		 *      $('#example').dataTable( {
+		 *        "bSort": false
+		 *      } );
+		 *    } );
+         */
+        "bSort":true,
+
+
+        /**
+         * Allows control over whether DataTables should use the top (true) unique
+         * cell that is found for a single column, or the bottom (false - default).
+         * This is useful when using complex headers.
+         *  @type boolean
+         *  @default false
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bSortCellsTop": true
+		 *      } );
+		 *    } );
+         */
+        "bSortCellsTop":false,
+
+
+        /**
+         * Enable or disable the addition of the classes 'sorting_1', 'sorting_2' and
+         * 'sorting_3' to the columns which are currently being sorted on. This is
+         * presented as a feature switch as it can increase processing time (while
+         * classes are removed and added) so for large data sets you might want to
+         * turn this off.
+         *  @type boolean
+         *  @default true
+         *  @dtopt Features
+         *
+         *  @example
+         *    $(document).ready( function () {
+		 *      $('#example').dataTable( {
+		 *        "bSortClasses": false
+		 *      } );
+		 *    } );
+         */
+        "bSortClasses":true,
+
+
+        /**
+         * Enable or disable state saving. When enabled a cookie will be used to save
+         * table display information such as pagination information, display length,
+         * filtering and sorting. As such when the end user reloads the page the
+         * display display will match what thy had previously set up.
+         *  @type boolean
+         *  @default false
+         *  @dtopt Features
+         *
+         *  @example
+         *    $(document).ready( function () {
+		 *      $('#example').dataTable( {
+		 *        "bStateSave": true
+		 *      } );
+		 *    } );
+         */
+        "bStateSave":false,
+
+
+        /**
+         * Customise the cookie and / or the parameters being stored when using
+         * DataTables with state saving enabled. This function is called whenever
+         * the cookie is modified, and it expects a fully formed cookie string to be
+         * returned. Note that the data object passed in is a Javascript object which
+         * must be converted to a string (JSON.stringify for example).
+         *  @type function
+         *  @param {string} sName Name of the cookie defined by DataTables
+         *  @param {object} oData Data to be stored in the cookie
+         *  @param {string} sExpires Cookie expires string
+         *  @param {string} sPath Path of the cookie to set
+         *  @returns {string} Cookie formatted string (which should be encoded by
+         *    using encodeURIComponent())
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    $(document).ready( function () {
+		 *      $('#example').dataTable( {
+		 *        "fnCookieCallback": function (sName, oData, sExpires, sPath) {
+		 *          // Customise oData or sName or whatever else here
+		 *          return sName + "="+JSON.stringify(oData)+"; expires=" + sExpires +"; path=" + sPath;
+		 *        }
+		 *      } );
+		 *    } );
+         */
+        "fnCookieCallback":null,
+
+
+        /**
+         * This function is called when a TR element is created (and all TD child
+         * elements have been inserted), or registered if using a DOM source, allowing
+         * manipulation of the TR element (adding classes etc).
+         *  @type function
+         *  @param {node} nRow "TR" element for the current row
+         *  @param {array} aData Raw data array for this row
+         *  @param {int} iDataIndex The index of this row in aoData
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "fnCreatedRow": function( nRow, aData, iDataIndex ) {
+		 *          // Bold the grade for all 'A' grade browsers
+		 *          if ( aData[4] == "A" )
+		 *          {
+		 *            $('td:eq(4)', nRow).html( '<b>A</b>' );
+		 *          }
+		 *        }
+		 *      } );
+		 *    } );
+         */
+        "fnCreatedRow":null,
+
+
+        /**
+         * This function is called on every 'draw' event, and allows you to
+         * dynamically modify any aspect you want about the created DOM.
+         *  @type function
+         *  @param {object} oSettings DataTables settings object
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "fnDrawCallback": function( oSettings ) {
+		 *          alert( 'DataTables has redrawn the table' );
+		 *        }
+		 *      } );
+		 *    } );
+         */
+        "fnDrawCallback":null,
+
+
+        /**
+         * Identical to fnHeaderCallback() but for the table footer this function
+         * allows you to modify the table footer on every 'draw' even.
+         *  @type function
+         *  @param {node} nFoot "TR" element for the footer
+         *  @param {array} aData Full table data (as derived from the original HTML)
+         *  @param {int} iStart Index for the current display starting point in the
+         *    display array
+         *  @param {int} iEnd Index for the current display ending point in the
+         *    display array
+         *  @param {array int} aiDisplay Index array to translate the visual position
+         *    to the full data array
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "fnFooterCallback": function( nFoot, aData, iStart, iEnd, aiDisplay ) {
+		 *          nFoot.getElementsByTagName('th')[0].innerHTML = "Starting index is "+iStart;
+		 *        }
+		 *      } );
+		 *    } )
+         */
+        "fnFooterCallback":null,
+
+
+        /**
+         * When rendering large numbers in the information element for the table
+         * (i.e. "Showing 1 to 10 of 57 entries") DataTables will render large numbers
+         * to have a comma separator for the 'thousands' units (e.g. 1 million is
+         * rendered as "1,000,000") to help readability for the end user. This
+         * function will override the default method DataTables uses.
+         *  @type function
+         *  @member
+         *  @param {int} iIn number to be formatted
+         *  @returns {string} formatted string for DataTables to show the number
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "fnFormatNumber": function ( iIn ) {
+		 *          if ( iIn &lt; 1000 ) {
+		 *            return iIn;
+		 *          } else {
+		 *            var 
+		 *              s=(iIn+""), 
+		 *              a=s.split(""), out="", 
+		 *              iLen=s.length;
+		 *            
+		 *            for ( var i=0 ; i&lt;iLen ; i++ ) {
+		 *              if ( i%3 === 0 &amp;&amp; i !== 0 ) {
+		 *                out = "'"+out;
+		 *              }
+		 *              out = a[iLen-i-1]+out;
+		 *            }
+		 *          }
+		 *          return out;
+		 *        };
+		 *      } );
+		 *    } );
+         */
+        "fnFormatNumber":function (iIn) {
+          if (iIn < 1000) {
+            // A small optimisation for what is likely to be the majority of use cases
+            return iIn;
+          }
+
+          var s = (iIn + ""), a = s.split(""), out = "", iLen = s.length;
+
+          for (var i = 0; i < iLen; i++) {
+            if (i % 3 === 0 && i !== 0) {
+              out = this.oLanguage.sInfoThousands + out;
+            }
+            out = a[iLen - i - 1] + out;
+          }
+          return out;
+        },
+
+
+        /**
+         * This function is called on every 'draw' event, and allows you to
+         * dynamically modify the header row. This can be used to calculate and
+         * display useful information about the table.
+         *  @type function
+         *  @param {node} nHead "TR" element for the header
+         *  @param {array} aData Full table data (as derived from the original HTML)
+         *  @param {int} iStart Index for the current display starting point in the
+         *    display array
+         *  @param {int} iEnd Index for the current display ending point in the
+         *    display array
+         *  @param {array int} aiDisplay Index array to translate the visual position
+         *    to the full data array
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "fnHeaderCallback": function( nHead, aData, iStart, iEnd, aiDisplay ) {
+		 *          nHead.getElementsByTagName('th')[0].innerHTML = "Displaying "+(iEnd-iStart)+" records";
+		 *        }
+		 *      } );
+		 *    } )
+         */
+        "fnHeaderCallback":null,
+
+
+        /**
+         * The information element can be used to convey information about the current
+         * state of the table. Although the internationalisation options presented by
+         * DataTables are quite capable of dealing with most customisations, there may
+         * be times where you wish to customise the string further. This callback
+         * allows you to do exactly that.
+         *  @type function
+         *  @param {object} oSettings DataTables settings object
+         *  @param {int} iStart Starting position in data for the draw
+         *  @param {int} iEnd End position in data for the draw
+         *  @param {int} iMax Total number of rows in the table (regardless of
+         *    filtering)
+         *  @param {int} iTotal Total number of rows in the data set, after filtering
+         *  @param {string} sPre The string that DataTables has formatted using it's
+         *    own rules
+         *  @returns {string} The string to be displayed in the information element.
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    $('#example').dataTable( {
+		 *      "fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
+		 *        return iStart +" to "+ iEnd;
+		 *      }
+		 *    } );
+         */
+        "fnInfoCallback":null,
+
+
+        /**
+         * Called when the table has been initialised. Normally DataTables will
+         * initialise sequentially and there will be no need for this function,
+         * however, this does not hold true when using external language information
+         * since that is obtained using an async XHR call.
+         *  @type function
+         *  @param {object} oSettings DataTables settings object
+         *  @param {object} json The JSON object request from the server - only
+         *    present if client-side Ajax sourced data is used
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "fnInitComplete": function(oSettings, json) {
+		 *          alert( 'DataTables has finished its initialisation.' );
+		 *        }
+		 *      } );
+		 *    } )
+         */
+        "fnInitComplete":null,
+
+
+        /**
+         * Called at the very start of each table draw and can be used to cancel the
+         * draw by returning false, any other return (including undefined) results in
+         * the full draw occurring).
+         *  @type function
+         *  @param {object} oSettings DataTables settings object
+         *  @returns {boolean} False will cancel the draw, anything else (including no
+         *    return) will allow it to complete.
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "fnPreDrawCallback": function( oSettings ) {
+		 *          if ( $('#test').val() == 1 ) {
+		 *            return false;
+		 *          }
+		 *        }
+		 *      } );
+		 *    } );
+         */
+        "fnPreDrawCallback":null,
+
+
+        /**
+         * This function allows you to 'post process' each row after it have been
+         * generated for each table draw, but before it is rendered on screen. This
+         * function might be used for setting the row class name etc.
+         *  @type function
+         *  @param {node} nRow "TR" element for the current row
+         *  @param {array} aData Raw data array for this row
+         *  @param {int} iDisplayIndex The display index for the current table draw
+         *  @param {int} iDisplayIndexFull The index of the data in the full list of
+         *    rows (after filtering)
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
+		 *          // Bold the grade for all 'A' grade browsers
+		 *          if ( aData[4] == "A" )
+		 *          {
+		 *            $('td:eq(4)', nRow).html( '<b>A</b>' );
+		 *          }
+		 *        }
+		 *      } );
+		 *    } );
+         */
+        "fnRowCallback":null,
+
+
+        /**
+         * This parameter allows you to override the default function which obtains
+         * the data from the server ($.getJSON) so something more suitable for your
+         * application. For example you could use POST data, or pull information from
+         * a Gears or AIR database.
+         *  @type function
+         *  @member
+         *  @param {string} sSource HTTP source to obtain the data from (sAjaxSource)
+         *  @param {array} aoData A key/value pair object containing the data to send
+         *    to the server
+         *  @param {function} fnCallback to be called on completion of the data get
+         *    process that will draw the data on the page.
+         *  @param {object} oSettings DataTables settings object
+         *  @dtopt Callbacks
+         *  @dtopt Server-side
+         *
+         *  @example
+         *    // POST data to server
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bProcessing": true,
+		 *        "bServerSide": true,
+		 *        "sAjaxSource": "xhr.php",
+		 *        "fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
+		 *          oSettings.jqXHR = $.ajax( {
+		 *            "dataType": 'json', 
+		 *            "type": "POST", 
+		 *            "url": sSource, 
+		 *            "data": aoData, 
+		 *            "success": fnCallback
+		 *          } );
+		 *        }
+		 *      } );
+		 *    } );
+         */
+        "fnServerData":function (sUrl, aoData, fnCallback, oSettings) {
+          oSettings.jqXHR = $.ajax({
+            "url":sUrl,
+            "data":aoData,
+            "success":function (json) {
+              if (json.sError) {
+                oSettings.oApi._fnLog(oSettings, 0, json.sError);
+              }
+
+              $(oSettings.oInstance).trigger('xhr', [oSettings, json]);
+              fnCallback(json);
+            },
+            "dataType":"json",
+            "cache":false,
+            "type":oSettings.sServerMethod,
+            "error":function (xhr, error, thrown) {
+              if (error == "parsererror") {
+                oSettings.oApi._fnLog(oSettings, 0, "DataTables warning: JSON data from " +
+                  "server could not be parsed. This is caused by a JSON formatting error.");
+              }
+            }
+          });
+        },
+
+
+        /**
+         * It is often useful to send extra data to the server when making an Ajax
+         * request - for example custom filtering information, and this callback
+         * function makes it trivial to send extra information to the server. The
+         * passed in parameter is the data set that has been constructed by
+         * DataTables, and you can add to this or modify it as you require.
+         *  @type function
+         *  @param {array} aoData Data array (array of objects which are name/value
+         *    pairs) that has been constructed by DataTables and will be sent to the
+         *    server. In the case of Ajax sourced data with server-side processing
+         *    this will be an empty array, for server-side processing there will be a
+         *    significant number of parameters!
+         *  @returns {undefined} Ensure that you modify the aoData array passed in,
+         *    as this is passed by reference.
+         *  @dtopt Callbacks
+         *  @dtopt Server-side
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bProcessing": true,
+		 *        "bServerSide": true,
+		 *        "sAjaxSource": "scripts/server_processing.php",
+		 *        "fnServerParams": function ( aoData ) {
+		 *          aoData.push( { "name": "more_data", "value": "my_value" } );
+		 *        }
+		 *      } );
+		 *    } );
+         */
+        "fnServerParams":null,
+
+
+        /**
+         * Load the table state. With this function you can define from where, and how, the
+         * state of a table is loaded. By default DataTables will load from its state saving
+         * cookie, but you might wish to use local storage (HTML5) or a server-side database.
+         *  @type function
+         *  @member
+         *  @param {object} oSettings DataTables settings object
+         *  @return {object} The DataTables state object to be loaded
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bStateSave": true,
+		 *        "fnStateLoad": function (oSettings) {
+		 *          var o;
+		 *          
+		 *          // Send an Ajax request to the server to get the data. Note that
+		 *          // this is a synchronous request.
+		 *          $.ajax( {
+		 *            "url": "/state_load",
+		 *            "async": false,
+		 *            "dataType": "json",
+		 *            "success": function (json) {
+		 *              o = json;
+		 *            }
+		 *          } );
+		 *          
+		 *          return o;
+		 *        }
+		 *      } );
+		 *    } );
+         */
+        "fnStateLoad":function (oSettings) {
+          var sData = this.oApi._fnReadCookie(oSettings.sCookiePrefix + oSettings.sInstance);
+          var oData;
+
+          try {
+            oData = (typeof $.parseJSON === 'function') ?
+              $.parseJSON(sData) : eval('(' + sData + ')');
+          } catch (e) {
+            oData = null;
+          }
+
+          return oData;
+        },
+
+
+        /**
+         * Callback which allows modification of the saved state prior to loading that state.
+         * This callback is called when the table is loading state from the stored data, but
+         * prior to the settings object being modified by the saved state. Note that for
+         * plug-in authors, you should use the 'stateLoadParams' event to load parameters for
+         * a plug-in.
+         *  @type function
+         *  @param {object} oSettings DataTables settings object
+         *  @param {object} oData The state object that is to be loaded
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    // Remove a saved filter, so filtering is never loaded
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bStateSave": true,
+		 *        "fnStateLoadParams": function (oSettings, oData) {
+		 *          oData.oSearch.sSearch = "";
+		 *        }
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Disallow state loading by returning false
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bStateSave": true,
+		 *        "fnStateLoadParams": function (oSettings, oData) {
+		 *          return false;
+		 *        }
+		 *      } );
+		 *    } );
+         */
+        "fnStateLoadParams":null,
+
+
+        /**
+         * Callback that is called when the state has been loaded from the state saving method
+         * and the DataTables settings object has been modified as a result of the loaded state.
+         *  @type function
+         *  @param {object} oSettings DataTables settings object
+         *  @param {object} oData The state object that was loaded
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    // Show an alert with the filtering value that was saved
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bStateSave": true,
+		 *        "fnStateLoaded": function (oSettings, oData) {
+		 *          alert( 'Saved filter was: '+oData.oSearch.sSearch );
+		 *        }
+		 *      } );
+		 *    } );
+         */
+        "fnStateLoaded":null,
+
+
+        /**
+         * Save the table state. This function allows you to define where and how the state
+         * information for the table is stored - by default it will use a cookie, but you
+         * might want to use local storage (HTML5) or a server-side database.
+         *  @type function
+         *  @member
+         *  @param {object} oSettings DataTables settings object
+         *  @param {object} oData The state object to be saved
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bStateSave": true,
+		 *        "fnStateSave": function (oSettings, oData) {
+		 *          // Send an Ajax request to the server with the state object
+		 *          $.ajax( {
+		 *            "url": "/state_save",
+		 *            "data": oData,
+		 *            "dataType": "json",
+		 *            "method": "POST"
+		 *            "success": function () {}
+		 *          } );
+		 *        }
+		 *      } );
+		 *    } );
+         */
+        "fnStateSave":function (oSettings, oData) {
+          this.oApi._fnCreateCookie(
+            oSettings.sCookiePrefix + oSettings.sInstance,
+            this.oApi._fnJsonString(oData),
+            oSettings.iCookieDuration,
+            oSettings.sCookiePrefix,
+            oSettings.fnCookieCallback
+          );
+        },
+
+
+        /**
+         * Callback which allows modification of the state to be saved. Called when the table
+         * has changed state a new state save is required. This method allows modification of
+         * the state saving object prior to actually doing the save, including addition or
+         * other state properties or modification. Note that for plug-in authors, you should
+         * use the 'stateSaveParams' event to save parameters for a plug-in.
+         *  @type function
+         *  @param {object} oSettings DataTables settings object
+         *  @param {object} oData The state object to be saved
+         *  @dtopt Callbacks
+         *
+         *  @example
+         *    // Remove a saved filter, so filtering is never saved
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bStateSave": true,
+		 *        "fnStateSaveParams": function (oSettings, oData) {
+		 *          oData.oSearch.sSearch = "";
+		 *        }
+		 *      } );
+		 *    } );
+         */
+        "fnStateSaveParams":null,
+
+
+        /**
+         * Duration of the cookie which is used for storing session information. This
+         * value is given in seconds.
+         *  @type int
+         *  @default 7200 <i>(2 hours)</i>
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "iCookieDuration": 60*60*24; // 1 day
+		 *      } );
+		 *    } )
+         */
+        "iCookieDuration":7200,
+
+
+        /**
+         * When enabled DataTables will not make a request to the server for the first
+         * page draw - rather it will use the data already on the page (no sorting etc
+         * will be applied to it), thus saving on an XHR at load time. iDeferLoading
+         * is used to indicate that deferred loading is required, but it is also used
+         * to tell DataTables how many records there are in the full table (allowing
+         * the information element and pagination to be displayed correctly). In the case
+         * where a filtering is applied to the table on initial load, this can be
+         * indicated by giving the parameter as an array, where the first element is
+         * the number of records available after filtering and the second element is the
+         * number of records without filtering (allowing the table information element
+         * to be shown correctly).
+         *  @type int | array
+         *  @default null
+         *  @dtopt Options
+         *
+         *  @example
+         *    // 57 records available in the table, no filtering applied
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bServerSide": true,
+		 *        "sAjaxSource": "scripts/server_processing.php",
+		 *        "iDeferLoading": 57
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // 57 records after filtering, 100 without filtering (an initial filter applied)
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bServerSide": true,
+		 *        "sAjaxSource": "scripts/server_processing.php",
+		 *        "iDeferLoading": [ 57, 100 ],
+		 *        "oSearch": {
+		 *          "sSearch": "my_filter"
+		 *        }
+		 *      } );
+		 *    } );
+         */
+        "iDeferLoading":null,
+
+
+        /**
+         * Number of rows to display on a single page when using pagination. If
+         * feature enabled (bLengthChange) then the end user will be able to override
+         * this to a custom setting using a pop-up menu.
+         *  @type int
+         *  @default 10
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "iDisplayLength": 50
+		 *      } );
+		 *    } )
+         */
+        "iDisplayLength":10,
+
+
+        /**
+         * Define the starting point for data display when using DataTables with
+         * pagination. Note that this parameter is the number of records, rather than
+         * the page number, so if you have 10 records per page and want to start on
+         * the third page, it should be "20".
+         *  @type int
+         *  @default 0
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "iDisplayStart": 20
+		 *      } );
+		 *    } )
+         */
+        "iDisplayStart":0,
+
+
+        /**
+         * The scroll gap is the amount of scrolling that is left to go before
+         * DataTables will load the next 'page' of data automatically. You typically
+         * want a gap which is big enough that the scrolling will be smooth for the
+         * user, while not so large that it will load more data than need.
+         *  @type int
+         *  @default 100
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bScrollInfinite": true,
+		 *        "bScrollCollapse": true,
+		 *        "sScrollY": "200px",
+		 *        "iScrollLoadGap": 50
+		 *      } );
+		 *    } );
+         */
+        "iScrollLoadGap":100,
+
+
+        /**
+         * By default DataTables allows keyboard navigation of the table (sorting, paging,
+         * and filtering) by adding a tabindex attribute to the required elements. This
+         * allows you to tab through the controls and press the enter key to activate them.
+         * The tabindex is default 0, meaning that the tab follows the flow of the document.
+         * You can overrule this using this parameter if you wish. Use a value of -1 to
+         * disable built-in keyboard navigation.
+         *  @type int
+         *  @default 0
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "iTabIndex": 1
+		 *      } );
+		 *    } );
+         */
+        "iTabIndex":0,
+
+
+        /**
+         * All strings that DataTables uses in the user interface that it creates
+         * are defined in this object, allowing you to modified them individually or
+         * completely replace them all as required.
+         *  @namespace
+         */
+        "oLanguage":{
+          /**
+           * Strings that are used for WAI-ARIA labels and controls only (these are not
+           * actually visible on the page, but will be read by screenreaders, and thus
+           * must be internationalised as well).
+           *  @namespace
+           */
+          "oAria":{
+            /**
+             * ARIA label that is added to the table headers when the column may be
+             * sorted ascending by activing the column (click or return when focused).
+             * Note that the column header is prefixed to this string.
+             *  @type string
+             *  @default : activate to sort column ascending
+             *  @dtopt Language
+             *
+             *  @example
+             *    $(document).ready( function() {
+				 *      $('#example').dataTable( {
+				 *        "oLanguage": {
+				 *          "oAria": {
+				 *            "sSortAscending": " - click/return to sort ascending"
+				 *          }
+				 *        }
+				 *      } );
+				 *    } );
+             */
+            "sSortAscending":": activate to sort column ascending",
+
+            /**
+             * ARIA label that is added to the table headers when the column may be
+             * sorted descending by activing the column (click or return when focused).
+             * Note that the column header is prefixed to this string.
+             *  @type string
+             *  @default : activate to sort column ascending
+             *  @dtopt Language
+             *
+             *  @example
+             *    $(document).ready( function() {
+				 *      $('#example').dataTable( {
+				 *        "oLanguage": {
+				 *          "oAria": {
+				 *            "sSortDescending": " - click/return to sort descending"
+				 *          }
+				 *        }
+				 *      } );
+				 *    } );
+             */
+            "sSortDescending":": activate to sort column descending"
+          },
+
+          /**
+           * Pagination string used by DataTables for the two built-in pagination
+           * control types ("two_button" and "full_numbers")
+           *  @namespace
+           */
+          "oPaginate":{
+            /**
+             * Text to use when using the 'full_numbers' type of pagination for the
+             * button to take the user to the first page.
+             *  @type string
+             *  @default First
+             *  @dtopt Language
+             *
+             *  @example
+             *    $(document).ready( function() {
+				 *      $('#example').dataTable( {
+				 *        "oLanguage": {
+				 *          "oPaginate": {
+				 *            "sFirst": "First page"
+				 *          }
+				 *        }
+				 *      } );
+				 *    } );
+             */
+            "sFirst":"First",
+
+
+            /**
+             * Text to use when using the 'full_numbers' type of pagination for the
+             * button to take the user to the last page.
+             *  @type string
+             *  @default Last
+             *  @dtopt Language
+             *
+             *  @example
+             *    $(document).ready( function() {
+				 *      $('#example').dataTable( {
+				 *        "oLanguage": {
+				 *          "oPaginate": {
+				 *            "sLast": "Last page"
+				 *          }
+				 *        }
+				 *      } );
+				 *    } );
+             */
+            "sLast":"Last",
+
+
+            /**
+             * Text to use for the 'next' pagination button (to take the user to the
+             * next page).
+             *  @type string
+             *  @default Next
+             *  @dtopt Language
+             *
+             *  @example
+             *    $(document).ready( function() {
+				 *      $('#example').dataTable( {
+				 *        "oLanguage": {
+				 *          "oPaginate": {
+				 *            "sNext": "Next page"
+				 *          }
+				 *        }
+				 *      } );
+				 *    } );
+             */
+            "sNext":"Next",
+
+
+            /**
+             * Text to use for the 'previous' pagination button (to take the user to
+             * the previous page).
+             *  @type string
+             *  @default Previous
+             *  @dtopt Language
+             *
+             *  @example
+             *    $(document).ready( function() {
+				 *      $('#example').dataTable( {
+				 *        "oLanguage": {
+				 *          "oPaginate": {
+				 *            "sPrevious": "Previous page"
+				 *          }
+				 *        }
+				 *      } );
+				 *    } );
+             */
+            "sPrevious":"Previous"
+          },
+
+          /**
+           * This string is shown in preference to sZeroRecords when the table is
+           * empty of data (regardless of filtering). Note that this is an optional
+           * parameter - if it is not given, the value of sZeroRecords will be used
+           * instead (either the default or given value).
+           *  @type string
+           *  @default No data available in table
+           *  @dtopt Language
+           *
+           *  @example
+           *    $(document).ready( function() {
+			 *      $('#example').dataTable( {
+			 *        "oLanguage": {
+			 *          "sEmptyTable": "No data available in table"
+			 *        }
+			 *      } );
+			 *    } );
+           */
+          "sEmptyTable":"No data available in table",
+
+
+          /**
+           * This string gives information to the end user about the information that
+           * is current on display on the page. The _START_, _END_ and _TOTAL_
+           * variables are all dynamically replaced as the table display updates, and
+           * can be freely moved or removed as the language requirements change.
+           *  @type string
+           *  @default Showing _START_ to _END_ of _TOTAL_ entries
+           *  @dtopt Language
+           *
+           *  @example
+           *    $(document).ready( function() {
+			 *      $('#example').dataTable( {
+			 *        "oLanguage": {
+			 *          "sInfo": "Got a total of _TOTAL_ entries to show (_START_ to _END_)"
+			 *        }
+			 *      } );
+			 *    } );
+           */
+          "sInfo":"Showing _START_ to _END_ of _TOTAL_ entries",
+
+
+          /**
+           * Display information string for when the table is empty. Typically the
+           * format of this string should match sInfo.
+           *  @type string
+           *  @default Showing 0 to 0 of 0 entries
+           *  @dtopt Language
+           *
+           *  @example
+           *    $(document).ready( function() {
+			 *      $('#example').dataTable( {
+			 *        "oLanguage": {
+			 *          "sInfoEmpty": "No entries to show"
+			 *        }
+			 *      } );
+			 *    } );
+           */
+          "sInfoEmpty":"Showing 0 to 0 of 0 entries",
+
+
+          /**
+           * When a user filters the information in a table, this string is appended
+           * to the information (sInfo) to give an idea of how strong the filtering
+           * is. The variable _MAX_ is dynamically updated.
+           *  @type string
+           *  @default (filtered from _MAX_ total entries)
+           *  @dtopt Language
+           *
+           *  @example
+           *    $(document).ready( function() {
+			 *      $('#example').dataTable( {
+			 *        "oLanguage": {
+			 *          "sInfoFiltered": " - filtering from _MAX_ records"
+			 *        }
+			 *      } );
+			 *    } );
+           */
+          "sInfoFiltered":"(filtered from _MAX_ total entries)",
+
+
+          /**
+           * If can be useful to append extra information to the info string at times,
+           * and this variable does exactly that. This information will be appended to
+           * the sInfo (sInfoEmpty and sInfoFiltered in whatever combination they are
+           * being used) at all times.
+           *  @type string
+           *  @default <i>Empty string</i>
+           *  @dtopt Language
+           *
+           *  @example
+           *    $(document).ready( function() {
+			 *      $('#example').dataTable( {
+			 *        "oLanguage": {
+			 *          "sInfoPostFix": "All records shown are derived from real information."
+			 *        }
+			 *      } );
+			 *    } );
+           */
+          "sInfoPostFix":"",
+
+
+          /**
+           * DataTables has a build in number formatter (fnFormatNumber) which is used
+           * to format large numbers that are used in the table information. By
+           * default a comma is used, but this can be trivially changed to any
+           * character you wish with this parameter.
+           *  @type string
+           *  @default ,
+           *  @dtopt Language
+           *
+           *  @example
+           *    $(document).ready( function() {
+			 *      $('#example').dataTable( {
+			 *        "oLanguage": {
+			 *          "sInfoThousands": "'"
+			 *        }
+			 *      } );
+			 *    } );
+           */
+          "sInfoThousands":",",
+
+
+          /**
+           * Detail the action that will be taken when the drop down menu for the
+           * pagination length option is changed. The '_MENU_' variable is replaced
+           * with a default select list of 10, 25, 50 and 100, and can be replaced
+           * with a custom select box if required.
+           *  @type string
+           *  @default Show _MENU_ entries
+           *  @dtopt Language
+           *
+           *  @example
+           *    // Language change only
+           *    $(document).ready( function() {
+			 *      $('#example').dataTable( {
+			 *        "oLanguage": {
+			 *          "sLengthMenu": "Display _MENU_ records"
+			 *        }
+			 *      } );
+			 *    } );
+           *
+           *  @example
+           *    // Language and options change
+           *    $(document).ready( function() {
+			 *      $('#example').dataTable( {
+			 *        "oLanguage": {
+			 *          "sLengthMenu": 'Display <select>'+
+			 *            '<option value="10">10</option>'+
+			 *            '<option value="20">20</option>'+
+			 *            '<option value="30">30</option>'+
+			 *            '<option value="40">40</option>'+
+			 *            '<option value="50">50</option>'+
+			 *            '<option value="-1">All</option>'+
+			 *            '</select> records'
+			 *        }
+			 *      } );
+			 *    } );
+           */
+          "sLengthMenu":"Show _MENU_ entries",
+
+
+          /**
+           * When using Ajax sourced data and during the first draw when DataTables is
+           * gathering the data, this message is shown in an empty row in the table to
+           * indicate to the end user the the data is being loaded. Note that this
+           * parameter is not used when loading data by server-side processing, just
+           * Ajax sourced data with client-side processing.
+           *  @type string
+           *  @default Loading...
+           *  @dtopt Language
+           *
+           *  @example
+           *    $(document).ready( function() {
+			 *      $('#example').dataTable( {
+			 *        "oLanguage": {
+			 *          "sLoadingRecords": "Please wait - loading..."
+			 *        }
+			 *      } );
+			 *    } );
+           */
+          "sLoadingRecords":"Loading...",
+
+
+          /**
+           * Text which is displayed when the table is processing a user action
+           * (usually a sort command or similar).
+           *  @type string
+           *  @default Processing...
+           *  @dtopt Language
+           *
+           *  @example
+           *    $(document).ready( function() {
+			 *      $('#example').dataTable( {
+			 *        "oLanguage": {
+			 *          "sProcessing": "DataTables is currently busy"
+			 *        }
+			 *      } );
+			 *    } );
+           */
+          "sProcessing":"Processing...",
+
+
+          /**
+           * Details the actions that will be taken when the user types into the
+           * filtering input text box. The variable "_INPUT_", if used in the string,
+           * is replaced with the HTML text box for the filtering input allowing
+           * control over where it appears in the string. If "_INPUT_" is not given
+           * then the input box is appended to the string automatically.
+           *  @type string
+           *  @default Search:
+           *  @dtopt Language
+           *
+           *  @example
+           *    // Input text box will be appended at the end automatically
+           *    $(document).ready( function() {
+			 *      $('#example').dataTable( {
+			 *        "oLanguage": {
+			 *          "sSearch": "Filter records:"
+			 *        }
+			 *      } );
+			 *    } );
+           *
+           *  @example
+           *    // Specify where the filter should appear
+           *    $(document).ready( function() {
+			 *      $('#example').dataTable( {
+			 *        "oLanguage": {
+			 *          "sSearch": "Apply filter _INPUT_ to table"
+			 *        }
+			 *      } );
+			 *    } );
+           */
+          "sSearch":"Search:",
+
+
+          /**
+           * All of the language information can be stored in a file on the
+           * server-side, which DataTables will look up if this parameter is passed.
+           * It must store the URL of the language file, which is in a JSON format,
+           * and the object has the same properties as the oLanguage object in the
+           * initialiser object (i.e. the above parameters). Please refer to one of
+           * the example language files to see how this works in action.
+           *  @type string
+           *  @default <i>Empty string - i.e. disabled</i>
+           *  @dtopt Language
+           *
+           *  @example
+           *    $(document).ready( function() {
+			 *      $('#example').dataTable( {
+			 *        "oLanguage": {
+			 *          "sUrl": "http://www.sprymedia.co.uk/dataTables/lang.txt"
+			 *        }
+			 *      } );
+			 *    } );
+           */
+          "sUrl":"",
+
+
+          /**
+           * Text shown inside the table records when the is no information to be
+           * displayed after filtering. sEmptyTable is shown when there is simply no
+           * information in the table at all (regardless of filtering).
+           *  @type string
+           *  @default No matching records found
+           *  @dtopt Language
+           *
+           *  @example
+           *    $(document).ready( function() {
+			 *      $('#example').dataTable( {
+			 *        "oLanguage": {
+			 *          "sZeroRecords": "No records to display"
+			 *        }
+			 *      } );
+			 *    } );
+           */
+          "sZeroRecords":"No matching records found"
+        },
+
+
+        /**
+         * This parameter allows you to have define the global filtering state at
+         * initialisation time. As an object the "sSearch" parameter must be
+         * defined, but all other parameters are optional. When "bRegex" is true,
+         * the search string will be treated as a regular expression, when false
+         * (default) it will be treated as a straight string. When "bSmart"
+         * DataTables will use it's smart filtering methods (to word match at
+         * any point in the data), when false this will not be done.
+         *  @namespace
+         *  @extends DataTable.models.oSearch
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "oSearch": {"sSearch": "Initial search"}
+		 *      } );
+		 *    } )
+         */
+        "oSearch":$.extend({}, DataTable.models.oSearch),
+
+
+        /**
+         * By default DataTables will look for the property 'aaData' when obtaining
+         * data from an Ajax source or for server-side processing - this parameter
+         * allows that property to be changed. You can use Javascript dotted object
+         * notation to get a data source for multiple levels of nesting.
+         *  @type string
+         *  @default aaData
+         *  @dtopt Options
+         *  @dtopt Server-side
+         *
+         *  @example
+         *    // Get data from { "data": [...] }
+         *    $(document).ready( function() {
+		 *      var oTable = $('#example').dataTable( {
+		 *        "sAjaxSource": "sources/data.txt",
+		 *        "sAjaxDataProp": "data"
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Get data from { "data": { "inner": [...] } }
+         *    $(document).ready( function() {
+		 *      var oTable = $('#example').dataTable( {
+		 *        "sAjaxSource": "sources/data.txt",
+		 *        "sAjaxDataProp": "data.inner"
+		 *      } );
+		 *    } );
+         */
+        "sAjaxDataProp":"aaData",
+
+
+        /**
+         * You can instruct DataTables to load data from an external source using this
+         * parameter (use aData if you want to pass data in you already have). Simply
+         * provide a url a JSON object can be obtained from. This object must include
+         * the parameter 'aaData' which is the data source for the table.
+         *  @type string
+         *  @default null
+         *  @dtopt Options
+         *  @dtopt Server-side
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "sAjaxSource": "http://www.sprymedia.co.uk/dataTables/json.php"
+		 *      } );
+		 *    } )
+         */
+        "sAjaxSource":null,
+
+
+        /**
+         * This parameter can be used to override the default prefix that DataTables
+         * assigns to a cookie when state saving is enabled.
+         *  @type string
+         *  @default SpryMedia_DataTables_
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "sCookiePrefix": "my_datatable_",
+		 *      } );
+		 *    } );
+         */
+        "sCookiePrefix":"SpryMedia_DataTables_",
+
+
+        /**
+         * This initialisation variable allows you to specify exactly where in the
+         * DOM you want DataTables to inject the various controls it adds to the page
+         * (for example you might want the pagination controls at the top of the
+         * table). DIV elements (with or without a custom class) can also be added to
+         * aid styling. The follow syntax is used:
+         *   <ul>
+         *     <li>The following options are allowed:
+         *       <ul>
+         *         <li>'l' - Length changing</li
+         *         <li>'f' - Filtering input</li>
+         *         <li>'t' - The table!</li>
+         *         <li>'i' - Information</li>
+         *         <li>'p' - Pagination</li>
+         *         <li>'r' - pRocessing</li>
+         *       </ul>
+         *     </li>
+         *     <li>The following constants are allowed:
+         *       <ul>
+         *         <li>'H' - jQueryUI theme "header" classes ('fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix')</li>
+         *         <li>'F' - jQueryUI theme "footer" classes ('fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix')</li>
+         *       </ul>
+         *     </li>
+         *     <li>The following syntax is expected:
+         *       <ul>
+         *         <li>'&lt;' and '&gt;' - div elements</li>
+         *         <li>'&lt;"class" and '&gt;' - div with a class</li>
+         *         <li>'&lt;"#id" and '&gt;' - div with an ID</li>
+         *       </ul>
+         *     </li>
+         *     <li>Examples:
+         *       <ul>
+         *         <li>'&lt;"wrapper"flipt&gt;'</li>
+         *         <li>'&lt;lf&lt;t&gt;ip&gt;'</li>
+         *       </ul>
+         *     </li>
+         *   </ul>
+         *  @type string
+         *  @default lfrtip <i>(when bJQueryUI is false)</i> <b>or</b>
+         *    <"H"lfr>t<"F"ip> <i>(when bJQueryUI is true)</i>
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "sDom": '&lt;"top"i&gt;rt&lt;"bottom"flp&gt;&lt;"clear"&gt;'
+		 *      } );
+		 *    } );
+         */
+        "sDom":"lfrtip",
+
+
+        /**
+         * DataTables features two different built-in pagination interaction methods
+         * ('two_button' or 'full_numbers') which present different page controls to
+         * the end user. Further methods can be added using the API (see below).
+         *  @type string
+         *  @default two_button
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "sPaginationType": "full_numbers"
+		 *      } );
+		 *    } )
+         */
+        "sPaginationType":"two_button",
+
+
+        /**
+         * Enable horizontal scrolling. When a table is too wide to fit into a certain
+         * layout, or you have a large number of columns in the table, you can enable
+         * x-scrolling to show the table in a viewport, which can be scrolled. This
+         * property can be any CSS unit, or a number (in which case it will be treated
+         * as a pixel measurement).
+         *  @type string
+         *  @default <i>blank string - i.e. disabled</i>
+         *  @dtopt Features
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "sScrollX": "100%",
+		 *        "bScrollCollapse": true
+		 *      } );
+		 *    } );
+         */
+        "sScrollX":"",
+
+
+        /**
+         * This property can be used to force a DataTable to use more width than it
+         * might otherwise do when x-scrolling is enabled. For example if you have a
+         * table which requires to be well spaced, this parameter is useful for
+         * "over-sizing" the table, and thus forcing scrolling. This property can by
+         * any CSS unit, or a number (in which case it will be treated as a pixel
+         * measurement).
+         *  @type string
+         *  @default <i>blank string - i.e. disabled</i>
+         *  @dtopt Options
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "sScrollX": "100%",
+		 *        "sScrollXInner": "110%"
+		 *      } );
+		 *    } );
+         */
+        "sScrollXInner":"",
+
+
+        /**
+         * Enable vertical scrolling. Vertical scrolling will constrain the DataTable
+         * to the given height, and enable scrolling for any data which overflows the
+         * current viewport. This can be used as an alternative to paging to display
+         * a lot of data in a small area (although paging and scrolling can both be
+         * enabled at the same time). This property can be any CSS unit, or a number
+         * (in which case it will be treated as a pixel measurement).
+         *  @type string
+         *  @default <i>blank string - i.e. disabled</i>
+         *  @dtopt Features
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "sScrollY": "200px",
+		 *        "bPaginate": false
+		 *      } );
+		 *    } );
+         */
+        "sScrollY":"",
+
+
+        /**
+         * Set the HTTP method that is used to make the Ajax call for server-side
+         * processing or Ajax sourced data.
+         *  @type string
+         *  @default GET
+         *  @dtopt Options
+         *  @dtopt Server-side
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "bServerSide": true,
+		 *        "sAjaxSource": "scripts/post.php",
+		 *        "sServerMethod": "POST"
+		 *      } );
+		 *    } );
+         */
+        "sServerMethod":"GET"
+      };
+
+
+      /**
+       * Column options that can be given to DataTables at initialisation time.
+       *  @namespace
+       */
+      DataTable.defaults.columns = {
+        /**
+         * Allows a column's sorting to take multiple columns into account when
+         * doing a sort. For example first name / last name columns make sense to
+         * do a multi-column sort over the two columns.
+         *  @type array
+         *  @default null <i>Takes the value of the column index automatically</i>
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Using aoColumnDefs
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumnDefs": [
+		 *          { "aDataSort": [ 0, 1 ], "aTargets": [ 0 ] },
+		 *          { "aDataSort": [ 1, 0 ], "aTargets": [ 1 ] },
+		 *          { "aDataSort": [ 2, 3, 4 ], "aTargets": [ 2 ] }
+		 *        ]
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Using aoColumns
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumns": [
+		 *          { "aDataSort": [ 0, 1 ] },
+		 *          { "aDataSort": [ 1, 0 ] },
+		 *          { "aDataSort": [ 2, 3, 4 ] },
+		 *          null,
+		 *          null
+		 *        ]
+		 *      } );
+		 *    } );
+         */
+        "aDataSort":null,
+
+
+        /**
+         * You can control the default sorting direction, and even alter the behaviour
+         * of the sort handler (i.e. only allow ascending sorting etc) using this
+         * parameter.
+         *  @type array
+         *  @default [ 'asc', 'desc' ]
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Using aoColumnDefs
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumnDefs": [
+		 *          { "asSorting": [ "asc" ], "aTargets": [ 1 ] },
+		 *          { "asSorting": [ "desc", "asc", "asc" ], "aTargets": [ 2 ] },
+		 *          { "asSorting": [ "desc" ], "aTargets": [ 3 ] }
+		 *        ]
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Using aoColumns
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumns": [
+		 *          null,
+		 *          { "asSorting": [ "asc" ] },
+		 *          { "asSorting": [ "desc", "asc", "asc" ] },
+		 *          { "asSorting": [ "desc" ] },
+		 *          null
+		 *        ]
+		 *      } );
+		 *    } );
+         */
+        "asSorting":[ 'asc', 'desc' ],
+
+
+        /**
+         * Enable or disable filtering on the data in this column.
+         *  @type boolean
+         *  @default true
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Using aoColumnDefs
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumnDefs": [ 
+		 *          { "bSearchable": false, "aTargets": [ 0 ] }
+		 *        ] } );
+		 *    } );
+         *
+         *  @example
+         *    // Using aoColumns
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumns": [ 
+		 *          { "bSearchable": false },
+		 *          null,
+		 *          null,
+		 *          null,
+		 *          null
+		 *        ] } );
+		 *    } );
+         */
+        "bSearchable":true,
+
+
+        /**
+         * Enable or disable sorting on this column.
+         *  @type boolean
+         *  @default true
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Using aoColumnDefs
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumnDefs": [ 
+		 *          { "bSortable": false, "aTargets": [ 0 ] }
+		 *        ] } );
+		 *    } );
+         *
+         *  @example
+         *    // Using aoColumns
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumns": [ 
+		 *          { "bSortable": false },
+		 *          null,
+		 *          null,
+		 *          null,
+		 *          null
+		 *        ] } );
+		 *    } );
+         */
+        "bSortable":true,
+
+
+        /**
+         * <code>Deprecated</code> When using fnRender() for a column, you may wish
+         * to use the original data (before rendering) for sorting and filtering
+         * (the default is to used the rendered data that the user can see). This
+         * may be useful for dates etc.
+         *
+         * Please note that this option has now been deprecated and will be removed
+         * in the next version of DataTables. Please use mRender / mData rather than
+         * fnRender.
+         *  @type boolean
+         *  @default true
+         *  @dtopt Columns
+         *  @deprecated
+         */
+        "bUseRendered":true,
+
+
+        /**
+         * Enable or disable the display of this column.
+         *  @type boolean
+         *  @default true
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Using aoColumnDefs
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumnDefs": [ 
+		 *          { "bVisible": false, "aTargets": [ 0 ] }
+		 *        ] } );
+		 *    } );
+         *
+         *  @example
+         *    // Using aoColumns
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumns": [ 
+		 *          { "bVisible": false },
+		 *          null,
+		 *          null,
+		 *          null,
+		 *          null
+		 *        ] } );
+		 *    } );
+         */
+        "bVisible":true,
+
+
+        /**
+         * Developer definable function that is called whenever a cell is created (Ajax source,
+         * etc) or processed for input (DOM source). This can be used as a compliment to mRender
+         * allowing you to modify the DOM element (add background colour for example) when the
+         * element is available.
+         *  @type function
+         *  @param {element} nTd The TD node that has been created
+         *  @param {*} sData The Data for the cell
+         *  @param {array|object} oData The data for the whole row
+         *  @param {int} iRow The row index for the aoData data store
+         *  @param {int} iCol The column index for aoColumns
+         *  @dtopt Columns
+         *
+         *  @example
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumnDefs": [ {
+		 *          "aTargets": [3],
+		 *          "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
+		 *            if ( sData == "1.7" ) {
+		 *              $(nTd).css('color', 'blue')
+		 *            }
+		 *          }
+		 *        } ]
+		 *      });
+		 *    } );
+         */
+        "fnCreatedCell":null,
+
+
+        /**
+         * <code>Deprecated</code> Custom display function that will be called for the
+         * display of each cell in this column.
+         *
+         * Please note that this option has now been deprecated and will be removed
+         * in the next version of DataTables. Please use mRender / mData rather than
+         * fnRender.
+         *  @type function
+         *  @param {object} o Object with the following parameters:
+         *  @param {int}    o.iDataRow The row in aoData
+         *  @param {int}    o.iDataColumn The column in question
+         *  @param {array}  o.aData The data for the row in question
+         *  @param {object} o.oSettings The settings object for this DataTables instance
+         *  @param {object} o.mDataProp The data property used for this column
+         *  @param {*}      val The current cell value
+         *  @returns {string} The string you which to use in the display
+         *  @dtopt Columns
+         *  @deprecated
+         */
+        "fnRender":null,
+
+
+        /**
+         * The column index (starting from 0!) that you wish a sort to be performed
+         * upon when this column is selected for sorting. This can be used for sorting
+         * on hidden columns for example.
+         *  @type int
+         *  @default -1 <i>Use automatically calculated column index</i>
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Using aoColumnDefs
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumnDefs": [ 
+		 *          { "iDataSort": 1, "aTargets": [ 0 ] }
+		 *        ]
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Using aoColumns
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumns": [ 
+		 *          { "iDataSort": 1 },
+		 *          null,
+		 *          null,
+		 *          null,
+		 *          null
+		 *        ]
+		 *      } );
+		 *    } );
+         */
+        "iDataSort":-1,
+
+
+        /**
+         * This parameter has been replaced by mData in DataTables to ensure naming
+         * consistency. mDataProp can still be used, as there is backwards compatibility
+         * in DataTables for this option, but it is strongly recommended that you use
+         * mData in preference to mDataProp.
+         *  @name DataTable.defaults.columns.mDataProp
+         */
+
+
+        /**
+         * This property can be used to read data from any JSON data source property,
+         * including deeply nested objects / properties. mData can be given in a
+         * number of different ways which effect its behaviour:
+         *   <ul>
+         *     <li>integer - treated as an array index for the data source. This is the
+         *       default that DataTables uses (incrementally increased for each column).</li>
+         *     <li>string - read an object property from the data source. Note that you can
+         *       use Javascript dotted notation to read deep properties / arrays from the
+         *       data source.</li>
+         *     <li>null - the sDefaultContent option will be used for the cell (null
+         *       by default, so you will need to specify the default content you want -
+         *       typically an empty string). This can be useful on generated columns such
+         *       as edit / delete action columns.</li>
+         *     <li>function - the function given will be executed whenever DataTables
+         *       needs to set or get the data for a cell in the column. The function
+         *       takes three parameters:
+         *       <ul>
+         *         <li>{array|object} The data source for the row</li>
+         *         <li>{string} The type call data requested - this will be 'set' when
+         *           setting data or 'filter', 'display', 'type', 'sort' or undefined when
+         *           gathering data. Note that when <i>undefined</i> is given for the type
+         *           DataTables expects to get the raw data for the object back</li>
+         *         <li>{*} Data to set when the second parameter is 'set'.</li>
+         *       </ul>
+         *       The return value from the function is not required when 'set' is the type
+         *       of call, but otherwise the return is what will be used for the data
+         *       requested.</li>
+         *    </ul>
+         *
+         * Note that prior to DataTables 1.9.2 mData was called mDataProp. The name change
+         * reflects the flexibility of this property and is consistent with the naming of
+         * mRender. If 'mDataProp' is given, then it will still be used by DataTables, as
+         * it automatically maps the old name to the new if required.
+         *  @type string|int|function|null
+         *  @default null <i>Use automatically calculated column index</i>
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Read table data from objects
+         *    $(document).ready( function() {
+		 *      var oTable = $('#example').dataTable( {
+		 *        "sAjaxSource": "sources/deep.txt",
+		 *        "aoColumns": [
+		 *          { "mData": "engine" },
+		 *          { "mData": "browser" },
+		 *          { "mData": "platform.inner" },
+		 *          { "mData": "platform.details.0" },
+		 *          { "mData": "platform.details.1" }
+		 *        ]
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Using mData as a function to provide different information for
+         *    // sorting, filtering and display. In this case, currency (price)
+         *    $(document).ready( function() {
+		 *      var oTable = $('#example').dataTable( {
+		 *        "aoColumnDefs": [ {
+		 *          "aTargets": [ 0 ],
+		 *          "mData": function ( source, type, val ) {
+		 *            if (type === 'set') {
+		 *              source.price = val;
+		 *              // Store the computed dislay and filter values for efficiency
+		 *              source.price_display = val=="" ? "" : "$"+numberFormat(val);
+		 *              source.price_filter  = val=="" ? "" : "$"+numberFormat(val)+" "+val;
+		 *              return;
+		 *            }
+		 *            else if (type === 'display') {
+		 *              return source.price_display;
+		 *            }
+		 *            else if (type === 'filter') {
+		 *              return source.price_filter;
+		 *            }
+		 *            // 'sort', 'type' and undefined all just use the integer
+		 *            return source.price;
+		 *          }
+		 *        } ]
+		 *      } );
+		 *    } );
+         */
+        "mData":null,
+
+
+        /**
+         * This property is the rendering partner to mData and it is suggested that
+         * when you want to manipulate data for display (including filtering, sorting etc)
+         * but not altering the underlying data for the table, use this property. mData
+         * can actually do everything this property can and more, but this parameter is
+         * easier to use since there is no 'set' option. Like mData is can be given
+         * in a number of different ways to effect its behaviour, with the addition of
+         * supporting array syntax for easy outputting of arrays (including arrays of
+         * objects):
+         *   <ul>
+         *     <li>integer - treated as an array index for the data source. This is the
+         *       default that DataTables uses (incrementally increased for each column).</li>
+         *     <li>string - read an object property from the data source. Note that you can
+         *       use Javascript dotted notation to read deep properties / arrays from the
+         *       data source and also array brackets to indicate that the data reader should
+         *       loop over the data source array. When characters are given between the array
+         *       brackets, these characters are used to join the data source array together.
+         *       For example: "accounts[, ].name" would result in a comma separated list with
+         *       the 'name' value from the 'accounts' array of objects.</li>
+         *     <li>function - the function given will be executed whenever DataTables
+         *       needs to set or get the data for a cell in the column. The function
+         *       takes three parameters:
+         *       <ul>
+         *         <li>{array|object} The data source for the row (based on mData)</li>
+         *         <li>{string} The type call data requested - this will be 'filter', 'display',
+         *           'type' or 'sort'.</li>
+         *         <li>{array|object} The full data source for the row (not based on mData)</li>
+         *       </ul>
+         *       The return value from the function is what will be used for the data
+         *       requested.</li>
+         *    </ul>
+         *  @type string|int|function|null
+         *  @default null <i>Use mData</i>
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Create a comma separated list from an array of objects
+         *    $(document).ready( function() {
+		 *      var oTable = $('#example').dataTable( {
+		 *        "sAjaxSource": "sources/deep.txt",
+		 *        "aoColumns": [
+		 *          { "mData": "engine" },
+		 *          { "mData": "browser" },
+		 *          {
+		 *            "mData": "platform",
+		 *            "mRender": "[, ].name"
+		 *          }
+		 *        ]
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Use as a function to create a link from the data source
+         *    $(document).ready( function() {
+		 *      var oTable = $('#example').dataTable( {
+		 *        "aoColumnDefs": [
+		 *        {
+		 *          "aTargets": [ 0 ],
+		 *          "mData": "download_link",
+		 *          "mRender": function ( data, type, full ) {
+		 *            return '<a href="'+data+'">Download</a>';
+		 *          }
+		 *        ]
+		 *      } );
+		 *    } );
+		 */
+        "mRender":null,
+
+
+        /**
+         * Change the cell type created for the column - either TD cells or TH cells. This
+         * can be useful as TH cells have semantic meaning in the table body, allowing them
+         * to act as a header for a row (you may wish to add scope='row' to the TH elements).
+         *  @type string
+         *  @default td
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Make the first column use TH cells
+         *    $(document).ready( function() {
+		 *      var oTable = $('#example').dataTable( {
+		 *        "aoColumnDefs": [ {
+		 *          "aTargets": [ 0 ],
+		 *          "sCellType": "th"
+		 *        } ]
+		 *      } );
+		 *    } );
+         */
+        "sCellType":"td",
+
+
+        /**
+         * Class to give to each cell in this column.
+         *  @type string
+         *  @default <i>Empty string</i>
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Using aoColumnDefs
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumnDefs": [ 
+		 *          { "sClass": "my_class", "aTargets": [ 0 ] }
+		 *        ]
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Using aoColumns
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumns": [ 
+		 *          { "sClass": "my_class" },
+		 *          null,
+		 *          null,
+		 *          null,
+		 *          null
+		 *        ]
+		 *      } );
+		 *    } );
+         */
+        "sClass":"",
+
+        /**
+         * When DataTables calculates the column widths to assign to each column,
+         * it finds the longest string in each column and then constructs a
+         * temporary table and reads the widths from that. The problem with this
+         * is that "mmm" is much wider then "iiii", but the latter is a longer
+         * string - thus the calculation can go wrong (doing it properly and putting
+         * it into an DOM object and measuring that is horribly(!) slow). Thus as
+         * a "work around" we provide this option. It will append its value to the
+         * text that is found to be the longest string for the column - i.e. padding.
+         * Generally you shouldn't need this, and it is not documented on the
+         * general DataTables.net documentation
+         *  @type string
+         *  @default <i>Empty string<i>
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Using aoColumns
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumns": [ 
+		 *          null,
+		 *          null,
+		 *          null,
+		 *          {
+		 *            "sContentPadding": "mmm"
+		 *          }
+		 *        ]
+		 *      } );
+		 *    } );
+         */
+        "sContentPadding":"",
+
+
+        /**
+         * Allows a default value to be given for a column's data, and will be used
+         * whenever a null data source is encountered (this can be because mData
+         * is set to null, or because the data source itself is null).
+         *  @type string
+         *  @default null
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Using aoColumnDefs
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumnDefs": [ 
+		 *          {
+		 *            "mData": null,
+		 *            "sDefaultContent": "Edit",
+		 *            "aTargets": [ -1 ]
+		 *          }
+		 *        ]
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Using aoColumns
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumns": [ 
+		 *          null,
+		 *          null,
+		 *          null,
+		 *          {
+		 *            "mData": null,
+		 *            "sDefaultContent": "Edit"
+		 *          }
+		 *        ]
+		 *      } );
+		 *    } );
+         */
+        "sDefaultContent":null,
+
+
+        /**
+         * This parameter is only used in DataTables' server-side processing. It can
+         * be exceptionally useful to know what columns are being displayed on the
+         * client side, and to map these to database fields. When defined, the names
+         * also allow DataTables to reorder information from the server if it comes
+         * back in an unexpected order (i.e. if you switch your columns around on the
+         * client-side, your server-side code does not also need updating).
+         *  @type string
+         *  @default <i>Empty string</i>
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Using aoColumnDefs
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumnDefs": [ 
+		 *          { "sName": "engine", "aTargets": [ 0 ] },
+		 *          { "sName": "browser", "aTargets": [ 1 ] },
+		 *          { "sName": "platform", "aTargets": [ 2 ] },
+		 *          { "sName": "version", "aTargets": [ 3 ] },
+		 *          { "sName": "grade", "aTargets": [ 4 ] }
+		 *        ]
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Using aoColumns
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumns": [ 
+		 *          { "sName": "engine" },
+		 *          { "sName": "browser" },
+		 *          { "sName": "platform" },
+		 *          { "sName": "version" },
+		 *          { "sName": "grade" }
+		 *        ]
+		 *      } );
+		 *    } );
+         */
+        "sName":"",
+
+
+        /**
+         * Defines a data source type for the sorting which can be used to read
+         * real-time information from the table (updating the internally cached
+         * version) prior to sorting. This allows sorting to occur on user editable
+         * elements such as form inputs.
+         *  @type string
+         *  @default std
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Using aoColumnDefs
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumnDefs": [
+		 *          { "sSortDataType": "dom-text", "aTargets": [ 2, 3 ] },
+		 *          { "sType": "numeric", "aTargets": [ 3 ] },
+		 *          { "sSortDataType": "dom-select", "aTargets": [ 4 ] },
+		 *          { "sSortDataType": "dom-checkbox", "aTargets": [ 5 ] }
+		 *        ]
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Using aoColumns
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumns": [
+		 *          null,
+		 *          null,
+		 *          { "sSortDataType": "dom-text" },
+		 *          { "sSortDataType": "dom-text", "sType": "numeric" },
+		 *          { "sSortDataType": "dom-select" },
+		 *          { "sSortDataType": "dom-checkbox" }
+		 *        ]
+		 *      } );
+		 *    } );
+         */
+        "sSortDataType":"std",
+
+
+        /**
+         * The title of this column.
+         *  @type string
+         *  @default null <i>Derived from the 'TH' value for this column in the
+         *    original HTML table.</i>
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Using aoColumnDefs
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumnDefs": [ 
+		 *          { "sTitle": "My column title", "aTargets": [ 0 ] }
+		 *        ]
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Using aoColumns
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumns": [ 
+		 *          { "sTitle": "My column title" },
+		 *          null,
+		 *          null,
+		 *          null,
+		 *          null
+		 *        ]
+		 *      } );
+		 *    } );
+         */
+        "sTitle":null,
+
+
+        /**
+         * The type allows you to specify how the data for this column will be sorted.
+         * Four types (string, numeric, date and html (which will strip HTML tags
+         * before sorting)) are currently available. Note that only date formats
+         * understood by Javascript's Date() object will be accepted as type date. For
+         * example: "Mar 26, 2008 5:03 PM". May take the values: 'string', 'numeric',
+         * 'date' or 'html' (by default). Further types can be adding through
+         * plug-ins.
+         *  @type string
+         *  @default null <i>Auto-detected from raw data</i>
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Using aoColumnDefs
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumnDefs": [ 
+		 *          { "sType": "html", "aTargets": [ 0 ] }
+		 *        ]
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Using aoColumns
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumns": [ 
+		 *          { "sType": "html" },
+		 *          null,
+		 *          null,
+		 *          null,
+		 *          null
+		 *        ]
+		 *      } );
+		 *    } );
+         */
+        "sType":null,
+
+
+        /**
+         * Defining the width of the column, this parameter may take any CSS value
+         * (3em, 20px etc). DataTables apples 'smart' widths to columns which have not
+         * been given a specific width through this interface ensuring that the table
+         * remains readable.
+         *  @type string
+         *  @default null <i>Automatic</i>
+         *  @dtopt Columns
+         *
+         *  @example
+         *    // Using aoColumnDefs
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumnDefs": [ 
+		 *          { "sWidth": "20%", "aTargets": [ 0 ] }
+		 *        ]
+		 *      } );
+		 *    } );
+         *
+         *  @example
+         *    // Using aoColumns
+         *    $(document).ready( function() {
+		 *      $('#example').dataTable( {
+		 *        "aoColumns": [ 
+		 *          { "sWidth": "20%" },
+		 *          null,
+		 *          null,
+		 *          null,
+		 *          null
+		 *        ]
+		 *      } );
+		 *    } );
+         */
+        "sWidth":null
+      };
+
+
+      /**
+       * DataTables settings object - this holds all the information needed for a
+       * given table, including configuration, data and current application of the
+       * table options. DataTables does not have a single instance for each DataTable
+       * with the settings attached to that instance, but rather instances of the
+       * DataTable "class" are created on-the-fly as needed (typically by a
+       * $().dataTable() call) and the settings object is then applied to that
+       * instance.
+       *
+       * Note that this object is related to {@link DataTable.defaults} but this
+       * one is the internal data store for DataTables's cache of columns. It should
+       * NOT be manipulated outside of DataTables. Any configuration should be done
+       * through the initialisation options.
+       *  @namespace
+       *  @todo Really should attach the settings object to individual instances so we
+       *    don't need to create new instances on each $().dataTable() call (if the
+       *    table already exists). It would also save passing oSettings around and
+       *    into every single function. However, this is a very significant
+       *    architecture change for DataTables and will almost certainly break
+       *    backwards compatibility with older installations. This is something that
+       *    will be done in 2.0.
+       */
+      DataTable.models.oSettings = {
+        /**
+         * Primary features of DataTables and their enablement state.
+         *  @namespace
+         */
+        "oFeatures":{
+
+          /**
+           * Flag to say if DataTables should automatically try to calculate the
+           * optimum table and columns widths (true) or not (false).
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type boolean
+           */
+          "bAutoWidth":null,
+
+          /**
+           * Delay the creation of TR and TD elements until they are actually
+           * needed by a driven page draw. This can give a significant speed
+           * increase for Ajax source and Javascript source data, but makes no
+           * difference at all fro DOM and server-side processing tables.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type boolean
+           */
+          "bDeferRender":null,
+
+          /**
+           * Enable filtering on the table or not. Note that if this is disabled
+           * then there is no filtering at all on the table, including fnFilter.
+           * To just remove the filtering input use sDom and remove the 'f' option.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type boolean
+           */
+          "bFilter":null,
+
+          /**
+           * Table information element (the 'Showing x of y records' div) enable
+           * flag.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type boolean
+           */
+          "bInfo":null,
+
+          /**
+           * Present a user control allowing the end user to change the page size
+           * when pagination is enabled.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type boolean
+           */
+          "bLengthChange":null,
+
+          /**
+           * Pagination enabled or not. Note that if this is disabled then length
+           * changing must also be disabled.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type boolean
+           */
+          "bPaginate":null,
+
+          /**
+           * Processing indicator enable flag whenever DataTables is enacting a
+           * user request - typically an Ajax request for server-side processing.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type boolean
+           */
+          "bProcessing":null,
+
+          /**
+           * Server-side processing enabled flag - when enabled DataTables will
+           * get all data from the server for every draw - there is no filtering,
+           * sorting or paging done on the client-side.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type boolean
+           */
+          "bServerSide":null,
+
+          /**
+           * Sorting enablement flag.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type boolean
+           */
+          "bSort":null,
+
+          /**
+           * Apply a class to the columns which are being sorted to provide a
+           * visual highlight or not. This can slow things down when enabled since
+           * there is a lot of DOM interaction.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type boolean
+           */
+          "bSortClasses":null,
+
+          /**
+           * State saving enablement flag.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type boolean
+           */
+          "bStateSave":null
+        },
+
+
+        /**
+         * Scrolling settings for a table.
+         *  @namespace
+         */
+        "oScroll":{
+          /**
+           * Indicate if DataTables should be allowed to set the padding / margin
+           * etc for the scrolling header elements or not. Typically you will want
+           * this.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type boolean
+           */
+          "bAutoCss":null,
+
+          /**
+           * When the table is shorter in height than sScrollY, collapse the
+           * table container down to the height of the table (when true).
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type boolean
+           */
+          "bCollapse":null,
+
+          /**
+           * Infinite scrolling enablement flag. Now deprecated in favour of
+           * using the Scroller plug-in.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type boolean
+           */
+          "bInfinite":null,
+
+          /**
+           * Width of the scrollbar for the web-browser's platform. Calculated
+           * during table initialisation.
+           *  @type int
+           *  @default 0
+           */
+          "iBarWidth":0,
+
+          /**
+           * Space (in pixels) between the bottom of the scrolling container and
+           * the bottom of the scrolling viewport before the next page is loaded
+           * when using infinite scrolling.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type int
+           */
+          "iLoadGap":null,
+
+          /**
+           * Viewport width for horizontal scrolling. Horizontal scrolling is
+           * disabled if an empty string.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type string
+           */
+          "sX":null,
+
+          /**
+           * Width to expand the table to when using x-scrolling. Typically you
+           * should not need to use this.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type string
+           *  @deprecated
+           */
+          "sXInner":null,
+
+          /**
+           * Viewport height for vertical scrolling. Vertical scrolling is disabled
+           * if an empty string.
+           * Note that this parameter will be set by the initialisation routine. To
+           * set a default use {@link DataTable.defaults}.
+           *  @type string
+           */
+          "sY":null
+        },
+
+        /**
+         * Language information for the table.
+         *  @namespace
+         *  @extends DataTable.defaults.oLanguage
+         */
+        "oLanguage":{
+          /**
+           * Information callback function. See
+           * {@link DataTable.defaults.fnInfoCallback}
+           *  @type function
+           *  @default null
+           */
+          "fnInfoCallback":null
+        },
+
+        /**
+         * Browser support parameters
+         *  @namespace
+         */
+        "oBrowser":{
+          /**
+           * Indicate if the browser incorrectly calculates width:100% inside a
+           * scrolling element (IE6/7)
+           *  @type boolean
+           *  @default false
+           */
+          "bScrollOversize":false
+        },
+
+        /**
+         * Array referencing the nodes which are used for the features. The
+         * parameters of this object match what is allowed by sDom - i.e.
+         *   <ul>
+         *     <li>'l' - Length changing</li>
+         *     <li>'f' - Filtering input</li>
+         *     <li>'t' - The table!</li>
+         *     <li>'i' - Information</li>
+         *     <li>'p' - Pagination</li>
+         *     <li>'r' - pRocessing</li>
+         *   </ul>
+         *  @type array
+         *  @default []
+         */
+        "aanFeatures":[],
+
+        /**
+         * Store data information - see {@link DataTable.models.oRow} for detailed
+         * information.
+         *  @type array
+         *  @default []
+         */
+        "aoData":[],
+
+        /**
+         * Array of indexes which are in the current display (after filtering etc)
+         *  @type array
+         *  @default []
+         */
+        "aiDisplay":[],
+
+        /**
+         * Array of indexes for display - no filtering
+         *  @type array
+         *  @default []
+         */
+        "aiDisplayMaster":[],
+
+        /**
+         * Store information about each column that is in use
+         *  @type array
+         *  @default []
+         */
+        "aoColumns":[],
+
+        /**
+         * Store information about the table's header
+         *  @type array
+         *  @default []
+         */
+        "aoHeader":[],
+
+        /**
+         * Store information about the table's footer
+         *  @type array
+         *  @default []
+         */
+        "aoFooter":[],
+
+        /**
+         * Search data array for regular expression searching
+         *  @type array
+         *  @default []
+         */
+        "asDataSearch":[],
+
+        /**
+         * Store the applied global search information in case we want to force a
+         * research or compare the old search to a new one.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @namespace
+         *  @extends DataTable.models.oSearch
+         */
+        "oPreviousSearch":{},
+
+        /**
+         * Store the applied search for each column - see
+         * {@link DataTable.models.oSearch} for the format that is used for the
+         * filtering information for each column.
+         *  @type array
+         *  @default []
+         */
+        "aoPreSearchCols":[],
+
+        /**
+         * Sorting that is applied to the table. Note that the inner arrays are
+         * used in the following manner:
+         * <ul>
+         *   <li>Index 0 - column number</li>
+         *   <li>Index 1 - current sorting direction</li>
+         *   <li>Index 2 - index of asSorting for this column</li>
+         * </ul>
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type array
+         *  @todo These inner arrays should really be objects
+         */
+        "aaSorting":null,
+
+        /**
+         * Sorting that is always applied to the table (i.e. prefixed in front of
+         * aaSorting).
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type array|null
+         *  @default null
+         */
+        "aaSortingFixed":null,
+
+        /**
+         * Classes to use for the striping of a table.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type array
+         *  @default []
+         */
+        "asStripeClasses":null,
+
+        /**
+         * If restoring a table - we should restore its striping classes as well
+         *  @type array
+         *  @default []
+         */
+        "asDestroyStripes":[],
+
+        /**
+         * If restoring a table - we should restore its width
+         *  @type int
+         *  @default 0
+         */
+        "sDestroyWidth":0,
+
+        /**
+         * Callback functions array for every time a row is inserted (i.e. on a draw).
+         *  @type array
+         *  @default []
+         */
+        "aoRowCallback":[],
+
+        /**
+         * Callback functions for the header on each draw.
+         *  @type array
+         *  @default []
+         */
+        "aoHeaderCallback":[],
+
+        /**
+         * Callback function for the footer on each draw.
+         *  @type array
+         *  @default []
+         */
+        "aoFooterCallback":[],
+
+        /**
+         * Array of callback functions for draw callback functions
+         *  @type array
+         *  @default []
+         */
+        "aoDrawCallback":[],
+
+        /**
+         * Array of callback functions for row created function
+         *  @type array
+         *  @default []
+         */
+        "aoRowCreatedCallback":[],
+
+        /**
+         * Callback functions for just before the table is redrawn. A return of
+         * false will be used to cancel the draw.
+         *  @type array
+         *  @default []
+         */
+        "aoPreDrawCallback":[],
+
+        /**
+         * Callback functions for when the table has been initialised.
+         *  @type array
+         *  @default []
+         */
+        "aoInitComplete":[],
+
+
+        /**
+         * Callbacks for modifying the settings to be stored for state saving, prior to
+         * saving state.
+         *  @type array
+         *  @default []
+         */
+        "aoStateSaveParams":[],
+
+        /**
+         * Callbacks for modifying the settings that have been stored for state saving
+         * prior to using the stored values to restore the state.
+         *  @type array
+         *  @default []
+         */
+        "aoStateLoadParams":[],
+
+        /**
+         * Callbacks for operating on the settings object once the saved state has been
+         * loaded
+         *  @type array
+         *  @default []
+         */
+        "aoStateLoaded":[],
+
+        /**
+         * Cache the table ID for quick access
+         *  @type string
+         *  @default <i>Empty string</i>
+         */
+        "sTableId":"",
+
+        /**
+         * The TABLE node for the main table
+         *  @type node
+         *  @default null
+         */
+        "nTable":null,
+
+        /**
+         * Permanent ref to the thead element
+         *  @type node
+         *  @default null
+         */
+        "nTHead":null,
+
+        /**
+         * Permanent ref to the tfoot element - if it exists
+         *  @type node
+         *  @default null
+         */
+        "nTFoot":null,
+
+        /**
+         * Permanent ref to the tbody element
+         *  @type node
+         *  @default null
+         */
+        "nTBody":null,
+
+        /**
+         * Cache the wrapper node (contains all DataTables controlled elements)
+         *  @type node
+         *  @default null
+         */
+        "nTableWrapper":null,
+
+        /**
+         * Indicate if when using server-side processing the loading of data
+         * should be deferred until the second draw.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type boolean
+         *  @default false
+         */
+        "bDeferLoading":false,
+
+        /**
+         * Indicate if all required information has been read in
+         *  @type boolean
+         *  @default false
+         */
+        "bInitialised":false,
+
+        /**
+         * Information about open rows. Each object in the array has the parameters
+         * 'nTr' and 'nParent'
+         *  @type array
+         *  @default []
+         */
+        "aoOpenRows":[],
+
+        /**
+         * Dictate the positioning of DataTables' control elements - see
+         * {@link DataTable.model.oInit.sDom}.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type string
+         *  @default null
+         */
+        "sDom":null,
+
+        /**
+         * Which type of pagination should be used.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type string
+         *  @default two_button
+         */
+        "sPaginationType":"two_button",
+
+        /**
+         * The cookie duration (for bStateSave) in seconds.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type int
+         *  @default 0
+         */
+        "iCookieDuration":0,
+
+        /**
+         * The cookie name prefix.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type string
+         *  @default <i>Empty string</i>
+         */
+        "sCookiePrefix":"",
+
+        /**
+         * Callback function for cookie creation.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type function
+         *  @default null
+         */
+        "fnCookieCallback":null,
+
+        /**
+         * Array of callback functions for state saving. Each array element is an
+         * object with the following parameters:
+         *   <ul>
+         *     <li>function:fn - function to call. Takes two parameters, oSettings
+         *       and the JSON string to save that has been thus far created. Returns
+         *       a JSON string to be inserted into a json object
+         *       (i.e. '"param": [ 0, 1, 2]')</li>
+         *     <li>string:sName - name of callback</li>
+         *   </ul>
+         *  @type array
+         *  @default []
+         */
+        "aoStateSave":[],
+
+        /**
+         * Array of callback functions for state loading. Each array element is an
+         * object with the following parameters:
+         *   <ul>
+         *     <li>function:fn - function to call. Takes two parameters, oSettings
+         *       and the object stored. May return false to cancel state loading</li>
+         *     <li>string:sName - name of callback</li>
+         *   </ul>
+         *  @type array
+         *  @default []
+         */
+        "aoStateLoad":[],
+
+        /**
+         * State that was loaded from the cookie. Useful for back reference
+         *  @type object
+         *  @default null
+         */
+        "oLoadedState":null,
+
+        /**
+         * Source url for AJAX data for the table.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type string
+         *  @default null
+         */
+        "sAjaxSource":null,
+
+        /**
+         * Property from a given object from which to read the table data from. This
+         * can be an empty string (when not server-side processing), in which case
+         * it is  assumed an an array is given directly.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type string
+         */
+        "sAjaxDataProp":null,
+
+        /**
+         * Note if draw should be blocked while getting data
+         *  @type boolean
+         *  @default true
+         */
+        "bAjaxDataGet":true,
+
+        /**
+         * The last jQuery XHR object that was used for server-side data gathering.
+         * This can be used for working with the XHR information in one of the
+         * callbacks
+         *  @type object
+         *  @default null
+         */
+        "jqXHR":null,
+
+        /**
+         * Function to get the server-side data.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type function
+         */
+        "fnServerData":null,
+
+        /**
+         * Functions which are called prior to sending an Ajax request so extra
+         * parameters can easily be sent to the server
+         *  @type array
+         *  @default []
+         */
+        "aoServerParams":[],
+
+        /**
+         * Send the XHR HTTP method - GET or POST (could be PUT or DELETE if
+         * required).
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type string
+         */
+        "sServerMethod":null,
+
+        /**
+         * Format numbers for display.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type function
+         */
+        "fnFormatNumber":null,
+
+        /**
+         * List of options that can be used for the user selectable length menu.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type array
+         *  @default []
+         */
+        "aLengthMenu":null,
+
+        /**
+         * Counter for the draws that the table does. Also used as a tracker for
+         * server-side processing
+         *  @type int
+         *  @default 0
+         */
+        "iDraw":0,
+
+        /**
+         * Indicate if a redraw is being done - useful for Ajax
+         *  @type boolean
+         *  @default false
+         */
+        "bDrawing":false,
+
+        /**
+         * Draw index (iDraw) of the last error when parsing the returned data
+         *  @type int
+         *  @default -1
+         */
+        "iDrawError":-1,
+
+        /**
+         * Paging display length
+         *  @type int
+         *  @default 10
+         */
+        "_iDisplayLength":10,
+
+        /**
+         * Paging start point - aiDisplay index
+         *  @type int
+         *  @default 0
+         */
+        "_iDisplayStart":0,
+
+        /**
+         * Paging end point - aiDisplay index. Use fnDisplayEnd rather than
+         * this property to get the end point
+         *  @type int
+         *  @default 10
+         *  @private
+         */
+        "_iDisplayEnd":10,
+
+        /**
+         * Server-side processing - number of records in the result set
+         * (i.e. before filtering), Use fnRecordsTotal rather than
+         * this property to get the value of the number of records, regardless of
+         * the server-side processing setting.
+         *  @type int
+         *  @default 0
+         *  @private
+         */
+        "_iRecordsTotal":0,
+
+        /**
+         * Server-side processing - number of records in the current display set
+         * (i.e. after filtering). Use fnRecordsDisplay rather than
+         * this property to get the value of the number of records, regardless of
+         * the server-side processing setting.
+         *  @type boolean
+         *  @default 0
+         *  @private
+         */
+        "_iRecordsDisplay":0,
+
+        /**
+         * Flag to indicate if jQuery UI marking and classes should be used.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type boolean
+         */
+        "bJUI":null,
+
+        /**
+         * The classes to use for the table
+         *  @type object
+         *  @default {}
+         */
+        "oClasses":{},
+
+        /**
+         * Flag attached to the settings object so you can check in the draw
+         * callback if filtering has been done in the draw. Deprecated in favour of
+         * events.
+         *  @type boolean
+         *  @default false
+         *  @deprecated
+         */
+        "bFiltered":false,
+
+        /**
+         * Flag attached to the settings object so you can check in the draw
+         * callback if sorting has been done in the draw. Deprecated in favour of
+         * events.
+         *  @type boolean
+         *  @default false
+         *  @deprecated
+         */
+        "bSorted":false,
+
+        /**
+         * Indicate that if multiple rows are in the header and there is more than
+         * one unique cell per column, if the top one (true) or bottom one (false)
+         * should be used for sorting / title by DataTables.
+         * Note that this parameter will be set by the initialisation routine. To
+         * set a default use {@link DataTable.defaults}.
+         *  @type boolean
+         */
+        "bSortCellsTop":null,
+
+        /**
+         * Initialisation object that is used for the table
+         *  @type object
+         *  @default null
+         */
+        "oInit":null,
+
+        /**
+         * Destroy callback functions - for plug-ins to attach themselves to the
+         * destroy so they can clean up markup and events.
+         *  @type array
+         *  @default []
+         */
+        "aoDestroyCallback":[],
+
+
+        /**
+         * Get the number of records in the current record set, before filtering
+         *  @type function
+         */
+        "fnRecordsTotal":function () {
+          if (this.oFeatures.bServerSide) {
+            return parseInt(this._iRecordsTotal, 10);
+          } else {
+            return this.aiDisplayMaster.length;
+          }
+        },
+
+        /**
+         * Get the number of records in the current record set, after filtering
+         *  @type function
+         */
+        "fnRecordsDisplay":function () {
+          if (this.oFeatures.bServerSide) {
+            return parseInt(this._iRecordsDisplay, 10);
+          } else {
+            return this.aiDisplay.length;
+          }
+        },
+
+        /**
+         * Set the display end point - aiDisplay index
+         *  @type function
+         *  @todo Should do away with _iDisplayEnd and calculate it on-the-fly here
+         */
+        "fnDisplayEnd":function () {
+          if (this.oFeatures.bServerSide) {
+            if (this.oFeatures.bPaginate === false || this._iDisplayLength == -1) {
+              return this._iDisplayStart + this.aiDisplay.length;
+            } else {
+              return Math.min(this._iDisplayStart + this._iDisplayLength,
+                this._iRecordsDisplay);
+            }
+          } else {
+            return this._iDisplayEnd;
+          }
+        },
+
+        /**
+         * The DataTables object for this table
+         *  @type object
+         *  @default null
+         */
+        "oInstance":null,
+
+        /**
+         * Unique identifier for each instance of the DataTables object. If there
+         * is an ID on the table node, then it takes that value, otherwise an
+         * incrementing internal counter is used.
+         *  @type string
+         *  @default null
+         */
+        "sInstance":null,
+
+        /**
+         * tabindex attribute value that is added to DataTables control elements, allowing
+         * keyboard navigation of the table and its controls.
+         */
+        "iTabIndex":0,
+
+        /**
+         * DIV container for the footer scrolling table if scrolling
+         */
+        "nScrollHead":null,
+
+        /**
+         * DIV container for the footer scrolling table if scrolling
+         */
+        "nScrollFoot":null
+      };
+
+      /**
+       * Extension object for DataTables that is used to provide all extension options.
+       *
+       * Note that the <i>DataTable.ext</i> object is available through
+       * <i>jQuery.fn.dataTable.ext</i> where it may be accessed and manipulated. It is
+       * also aliased to <i>jQuery.fn.dataTableExt</i> for historic reasons.
+       *  @namespace
+       *  @extends DataTable.models.ext
+       */
+      DataTable.ext = $.extend(true, {}, DataTable.models.ext);
+
+      $.extend(DataTable.ext.oStdClasses, {
+        "sTable":"dataTable",
+
+        /* Two buttons buttons */
+        "sPagePrevEnabled":"paginate_enabled_previous",
+        "sPagePrevDisabled":"paginate_disabled_previous",
+        "sPageNextEnabled":"paginate_enabled_next",
+        "sPageNextDisabled":"paginate_disabled_next",
+        "sPageJUINext":"",
+        "sPageJUIPrev":"",
+
+        /* Full numbers paging buttons */
+        "sPageButton":"paginate_button",
+        "sPageButtonActive":"paginate_active",
+        "sPageButtonStaticDisabled":"paginate_button paginate_button_disabled",
+        "sPageFirst":"first",
+        "sPagePrevious":"previous",
+        "sPageNext":"next",
+        "sPageLast":"last",
+
+        /* Striping classes */
+        "sStripeOdd":"odd",
+        "sStripeEven":"even",
+
+        /* Empty row */
+        "sRowEmpty":"dataTables_empty",
+
+        /* Features */
+        "sWrapper":"dataTables_wrapper",
+        "sFilter":"dataTables_filter",
+        "sInfo":"dataTables_info",
+        "sPaging":"dataTables_paginate paging_", /* Note that the type is postfixed */
+        "sLength":"dataTables_length",
+        "sProcessing":"dataTables_processing",
+
+        /* Sorting */
+        "sSortAsc":"sorting_asc",
+        "sSortDesc":"sorting_desc",
+        "sSortable":"sorting", /* Sortable in both directions */
+        "sSortableAsc":"sorting_asc_disabled",
+        "sSortableDesc":"sorting_desc_disabled",
+        "sSortableNone":"sorting_disabled",
+        "sSortColumn":"sorting_", /* Note that an int is postfixed for the sorting order */
+        "sSortJUIAsc":"",
+        "sSortJUIDesc":"",
+        "sSortJUI":"",
+        "sSortJUIAscAllowed":"",
+        "sSortJUIDescAllowed":"",
+        "sSortJUIWrapper":"",
+        "sSortIcon":"",
+
+        /* Scrolling */
+        "sScrollWrapper":"dataTables_scroll",
+        "sScrollHead":"dataTables_scrollHead",
+        "sScrollHeadInner":"dataTables_scrollHeadInner",
+        "sScrollBody":"dataTables_scrollBody",
+        "sScrollFoot":"dataTables_scrollFoot",
+        "sScrollFootInner":"dataTables_scrollFootInner",
+
+        /* Misc */
+        "sFooterTH":"",
+        "sJUIHeader":"",
+        "sJUIFooter":""
+      });
+
+
+      $.extend(DataTable.ext.oJUIClasses, DataTable.ext.oStdClasses, {
+        /* Two buttons buttons */
+        "sPagePrevEnabled":"fg-button ui-button ui-state-default ui-corner-left",
+        "sPagePrevDisabled":"fg-button ui-button ui-state-default ui-corner-left ui-state-disabled",
+        "sPageNextEnabled":"fg-button ui-button ui-state-default ui-corner-right",
+        "sPageNextDisabled":"fg-button ui-button ui-state-default ui-corner-right ui-state-disabled",
+        "sPageJUINext":"ui-icon ui-icon-circle-arrow-e",
+        "sPageJUIPrev":"ui-icon ui-icon-circle-arrow-w",
+
+        /* Full numbers paging buttons */
+        "sPageButton":"fg-button ui-button ui-state-default",
+        "sPageButtonActive":"fg-button ui-button ui-state-default ui-state-disabled",
+        "sPageButtonStaticDisabled":"fg-button ui-button ui-state-default ui-state-disabled",
+        "sPageFirst":"first ui-corner-tl ui-corner-bl",
+        "sPageLast":"last ui-corner-tr ui-corner-br",
+
+        /* Features */
+        "sPaging":"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi " +
+          "ui-buttonset-multi paging_", /* Note that the type is postfixed */
+
+        /* Sorting */
+        "sSortAsc":"ui-state-default",
+        "sSortDesc":"ui-state-default",
+        "sSortable":"ui-state-default",
+        "sSortableAsc":"ui-state-default",
+        "sSortableDesc":"ui-state-default",
+        "sSortableNone":"ui-state-default",
+        "sSortJUIAsc":"css_right ui-icon ui-icon-triangle-1-n",
+        "sSortJUIDesc":"css_right ui-icon ui-icon-triangle-1-s",
+        "sSortJUI":"css_right ui-icon ui-icon-carat-2-n-s",
+        "sSortJUIAscAllowed":"css_right ui-icon ui-icon-carat-1-n",
+        "sSortJUIDescAllowed":"css_right ui-icon ui-icon-carat-1-s",
+        "sSortJUIWrapper":"DataTables_sort_wrapper",
+        "sSortIcon":"DataTables_sort_icon",
+
+        /* Scrolling */
+        "sScrollHead":"dataTables_scrollHead ui-state-default",
+        "sScrollFoot":"dataTables_scrollFoot ui-state-default",
+
+        /* Misc */
+        "sFooterTH":"ui-state-default",
+        "sJUIHeader":"fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix",
+        "sJUIFooter":"fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"
+      });
+
+      /*
+       * Variable: oPagination
+       * Purpose:  
+       * Scope:    jQuery.fn.dataTableExt
+       */
+      $.extend(DataTable.ext.oPagination, {
+        /*
+         * Variable: two_button
+         * Purpose:  Standard two button (forward/back) pagination
+         * Scope:    jQuery.fn.dataTableExt.oPagination
+         */
+        "two_button":{
+          /*
+           * Function: oPagination.two_button.fnInit
+           * Purpose:  Initialise dom elements required for pagination with forward/back buttons only
+           * Returns:  -
+           * Inputs:   object:oSettings - dataTables settings object
+           *           node:nPaging - the DIV which contains this pagination control
+           *           function:fnCallbackDraw - draw function which must be called on update
+           */
+          "fnInit":function (oSettings, nPaging, fnCallbackDraw) {
+            var oLang = oSettings.oLanguage.oPaginate;
+            var oClasses = oSettings.oClasses;
+            var fnClickHandler = function (e) {
+              if (oSettings.oApi._fnPageChange(oSettings, e.data.action)) {
+                fnCallbackDraw(oSettings);
+              }
+            };
+
+            var sAppend = (!oSettings.bJUI) ?
+              '<a class="' + oSettings.oClasses.sPagePrevDisabled + '" tabindex="' + oSettings.iTabIndex + '" role="button">' + oLang.sPrevious + '</a>' +
+                '<a class="' + oSettings.oClasses.sPageNextDisabled + '" tabindex="' + oSettings.iTabIndex + '" role="button">' + oLang.sNext + '</a>'
+              :
+              '<a class="' + oSettings.oClasses.sPagePrevDisabled + '" tabindex="' + oSettings.iTabIndex + '" role="button"><span class="' + oSettings.oClasses.sPageJUIPrev + '"></span></a>' +
+                '<a class="' + oSettings.oClasses.sPageNextDisabled + '" tabindex="' + oSettings.iTabIndex + '" role="button"><span class="' + oSettings.oClasses.sPageJUINext + '"></span></a>';
+            $(nPaging).append(sAppend);
+
+            var els = $('a', nPaging);
+            var nPrevious = els[0],
+              nNext = els[1];
+
+            oSettings.oApi._fnBindAction(nPrevious, {action:"previous"}, fnClickHandler);
+            oSettings.oApi._fnBindAction(nNext, {action:"next"}, fnClickHandler);
+
+            /* ID the first elements only */
+            if (!oSettings.aanFeatures.p) {
+              nPaging.id = oSettings.sTableId + '_paginate';
+              nPrevious.id = oSettings.sTableId + '_previous';
+              nNext.id = oSettings.sTableId + '_next';
+
+              nPrevious.setAttribute('aria-controls', oSettings.sTableId);
+              nNext.setAttribute('aria-controls', oSettings.sTableId);
+            }
+          },
+
+          /*
+           * Function: oPagination.two_button.fnUpdate
+           * Purpose:  Update the two button pagination at the end of the draw
+           * Returns:  -
+           * Inputs:   object:oSettings - dataTables settings object
+           *           function:fnCallbackDraw - draw function to call on page change
+           */
+          "fnUpdate":function (oSettings, fnCallbackDraw) {
+            if (!oSettings.aanFeatures.p) {
+              return;
+            }
+
+            var oClasses = oSettings.oClasses;
+            var an = oSettings.aanFeatures.p;
+            var nNode;
+
+            /* Loop over each instance of the pager */
+            for (var i = 0, iLen = an.length; i < iLen; i++) {
+              nNode = an[i].firstChild;
+              if (nNode) {
+                /* Previous page */
+                nNode.className = ( oSettings._iDisplayStart === 0 ) ?
+                  oClasses.sPagePrevDisabled : oClasses.sPagePrevEnabled;
+
+                /* Next page */
+                nNode = nNode.nextSibling;
+                nNode.className = ( oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay() ) ?
+                  oClasses.sPageNextDisabled : oClasses.sPageNextEnabled;
+              }
+            }
+          }
+        },
+
+
+        /*
+         * Variable: iFullNumbersShowPages
+         * Purpose:  Change the number of pages which can be seen
+         * Scope:    jQuery.fn.dataTableExt.oPagination
+         */
+        "iFullNumbersShowPages":5,
+
+        /*
+         * Variable: full_numbers
+         * Purpose:  Full numbers pagination
+         * Scope:    jQuery.fn.dataTableExt.oPagination
+         */
+        "full_numbers":{
+          /*
+           * Function: oPagination.full_numbers.fnInit
+           * Purpose:  Initialise dom elements required for pagination with a list of the pages
+           * Returns:  -
+           * Inputs:   object:oSettings - dataTables settings object
+           *           node:nPaging - the DIV which contains this pagination control
+           *           function:fnCallbackDraw - draw function which must be called on update
+           */
+          "fnInit":function (oSettings, nPaging, fnCallbackDraw) {
+            var oLang = oSettings.oLanguage.oPaginate;
+            var oClasses = oSettings.oClasses;
+            var fnClickHandler = function (e) {
+              if (oSettings.oApi._fnPageChange(oSettings, e.data.action)) {
+                fnCallbackDraw(oSettings);
+              }
+            };
+
+            $(nPaging).append(
+              '<a  tabindex="' + oSettings.iTabIndex + '" class="' + oClasses.sPageButton + " " + oClasses.sPageFirst + '">' + oLang.sFirst + '</a>' +
+                '<a  tabindex="' + oSettings.iTabIndex + '" class="' + oClasses.sPageButton + " " + oClasses.sPagePrevious + '">' + oLang.sPrevious + '</a>' +
+                '<span></span>' +
+                '<a tabindex="' + oSettings.iTabIndex + '" class="' + oClasses.sPageButton + " " + oClasses.sPageNext + '">' + oLang.sNext + '</a>' +
+                '<a tabindex="' + oSettings.iTabIndex + '" class="' + oClasses.sPageButton + " " + oClasses.sPageLast + '">' + oLang.sLast + '</a>'
+            );
+            var els = $('a', nPaging);
+            var nFirst = els[0],
+              nPrev = els[1],
+              nNext = els[2],
+              nLast = els[3];
+
+            oSettings.oApi._fnBindAction(nFirst, {action:"first"}, fnClickHandler);
+            oSettings.oApi._fnBindAction(nPrev, {action:"previous"}, fnClickHandler);
+            oSettings.oApi._fnBindAction(nNext, {action:"next"}, fnClickHandler);
+            oSettings.oApi._fnBindAction(nLast, {action:"last"}, fnClickHandler);
+
+            /* ID the first elements only */
+            if (!oSettings.aanFeatures.p) {
+              nPaging.id = oSettings.sTableId + '_paginate';
+              nFirst.id = oSettings.sTableId + '_first';
+              nPrev.id = oSettings.sTableId + '_previous';
+              nNext.id = oSettings.sTableId + '_next';
+              nLast.id = oSettings.sTableId + '_last';
+            }
+          },
+
+          /*
+           * Function: oPagination.full_numbers.fnUpdate
+           * Purpose:  Update the list of page buttons shows
+           * Returns:  -
+           * Inputs:   object:oSettings - dataTables settings object
+           *           function:fnCallbackDraw - draw function to call on page change
+           */
+          "fnUpdate":function (oSettings, fnCallbackDraw) {
+            if (!oSettings.aanFeatures.p) {
+              return;
+            }
+
+            var iPageCount = DataTable.ext.oPagination.iFullNumbersShowPages;
+            var iPageCountHalf = Math.floor(iPageCount / 2);
+            var iPages = Math.ceil((oSettings.fnRecordsDisplay()) / oSettings._iDisplayLength);
+            var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
+            var sList = "";
+            var iStartButton, iEndButton, i, iLen;
+            var oClasses = oSettings.oClasses;
+            var anButtons, anStatic, nPaginateList, nNode;
+            var an = oSettings.aanFeatures.p;
+            var fnBind = function (j) {
+              oSettings.oApi._fnBindAction(this, {"page":j + iStartButton - 1}, function (e) {
+                /* Use the information in the element to jump to the required page */
+                oSettings.oApi._fnPageChange(oSettings, e.data.page);
+                fnCallbackDraw(oSettings);
+                e.preventDefault();
+              });
+            };
+
+            /* Pages calculation */
+            if (oSettings._iDisplayLength === -1) {
+              iStartButton = 1;
+              iEndButton = 1;
+              iCurrentPage = 1;
+            }
+            else if (iPages < iPageCount) {
+              iStartButton = 1;
+              iEndButton = iPages;
+            }
+            else if (iCurrentPage <= iPageCountHalf) {
+              iStartButton = 1;
+              iEndButton = iPageCount;
+            }
+            else if (iCurrentPage >= (iPages - iPageCountHalf)) {
+              iStartButton = iPages - iPageCount + 1;
+              iEndButton = iPages;
+            }
+            else {
+              iStartButton = iCurrentPage - Math.ceil(iPageCount / 2) + 1;
+              iEndButton = iStartButton + iPageCount - 1;
+            }
+
+
+            /* Build the dynamic list */
+            for (i = iStartButton; i <= iEndButton; i++) {
+              sList += (iCurrentPage !== i) ?
+                '<a tabindex="' + oSettings.iTabIndex + '" class="' + oClasses.sPageButton + '">' + oSettings.fnFormatNumber(i) + '</a>' :
+                '<a tabindex="' + oSettings.iTabIndex + '" class="' + oClasses.sPageButtonActive + '">' + oSettings.fnFormatNumber(i) + '</a>';
+            }
+
+            /* Loop over each instance of the pager */
+            for (i = 0, iLen = an.length; i < iLen; i++) {
+              nNode = an[i];
+              if (!nNode.hasChildNodes()) {
+                continue;
+              }
+
+              /* Build up the dynamic list first - html and listeners */
+              $('span:eq(0)', nNode)
+                .html(sList)
+                .children('a').each(fnBind);
+
+              /* Update the permanent button's classes */
+              anButtons = nNode.getElementsByTagName('a');
+              anStatic = [
+                anButtons[0], anButtons[1],
+                anButtons[anButtons.length - 2], anButtons[anButtons.length - 1]
+              ];
+
+              $(anStatic).removeClass(oClasses.sPageButton + " " + oClasses.sPageButtonActive + " " + oClasses.sPageButtonStaticDisabled);
+              $([anStatic[0], anStatic[1]]).addClass(
+                (iCurrentPage == 1) ?
+                  oClasses.sPageButtonStaticDisabled :
+                  oClasses.sPageButton
+              );
+              $([anStatic[2], anStatic[3]]).addClass(
+                (iPages === 0 || iCurrentPage === iPages || oSettings._iDisplayLength === -1) ?
+                  oClasses.sPageButtonStaticDisabled :
+                  oClasses.sPageButton
+              );
+            }
+          }
+        }
+      });
+
+      $.extend(DataTable.ext.oSort, {
+        /*
+         * text sorting
+         */
+        "string-pre":function (a) {
+          if (typeof a != 'string') {
+            a = (a !== null && a.toString) ? a.toString() : '';
+          }
+          return a.toLowerCase();
+        },
+
+        "string-asc":function (x, y) {
+          return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+        },
+
+        "string-desc":function (x, y) {
+          return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+        },
+
+
+        /*
+         * html sorting (ignore html tags)
+         */
+        "html-pre":function (a) {
+          return a.replace(/<.*?>/g, "").toLowerCase();
+        },
+
+        "html-asc":function (x, y) {
+          return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+        },
+
+        "html-desc":function (x, y) {
+          return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+        },
+
+
+        /*
+         * date sorting
+         */
+        "date-pre":function (a) {
+          var x = Date.parse(a);
+
+          if (isNaN(x) || x === "") {
+            x = Date.parse("01/01/1970 00:00:00");
+          }
+          return x;
+        },
+
+        "date-asc":function (x, y) {
+          return x - y;
+        },
+
+        "date-desc":function (x, y) {
+          return y - x;
+        },
+
+
+        /*
+         * numerical sorting
+         */
+        "numeric-pre":function (a) {
+          return (a == "-" || a === "") ? 0 : a * 1;
+        },
+
+        "numeric-asc":function (x, y) {
+          return x - y;
+        },
+
+        "numeric-desc":function (x, y) {
+          return y - x;
+        }
+      });
+
+
+      $.extend(DataTable.ext.aTypes, [
+        /*
+         * Function: -
+         * Purpose:  Check to see if a string is numeric
+         * Returns:  string:'numeric' or null
+         * Inputs:   mixed:sText - string to check
+         */
+        function (sData) {
+          /* Allow zero length strings as a number */
+          if (typeof sData === 'number') {
+            return 'numeric';
+          }
+          else if (typeof sData !== 'string') {
+            return null;
+          }
+
+          var sValidFirstChars = "0123456789-";
+          var sValidChars = "0123456789.";
+          var Char;
+          var bDecimal = false;
+
+          /* Check for a valid first char (no period and allow negatives) */
+          Char = sData.charAt(0);
+          if (sValidFirstChars.indexOf(Char) == -1) {
+            return null;
+          }
+
+          /* Check all the other characters are valid */
+          for (var i = 1; i < sData.length; i++) {
+            Char = sData.charAt(i);
+            if (sValidChars.indexOf(Char) == -1) {
+              return null;
+            }
+
+            /* Only allowed one decimal place... */
+            if (Char == ".") {
+              if (bDecimal) {
+                return null;
+              }
+              bDecimal = true;
+            }
+          }
+
+          return 'numeric';
+        },
+
+        /*
+         * Function: -
+         * Purpose:  Check to see if a string is actually a formatted date
+         * Returns:  string:'date' or null
+         * Inputs:   string:sText - string to check
+         */
+        function (sData) {
+          var iParse = Date.parse(sData);
+          if ((iParse !== null && !isNaN(iParse)) || (typeof sData === 'string' && sData.length === 0)) {
+            return 'date';
+          }
+          return null;
+        },
+
+        /*
+         * Function: -
+         * Purpose:  Check to see if a string should be treated as an HTML string
+         * Returns:  string:'html' or null
+         * Inputs:   string:sText - string to check
+         */
+        function (sData) {
+          if (typeof sData === 'string' && sData.indexOf('<') != -1 && sData.indexOf('>') != -1) {
+            return 'html';
+          }
+          return null;
+        }
+      ]);
+
+
+      // jQuery aliases
+      $.fn.DataTable = DataTable;
+      $.fn.dataTable = DataTable;
+      $.fn.dataTableSettings = DataTable.settings;
+      $.fn.dataTableExt = DataTable.ext;
+
+
+      // Information about events fired by DataTables - for documentation.
+      /**
+       * Draw event, fired whenever the table is redrawn on the page, at the same point as
+       * fnDrawCallback. This may be useful for binding events or performing calculations when
+       * the table is altered at all.
+       *  @name DataTable#draw
+       *  @event
+       *  @param {event} e jQuery event object
+       *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}
+       */
+
+      /**
+       * Filter event, fired when the filtering applied to the table (using the build in global
+       * global filter, or column filters) is altered.
+       *  @name DataTable#filter
+       *  @event
+       *  @param {event} e jQuery event object
+       *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}
+       */
+
+      /**
+       * Page change event, fired when the paging of the table is altered.
+       *  @name DataTable#page
+       *  @event
+       *  @param {event} e jQuery event object
+       *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}
+       */
+
+      /**
+       * Sort event, fired when the sorting applied to the table is altered.
+       *  @name DataTable#sort
+       *  @event
+       *  @param {event} e jQuery event object
+       *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}
+       */
+
+      /**
+       * DataTables initialisation complete event, fired when the table is fully drawn,
+       * including Ajax data loaded, if Ajax data is required.
+       *  @name DataTable#init
+       *  @event
+       *  @param {event} e jQuery event object
+       *  @param {object} oSettings DataTables settings object
+       *  @param {object} json The JSON object request from the server - only
+       *    present if client-side Ajax sourced data is used</li></ol>
+       */
+
+      /**
+       * State save event, fired when the table has changed state a new state save is required.
+       * This method allows modification of the state saving object prior to actually doing the
+       * save, including addition or other state properties (for plug-ins) or modification
+       * of a DataTables core property.
+       *  @name DataTable#stateSaveParams
+       *  @event
+       *  @param {event} e jQuery event object
+       *  @param {object} oSettings DataTables settings object
+       *  @param {object} json The state information to be saved
+       */
+
+      /**
+       * State load event, fired when the table is loading state from the stored data, but
+       * prior to the settings object being modified by the saved state - allowing modification
+       * of the saved state is required or loading of state for a plug-in.
+       *  @name DataTable#stateLoadParams
+       *  @event
+       *  @param {event} e jQuery event object
+       *  @param {object} oSettings DataTables settings object
+       *  @param {object} json The saved state information
+       */
+
+      /**
+       * State loaded event, fired when state has been loaded from stored data and the settings
+       * object has been modified by the loaded data.
+       *  @name DataTable#stateLoaded
+       *  @event
+       *  @param {event} e jQuery event object
+       *  @param {object} oSettings DataTables settings object
+       *  @param {object} json The saved state information
+       */
+
+      /**
+       * Processing event, fired when DataTables is doing some kind of processing (be it,
+       * sort, filter or anything else). Can be used to indicate to the end user that
+       * there is something happening, or that something has finished.
+       *  @name DataTable#processing
+       *  @event
+       *  @param {event} e jQuery event object
+       *  @param {object} oSettings DataTables settings object
+       *  @param {boolean} bShow Flag for if DataTables is doing processing or not
+       */
+
+      /**
+       * Ajax (XHR) event, fired whenever an Ajax request is completed from a request to
+       * made to the server for new data (note that this trigger is called in fnServerData,
+       * if you override fnServerData and which to use this event, you need to trigger it in
+       * you success function).
+       *  @name DataTable#xhr
+       *  @event
+       *  @param {event} e jQuery event object
+       *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}
+       *  @param {object} json JSON returned from the server
+       */
+
+      /**
+       * Destroy event, fired when the DataTable is destroyed by calling fnDestroy or passing
+       * the bDestroy:true parameter in the initialisation object. This can be used to remove
+       * bound events, added DOM nodes, etc.
+       *  @name DataTable#destroy
+       *  @event
+       *  @param {event} e jQuery event object
+       *  @param {object} o DataTables settings object {@link DataTable.models.oSettings}
+       */
+    }));
+
+}(window, document));
+

+ 334 - 0
ambari-web/vendor/scripts/jquery.ui.core.js

@@ -0,0 +1,334 @@
+/*!
+ * jQuery UI 1.8.23
+ *
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI
+ */
+(function( $, undefined ) {
+
+// 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.8.23",
+
+	keyCode: {
+		ALT: 18,
+		BACKSPACE: 8,
+		CAPS_LOCK: 20,
+		COMMA: 188,
+		COMMAND: 91,
+		COMMAND_LEFT: 91, // COMMAND
+		COMMAND_RIGHT: 93,
+		CONTROL: 17,
+		DELETE: 46,
+		DOWN: 40,
+		END: 35,
+		ENTER: 13,
+		ESCAPE: 27,
+		HOME: 36,
+		INSERT: 45,
+		LEFT: 37,
+		MENU: 93, // COMMAND_RIGHT
+		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,
+		SHIFT: 16,
+		SPACE: 32,
+		TAB: 9,
+		UP: 38,
+		WINDOWS: 91 // COMMAND
+	}
+});
+
+// plugins
+$.fn.extend({
+	propAttr: $.fn.prop || $.fn.attr,
+
+	_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 (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
+			scrollParent = this.parents().filter(function() {
+				return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
+			}).eq(0);
+		} else {
+			scrollParent = this.parents().filter(function() {
+				return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
+			}).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;
+	},
+
+	disableSelection: function() {
+		return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
+			".ui-disableSelection", function( event ) {
+				event.preventDefault();
+			});
+	},
+
+	enableSelection: function() {
+		return this.unbind( ".ui-disableSelection" );
+	}
+});
+
+// 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( $.curCSS( elem, "padding" + this, true) ) || 0;
+				if ( border ) {
+					size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
+				}
+				if ( margin ) {
+					size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 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" );
+			});
+		};
+	});
+}
+
+// selectors
+function focusable( element, isTabIndexNotNaN ) {
+	var nodeName = element.nodeName.toLowerCase();
+	if ( "area" === nodeName ) {
+		var map = element.parentNode,
+			mapName = map.name,
+			img;
+		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 !$( element ).parents().andSelf().filter(function() {
+		return $.curCSS( this, "visibility" ) === "hidden" ||
+			$.expr.filters.hidden( this );
+	}).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 elemnt 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";
+});
+
+// jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css
+if ( !$.curCSS ) {
+	$.curCSS = $.css;
+}
+
+
+
+
+
+// deprecated
+$.extend( $.ui, {
+	// $.ui.plugin is deprecated.  Use the proxy pattern instead.
+	plugin: {
+		add: function( module, option, set ) {
+			var proto = $.ui[ module ].prototype;
+			for ( var i in set ) {
+				proto.plugins[ i ] = proto.plugins[ i ] || [];
+				proto.plugins[ i ].push( [ option, set[ i ] ] );
+			}
+		},
+		call: function( instance, name, args ) {
+			var set = instance.plugins[ name ];
+			if ( !set || !instance.element[ 0 ].parentNode ) {
+				return;
+			}
+	
+			for ( var i = 0; i < set.length; i++ ) {
+				if ( instance.options[ set[ i ][ 0 ] ] ) {
+					set[ i ][ 1 ].apply( instance.element, args );
+				}
+			}
+		}
+	},
+	
+	// will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
+	contains: function( a, b ) {
+		return document.compareDocumentPosition ?
+			a.compareDocumentPosition( b ) & 16 :
+			a !== b && a.contains( b );
+	},
+	
+	// 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 );

+ 2224 - 0
ambari-web/vendor/scripts/jquery.ui.custom-effects.js

@@ -0,0 +1,2224 @@
+/*! jQuery UI - v1.9.0 - 2012-10-22
+* http://jqueryui.com
+* Includes: 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
+* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */
+
+;(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 = [],
+			source;
+
+		// 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, i ) {
+
+			// 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,
+		r, g, b;
+
+	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( value ) {
+				// 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,
+		camelCase,
+		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.0",
+
+	// 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 optinos as the first parameter
+	if ( $.isPlainObject( effect ) ) {
+		options = effect;
+		effect = effect.effect;
+	}
+
+	// convert to an object
+	effect = { effect: effect };
+
+	// catch (effect)
+	if ( options === undefined ) {
+		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()
+		};
+
+	$.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
+			}
+	});
+
+	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 } : 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 el = $( this ),
+		props = [ "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" ],
+		original, baseline, factor,
+		position = el.css( "position" );
+
+	if ( mode === "show" ) {
+		el.show();
+	}
+	original = {
+		height: el.height(),
+		width: el.width(),
+		outerHeight: el.outerHeight(),
+		outerWidth: el.outerWidth()
+	};
+
+	el.from = o.from || original;
+	el.to = o.to || 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 );
+			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, restore ? props : props1 );
+	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 = props.concat(vProps).concat(hProps);
+
+		el.find( "*[width]" ).each( function(){
+			var child = $( this ),
+				c_original = {
+					height: child.height(),
+					width: child.width()
+				};
+			if (restore) {
+				$.effects.save(child, props2);
+			}
+
+			child.from = {
+				height: c_original.height * factor.from.y,
+				width: c_original.width * factor.from.x
+			};
+			child.to = {
+				height: c_original.height * factor.to.y,
+				width: 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, restore ? props : props1 );
+			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);

+ 1854 - 0
ambari-web/vendor/scripts/jquery.ui.datepicker.js

@@ -0,0 +1,1854 @@
+/*!
+ * jQuery UI Datepicker 1.8.23
+ *
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Datepicker
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ */
+(function( $, undefined ) {
+
+$.extend($.ui, { datepicker: { version: "1.8.23" } });
+
+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").
+				removeAttr("disabled");
+		}
+		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").
+				attr("disabled", "disabled");
+		}
+		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;
+		});
+		if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
+			$.datepicker._pos[0] -= document.documentElement.scrollLeft;
+			$.datepicker._pos[1] -= document.documentElement.scrollTop;
+		}
+		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;
+			if ($.effects && $.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) {
+		var self = this;
+		self.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);
+			};
+			if ($.effects && $.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){
+			throw "Extra/unparsed characters found in date: " + value.substring(iValue);
+		}
+		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 + ($.browser.msie && parseInt($.browser.version,10) < 7 && !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.bind('mouseout', function(event) {
+			var elem = $( event.target ).closest( selector );
+			if ( !elem.length ) {
+				return;
+			}
+			elem.removeClass( "ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover" );
+		})
+		.bind('mouseover', function(event) {
+			var elem = $( event.target ).closest( selector );
+			if ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) ||
+					!elem.length ) {
+				return;
+			}
+			elem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
+			elem.addClass('ui-state-hover');
+			if (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover');
+			if (elem.hasClass('ui-datepicker-next')) elem.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;
+};
+
+/* Determine whether an object is an array. */
+function isArray(a) {
+	return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
+		(a.constructor && a.constructor.toString().match(/\Array\(\)/))));
+};
+
+/* 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('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.8.23";
+
+// Workaround for #4055
+// Add another global to avoid noConflict issues with inline event handlers
+window['DP_jQuery_' + dpuuid] = $;
+
+})(jQuery);

+ 175 - 0
ambari-web/vendor/scripts/jquery.ui.mouse.js

@@ -0,0 +1,175 @@
+/*!
+ * jQuery UI Mouse 1.8.23
+ *
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Mouse
+ *
+ * Depends:
+ *	jquery.ui.widget.js
+ */
+(function ($, undefined) {
+
+  var mouseHandled = false;
+  $(document).mouseup(function (e) {
+    mouseHandled = false;
+  });
+
+  $.widget("ui.mouse", {
+    options:{
+      cancel:':input,option',
+      distance:1,
+      delay:0
+    },
+    _mouseInit:function () {
+      var self = this;
+
+      this.element
+        .bind('mousedown.' + this.widgetName, function (event) {
+          return self._mouseDown(event);
+        })
+        .bind('click.' + this.widgetName, function (event) {
+          if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
+            $.removeData(event.target, self.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 self = 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 () {
+          self.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 self._mouseMove(event);
+      };
+      this._mouseUpDelegate = function (event) {
+        return self._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 ($.browser.msie && !(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);

+ 662 - 0
ambari-web/vendor/scripts/jquery.ui.slider.js

@@ -0,0 +1,662 @@
+/*!
+ * jQuery UI Slider 1.8.23
+ *
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Slider
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.mouse.js
+ *	jquery.ui.widget.js
+ */
+(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, {
+
+	widgetEventPrefix: "slide",
+
+	options: {
+		animate: false,
+		distance: 0,
+		max: 100,
+		min: 0,
+		orientation: "horizontal",
+		range: false,
+		step: 1,
+		value: 0,
+		values: null
+	},
+
+	_create: function() {
+		var self = this,
+			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>",
+			handleCount = ( o.values && o.values.length ) || 1,
+			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 : "" ) );
+		}
+
+		for ( var i = existingHandles.length; i < handleCount; i += 1 ) {
+			handles.push( handle );
+		}
+
+		this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( self.element ) );
+
+		this.handle = this.handles.eq( 0 );
+
+		this.handles.add( this.range ).filter( "a" )
+			.click(function( event ) {
+				event.preventDefault();
+			})
+			.hover(function() {
+				if ( !o.disabled ) {
+					$( this ).addClass( "ui-state-hover" );
+				}
+			}, 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( "index.ui-slider-handle", i );
+		});
+
+		this.handles
+			.keydown(function( event ) {
+				var index = $( this ).data( "index.ui-slider-handle" ),
+					allowed,
+					curVal,
+					newVal,
+					step;
+	
+				if ( self.options.disabled ) {
+					return;
+				}
+	
+				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 ( !self._keySliding ) {
+							self._keySliding = true;
+							$( this ).addClass( "ui-state-active" );
+							allowed = self._start( event, index );
+							if ( allowed === false ) {
+								return;
+							}
+						}
+						break;
+				}
+	
+				step = self.options.step;
+				if ( self.options.values && self.options.values.length ) {
+					curVal = newVal = self.values( index );
+				} else {
+					curVal = newVal = self.value();
+				}
+	
+				switch ( event.keyCode ) {
+					case $.ui.keyCode.HOME:
+						newVal = self._valueMin();
+						break;
+					case $.ui.keyCode.END:
+						newVal = self._valueMax();
+						break;
+					case $.ui.keyCode.PAGE_UP:
+						newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) );
+						break;
+					case $.ui.keyCode.PAGE_DOWN:
+						newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) );
+						break;
+					case $.ui.keyCode.UP:
+					case $.ui.keyCode.RIGHT:
+						if ( curVal === self._valueMax() ) {
+							return;
+						}
+						newVal = self._trimAlignValue( curVal + step );
+						break;
+					case $.ui.keyCode.DOWN:
+					case $.ui.keyCode.LEFT:
+						if ( curVal === self._valueMin() ) {
+							return;
+						}
+						newVal = self._trimAlignValue( curVal - step );
+						break;
+				}
+	
+				self._slide( event, index, newVal );
+			})
+			.keyup(function( event ) {
+				var index = $( this ).data( "index.ui-slider-handle" );
+	
+				if ( self._keySliding ) {
+					self._keySliding = false;
+					self._stop( event, index );
+					self._change( event, index );
+					$( this ).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" )
+			.removeData( "slider" )
+			.unbind( ".slider" );
+
+		this._mouseDestroy();
+
+		return this;
+	},
+
+	_mouseCapture: function( event ) {
+		var o = this.options,
+			position,
+			normValue,
+			distance,
+			closestHandle,
+			self,
+			index,
+			allowed,
+			offset,
+			mouseOverHandle;
+
+		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;
+		self = this;
+		this.handles.each(function( i ) {
+			var thisDistance = Math.abs( normValue - self.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;
+
+		self._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( event ) {
+		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.propAttr( "disabled", true );
+					this.element.addClass( "ui-disabled" );
+				} else {
+					this.handles.propAttr( "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;
+		}
+	},
+
+	//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 oRange = this.options.range,
+			o = this.options,
+			self = this,
+			animate = ( !this._animateOff ) ? o.animate : false,
+			valPercent,
+			_set = {},
+			lastValPercent,
+			value,
+			valueMin,
+			valueMax;
+
+		if ( this.options.values && this.options.values.length ) {
+			this.handles.each(function( i, j ) {
+				valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100;
+				_set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+				$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+				if ( self.options.range === true ) {
+					if ( self.orientation === "horizontal" ) {
+						if ( i === 0 ) {
+							self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
+						}
+						if ( i === 1 ) {
+							self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+						}
+					} else {
+						if ( i === 0 ) {
+							self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
+						}
+						if ( i === 1 ) {
+							self.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[ self.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 } );
+			}
+		}
+	}
+
+});
+
+$.extend( $.ui.slider, {
+	version: "1.8.23"
+});
+
+}(jQuery));

+ 1087 - 0
ambari-web/vendor/scripts/jquery.ui.sortable.js

@@ -0,0 +1,1087 @@
+/*!
+ * jQuery UI Sortable 1.9.0
+ * http://jqueryui.com
+ *
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/sortable/
+ *
+ * Depends:
+ *	jquery.ui.core.js
+ *	jquery.ui.mouse.js
+ *	jquery.ui.widget.js
+ */
+(function( $, undefined ) {
+
+$.widget("ui.sortable", $.ui.mouse, {
+	version: "1.9.0",
+	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)");
+
+		for (var i=0; i < this.items.length; i++) {
+
+			for (var j=0; j < list.length; j++) {
+				if(list[j] == this.items[i].item[0])
+					this.items.splice(i,1);
+			};
+
+		};
+
+	},
+
+	_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 if(this.currentContainer != this.containers[innermostIndex]) {
+
+			//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 base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
+			for (var j = this.items.length - 1; j >= 0; j--) {
+				if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
+				var cur = this.containers[innermostIndex].floating ? this.items[j].item.offset().left : this.items[j].item.offset().top;
+				if(Math.abs(cur - base) < dist) {
+					dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
+					this.direction = (cur - base > 0) ? 'down' : 'up';
+				}
+			}
+
+			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' && $.browser.msie)) //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);

+ 276 - 0
ambari-web/vendor/scripts/jquery.ui.widget.js

@@ -0,0 +1,276 @@
+/*!
+ * jQuery UI Widget 1.8.23
+ *
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Widget
+ */
+(function ($, undefined) {
+
+// jQuery 1.4+
+  if ($.cleanData) {
+    var _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);
+    };
+  } else {
+    var _remove = $.fn.remove;
+    $.fn.remove = function (selector, keepData) {
+      return this.each(function () {
+        if (!keepData) {
+          if (!selector || $.filter(selector, [ this ]).length) {
+            $("*", this).add([ this ]).each(function () {
+              try {
+                $(this).triggerHandler("remove");
+                // http://bugs.jquery.com/ticket/8235
+              } catch (e) {
+              }
+            });
+          }
+        }
+        return _remove.call($(this), selector, keepData);
+      });
+    };
+  }
+
+  $.widget = function (name, base, prototype) {
+    var namespace = name.split(".")[ 0 ],
+      fullName;
+    name = name.split(".")[ 1 ];
+    fullName = namespace + "-" + name;
+
+    if (!prototype) {
+      prototype = base;
+      base = $.Widget;
+    }
+
+    // create selector for plugin
+    $.expr[ ":" ][ fullName ] = function (elem) {
+      return !!$.data(elem, name);
+    };
+
+    $[ namespace ] = $[ namespace ] || {};
+    $[ namespace ][ name ] = function (options, element) {
+      // allow instantiation without initializing for simple inheritance
+      if (arguments.length) {
+        this._createWidget(options, element);
+      }
+    };
+
+    var 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
+//	$.each( basePrototype, function( key, val ) {
+//		if ( $.isPlainObject(val) ) {
+//			basePrototype[ key ] = $.extend( {}, val );
+//		}
+//	});
+    basePrototype.options = $.extend(true, {}, basePrototype.options);
+    $[ namespace ][ name ].prototype = $.extend(true, basePrototype, {
+      namespace:namespace,
+      widgetName:name,
+      widgetEventPrefix:$[ namespace ][ name ].prototype.widgetEventPrefix || name,
+      widgetBaseClass:fullName
+    }, prototype);
+
+    $.widget.bridge(name, $[ namespace ][ name ]);
+  };
+
+  $.widget.bridge = function (name, object) {
+    $.fn[ name ] = function (options) {
+      var isMethodCall = typeof options === "string",
+        args = Array.prototype.slice.call(arguments, 1),
+        returnValue = this;
+
+      // allow multiple hashes to be passed on init
+      options = !isMethodCall && args.length ?
+        $.extend.apply(null, [ true, options ].concat(args)) :
+        options;
+
+      // prevent calls to internal methods
+      if (isMethodCall && options.charAt(0) === "_") {
+        return returnValue;
+      }
+
+      if (isMethodCall) {
+        this.each(function () {
+          var instance = $.data(this, name),
+            methodValue = instance && $.isFunction(instance[options]) ?
+              instance[ options ].apply(instance, args) :
+              instance;
+          // TODO: add this back in 1.9 and use $.error() (see #5972)
+//				if ( !instance ) {
+//					throw "cannot call methods on " + name + " prior to initialization; " +
+//						"attempted to call method '" + options + "'";
+//				}
+//				if ( !$.isFunction( instance[options] ) ) {
+//					throw "no such method '" + options + "' for " + name + " widget instance";
+//				}
+//				var methodValue = instance[ options ].apply( instance, args );
+          if (methodValue !== instance && methodValue !== undefined) {
+            returnValue = methodValue;
+            return false;
+          }
+        });
+      } else {
+        this.each(function () {
+          var instance = $.data(this, name);
+          if (instance) {
+            instance.option(options || {})._init();
+          } else {
+            $.data(this, name, new object(options, this));
+          }
+        });
+      }
+
+      return returnValue;
+    };
+  };
+
+  $.Widget = function (options, element) {
+    // allow instantiation without initializing for simple inheritance
+    if (arguments.length) {
+      this._createWidget(options, element);
+    }
+  };
+
+  $.Widget.prototype = {
+    widgetName:"widget",
+    widgetEventPrefix:"",
+    options:{
+      disabled:false
+    },
+    _createWidget:function (options, element) {
+      // $.widget.bridge stores the plugin instance, but we do it anyway
+      // so that it's stored even before the _create function runs
+      $.data(element, this.widgetName, this);
+      this.element = $(element);
+      this.options = $.extend(true, {},
+        this.options,
+        this._getCreateOptions(),
+        options);
+
+      var self = this;
+      this.element.bind("remove." + this.widgetName, function () {
+        self.destroy();
+      });
+
+      this._create();
+      this._trigger("create");
+      this._init();
+    },
+    _getCreateOptions:function () {
+      return $.metadata && $.metadata.get(this.element[0])[ this.widgetName ];
+    },
+    _create:function () {
+    },
+    _init:function () {
+    },
+
+    destroy:function () {
+      this.element
+        .unbind("." + this.widgetName)
+        .removeData(this.widgetName);
+      this.widget()
+        .unbind("." + this.widgetName)
+        .removeAttr("aria-disabled")
+        .removeClass(
+        this.widgetBaseClass + "-disabled " +
+          "ui-state-disabled");
+    },
+
+    widget:function () {
+      return this.element;
+    },
+
+    option:function (key, value) {
+      var options = key;
+
+      if (arguments.length === 0) {
+        // don't return a reference to the internal hash
+        return $.extend({}, this.options);
+      }
+
+      if (typeof key === "string") {
+        if (value === undefined) {
+          return this.options[ key ];
+        }
+        options = {};
+        options[ key ] = value;
+      }
+
+      this._setOptions(options);
+
+      return this;
+    },
+    _setOptions:function (options) {
+      var self = this;
+      $.each(options, function (key, value) {
+        self._setOption(key, value);
+      });
+
+      return this;
+    },
+    _setOption:function (key, value) {
+      this.options[ key ] = value;
+
+      if (key === "disabled") {
+        this.widget()
+          [ value ? "addClass" : "removeClass"](
+          this.widgetBaseClass + "-disabled" + " " +
+            "ui-state-disabled")
+          .attr("aria-disabled", value);
+      }
+
+      return this;
+    },
+
+    enable:function () {
+      return this._setOption("disabled", false);
+    },
+    disable:function () {
+      return this._setOption("disabled", true);
+    },
+
+    _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.call(this.element[0], event, data) === false ||
+        event.isDefaultPrevented() );
+    }
+  };
+
+})(jQuery);

+ 665 - 0
ambari-web/vendor/scripts/workflow_visualization.js

@@ -0,0 +1,665 @@
+/*
+ * D3 Sankey diagram 
+ * another type to display graph
+ */
+d3.sankey = function () {
+  var sankey = {},
+    nodeWidth = 24,
+    nodePadding = 8,
+    size = [1, 1],
+    nodes = [],
+    links = [],
+    overlapLinksAtSources = false,
+    overlapLinksAtTargets = false,
+    minValue = 1;
+
+  sankey.nodeWidth = function (_) {
+    if (!arguments.length) return nodeWidth;
+    nodeWidth = +_;
+    return sankey;
+  };
+
+  sankey.nodePadding = function (_) {
+    if (!arguments.length) return nodePadding;
+    nodePadding = +_;
+    return sankey;
+  };
+
+  sankey.nodes = function (_) {
+    if (!arguments.length) return nodes;
+    nodes = _;
+    return sankey;
+  };
+
+  sankey.links = function (_) {
+    if (!arguments.length) return links;
+    links = _;
+    return sankey;
+  };
+
+  sankey.size = function (_) {
+    if (!arguments.length) return size;
+    size = _;
+    return sankey;
+  };
+
+  sankey.overlapLinksAtSources = function (_) {
+    if (!arguments.length) return overlapLinksAtSources;
+    overlapLinksAtSources = _;
+    return sankey;
+  };
+
+  sankey.overlapLinksAtTargets = function (_) {
+    if (!arguments.length) return overlapLinksAtTargets;
+    overlapLinksAtTargets = _;
+    return sankey;
+  };
+
+  sankey.minValue = function (_) {
+    if (!arguments.length) return minValue;
+    minValue = _;
+    return sankey;
+  };
+
+  sankey.layout = function (iterations) {
+    computeNodeLinks();
+    computeNodeValues();
+    computeNodeBreadths();
+    computeNodeDepths(iterations);
+    computeLinkDepths();
+    return sankey;
+  };
+
+  sankey.relayout = function () {
+    computeLinkDepths();
+    return sankey;
+  };
+
+  sankey.link = function () {
+    var curvature = .5;
+
+    function link(d) {
+      var x0 = d.source.x + d.source.dx,
+        x1 = d.target.x,
+        xi = d3.interpolateNumber(x0, x1),
+        x2 = xi(curvature),
+        x3 = xi(1 - curvature),
+        y0 = d.source.y + (overlapLinksAtSources ? 0 : d.sy) + d.dy / 2,
+        y1 = d.target.y + (overlapLinksAtTargets ? 0 : d.ty) + d.dy / 2;
+      return "M" + x0 + "," + y0
+        + "C" + x2 + "," + y0
+        + " " + x3 + "," + y1
+        + " " + x1 + "," + y1;
+    }
+
+    link.curvature = function (_) {
+      if (!arguments.length) return curvature;
+      curvature = +_;
+      return link;
+    };
+
+    return link;
+  };
+
+  // Populate the sourceLinks and targetLinks for each node.
+  // Also, if the source and target are not objects, assume they are indices.
+  function computeNodeLinks() {
+    nodes.forEach(function (node) {
+      node.sourceLinks = [];
+      node.targetLinks = [];
+    });
+    links.forEach(function (link) {
+      var source = link.source,
+        target = link.target;
+      if (typeof source === "number") source = link.source = nodes[link.source];
+      if (typeof target === "number") target = link.target = nodes[link.target];
+      source.sourceLinks.push(link);
+      target.targetLinks.push(link);
+      if ("value" in link)
+        link.value = Math.max(link.value, minValue);
+      else
+        link.value = minValue;
+    });
+  }
+
+  // Compute the value (size) of each node by summing the associated links.
+  function computeNodeValues() {
+    nodes.forEach(function (node) {
+      if ("value" in node)
+        node.value = Math.max(node.value, minValue);
+      else
+        node.value = minValue;
+      if (node.sourceLinks.length > 0) {
+        if (overlapLinksAtSources)
+          node.value = Math.max(node.value, d3.max(node.sourceLinks, value));
+        else
+          node.value = Math.max(node.value, d3.sum(node.sourceLinks, value));
+      }
+      if (node.targetLinks.length > 0) {
+        if (overlapLinksAtTargets)
+          node.value = Math.max(node.value, d3.max(node.targetLinks, value));
+        else
+          node.value = Math.max(node.value, d3.sum(node.targetLinks, value));
+      }
+    });
+  }
+
+  // Iteratively assign the breadth (x-position) for each node.
+  // Nodes are assigned the maximum breadth of incoming neighbors plus one;
+  // nodes with no incoming links are assigned breadth zero, while
+  // nodes with no outgoing links are assigned the maximum breadth.
+  function computeNodeBreadths() {
+    var remainingNodes = nodes,
+      nextNodes,
+      x = 0;
+
+    while (remainingNodes.length) {
+      nextNodes = [];
+      remainingNodes.forEach(function (node) {
+        node.x = x;
+        node.dx = nodeWidth;
+        node.sourceLinks.forEach(function (link) {
+          nextNodes.push(link.target);
+        });
+      });
+      remainingNodes = nextNodes;
+      ++x;
+    }
+
+    //
+    moveSinksRight(x);
+    scaleNodeBreadths((size[0] - nodeWidth) / (x - 1));
+  }
+
+  function moveSourcesRight() {
+    nodes.forEach(function (node) {
+      if (!node.targetLinks.length) {
+        node.x = d3.min(node.sourceLinks, function (d) {
+          return d.target.x;
+        }) - 1;
+      }
+    });
+  }
+
+  function moveSinksRight(x) {
+    nodes.forEach(function (node) {
+      if (!node.sourceLinks.length) {
+        node.x = x - 1;
+      }
+    });
+  }
+
+  function scaleNodeBreadths(kx) {
+    nodes.forEach(function (node) {
+      node.x *= kx;
+    });
+  }
+
+  function computeNodeDepths(iterations) {
+    var nodesByBreadth = d3.nest()
+      .key(function (d) {
+        return d.x;
+      })
+      .sortKeys(d3.ascending)
+      .entries(nodes)
+      .map(function (d) {
+        return d.values;
+      });
+
+    //
+    initializeNodeDepth();
+    resolveCollisions();
+    for (var alpha = 1; iterations > 0; --iterations) {
+      relaxRightToLeft(alpha *= .99);
+      resolveCollisions();
+      relaxLeftToRight(alpha);
+      resolveCollisions();
+    }
+
+    function initializeNodeDepth() {
+      var ky = d3.min(nodesByBreadth, function (nodes) {
+        return (size[1] - (nodes.length - 1) * nodePadding) / d3.sum(nodes, value);
+      });
+
+      nodesByBreadth.forEach(function (nodes) {
+        nodes.forEach(function (node, i) {
+          node.y = i;
+          node.dy = node.value * ky;
+        });
+      });
+
+      links.forEach(function (link) {
+        link.dy = link.value * ky;
+      });
+    }
+
+    function relaxLeftToRight(alpha) {
+      nodesByBreadth.forEach(function (nodes, breadth) {
+        nodes.forEach(function (node) {
+          if (node.targetLinks.length) {
+            var y = d3.sum(node.targetLinks, weightedSource) / d3.sum(node.targetLinks, value);
+            node.y += (y - center(node)) * alpha;
+          }
+        });
+      });
+
+      function weightedSource(link) {
+        return center(link.source) * link.value;
+      }
+    }
+
+    function relaxRightToLeft(alpha) {
+      nodesByBreadth.slice().reverse().forEach(function (nodes) {
+        nodes.forEach(function (node) {
+          if (node.sourceLinks.length) {
+            var y = d3.sum(node.sourceLinks, weightedTarget) / d3.sum(node.sourceLinks, value);
+            node.y += (y - center(node)) * alpha;
+          }
+        });
+      });
+
+      function weightedTarget(link) {
+        return center(link.target) * link.value;
+      }
+    }
+
+    function resolveCollisions() {
+      nodesByBreadth.forEach(function (nodes) {
+        var node,
+          dy,
+          y0 = 0,
+          n = nodes.length,
+          i;
+
+        // Push any overlapping nodes down.
+        nodes.sort(ascendingDepth);
+        for (i = 0; i < n; ++i) {
+          node = nodes[i];
+          dy = y0 - node.y;
+          if (dy > 0) node.y += dy;
+          y0 = node.y + node.dy + nodePadding;
+        }
+
+        // If the bottommost node goes outside the bounds, push it back up.
+        dy = y0 - nodePadding - size[1];
+        if (dy > 0) {
+          y0 = node.y -= dy;
+
+          // Push any overlapping nodes back up.
+          for (i = n - 2; i >= 0; --i) {
+            node = nodes[i];
+            dy = node.y + node.dy + nodePadding - y0;
+            if (dy > 0) node.y -= dy;
+            y0 = node.y;
+          }
+        }
+      });
+    }
+
+    function ascendingDepth(a, b) {
+      return a.y - b.y;
+    }
+  }
+
+  function computeLinkDepths() {
+    nodes.forEach(function (node) {
+      node.sourceLinks.sort(ascendingTargetDepth);
+      node.targetLinks.sort(ascendingSourceDepth);
+    });
+    nodes.forEach(function (node) {
+      var sy = 0, ty = 0;
+      node.sourceLinks.forEach(function (link) {
+        link.sy = sy;
+        sy += link.dy;
+      });
+      node.targetLinks.forEach(function (link) {
+        link.ty = ty;
+        ty += link.dy;
+      });
+    });
+
+    function ascendingSourceDepth(a, b) {
+      return a.source.y - b.source.y;
+    }
+
+    function ascendingTargetDepth(a, b) {
+      return a.target.y - b.target.y;
+    }
+  }
+
+  function center(node) {
+    return node.y + node.dy / 2;
+  }
+
+  function value(link) {
+    return link.value;
+  }
+
+  return sankey;
+};
+/*
+ * Example usage:
+ *
+ *  var dv = new DagViewer(false,'pig_5')
+ *  .setPhysicalParametrs(width,height[,charge,gravity])
+ *  .setData(dagSchema [,jobsData])
+ *  .drawDag([nodeSize,largeNodeSize,linkDistance]);
+ */
+function DagViewer(type, domId) {
+  // initialize variables and force layout
+  this._nodes = new Array();
+  this._links = new Array();
+  this._numNodes = 0;
+  this._type = type;
+  this._id = domId;
+}
+DagViewer.prototype.setPhysicalParametrs = function (w, h, charge, gravity) {
+  this._w = w;
+  this._h = h;
+  this._gravity = gravity || 0.1;
+  this._charge = charge || -1000;
+  this._force = d3.layout.force()
+    .size([w, h])
+    .gravity(this._gravity)
+    .charge(this._charge);
+  return this;
+}
+
+//set workflow schema
+DagViewer.prototype.setData = function (wfData, jobData) {
+  // create map from entity names to nodes
+  var existingNodes = new Array();
+  var jobData = (jobData) ? jobData : new Array();
+  // iterate through job data
+  for (var i = 0; i < jobData.length; i++) {
+    this._addNode(existingNodes, jobData[i].name, jobData[i]);
+  }
+  var dag = eval('(' + wfData + ')').dag;
+  // for each source node in the context, create links between it and its target nodes
+  for (var source in dag) {
+    var sourceNode = this._getNode(source, existingNodes);
+    for (var i = 0; i < dag[source].length; i++) {
+      var targetNode = this._getNode(dag[source][i], existingNodes);
+      this._addLink(sourceNode, targetNode);
+    }
+  }
+  return this;
+}
+// add a node to the nodes array and to a provided map of entity names to nodes
+DagViewer.prototype._addNode = function (existingNodes, entityName, node) {
+  existingNodes[entityName] = node;
+  this._nodes.push(node);
+  this._numNodes++;
+}
+
+// add a link between sourceNode and targetNode
+DagViewer.prototype._addLink = function (sourceNode, targetNode) {
+  var status = false;
+  if (sourceNode.status && targetNode.status)
+    status = true;
+  this._links.push({"source":sourceNode, "target":targetNode, "status":status, "value":sourceNode.output});
+}
+
+// get the node for an entity name, or add it if it doesn't exist
+// called after job nodes have all been added
+DagViewer.prototype._getNode = function (entityName, existingNodes) {
+  if (!(entityName in existingNodes))
+    this._addNode(existingNodes, entityName, { "name":entityName, "status":false, "input":1, "output":1});
+  return existingNodes[entityName];
+}
+// display the graph
+DagViewer.prototype.drawDag = function (nodeSize, largeNodeSize, linkDistance) {
+  this._nodeSize = nodeSize || 18;
+  this._largeNodeSize = largeNodeSize || 30;
+  this._linkDistance = linkDistance || 100;
+  // add new display to specified div
+  this._svg = d3.select("div#" + this._id).append("svg:svg")
+    .attr("width", this._w)
+    .attr("height", this._h);
+  // add sankey diagram or graph depending on type
+  if (this._type)
+    this._addSankey();
+  else
+    this._addDag();
+  return this;
+}
+//draw the graph 
+DagViewer.prototype._addDag = function () {
+  var w = this._w;
+  var h = this._h;
+  var nodeSize = this._nodeSize;
+  var largeNodeSize = this._largeNodeSize;
+  var linkDistance = this._linkDistance;
+  // add nodes and links to force layout
+  this._force.nodes(this._nodes)
+    .links(this._links)
+    .linkDistance(this._linkDistance);
+
+  // defs for arrowheads marked as to whether they link finished jobs or not
+  this._svg.append("svg:defs").selectAll("marker")
+    .data(["finished", "unfinished"])
+    .enter().append("svg:marker")
+    .attr("id", String)
+    .attr("viewBox", "0 -5 10 10")
+    .attr("refX", nodeSize + 10)
+    .attr("refY", 0)
+    .attr("markerWidth", 6)
+    .attr("markerHeight", 6)
+    .attr("orient", "auto")
+    .append("svg:path")
+    .attr("d", "M0,-5L10,0L0,5");
+
+  // create links between the nodes
+  var lines = this._svg.append("svg:g").selectAll("line")
+    .data(this._links)
+    .enter().append("svg:line")
+    .attr("class", function (d) {
+      return "link" + (d.status ? " finished" : "");
+    })
+    .attr("marker-end", function (d) {
+      return "url(#" + (d.status ? "finished" : "unfinished") + ")";
+    });
+
+  // create a circle for each node
+  var circles = this._svg.append("svg:g").selectAll("circle")
+    .data(this._nodes)
+    .enter().append("svg:circle")
+    .attr("r", nodeSize)
+    .attr("class", function (d) {
+      return "node " + (d.status ? " finished" : "");
+    })
+    .attr("id", function (d) {
+      return d.name;
+    })
+    .on("dblclick", click)
+    .call(this._force.drag);
+
+  // create text group for each node label
+  var text = this._svg.append("svg:g").selectAll("g")
+    .data(this._nodes)
+    .enter().append("svg:g");
+
+  // add a shadow copy of the node label (will have a lighter color and thicker
+  // stroke for legibility
+  text.append("svg:text")
+    .attr("x", nodeSize + 3)
+    .attr("y", ".31em")
+    .attr("class", "shadow")
+    .text(function (d) {
+      return d.name;
+    });
+
+  // add the main node label
+  text.append("svg:text")
+    .attr("x", nodeSize + 3)
+    .attr("y", ".31em")
+    .text(function (d) {
+      return d.name;
+    });
+
+  // add mouseover actions
+  this._addMouseoverSelection(circles);
+
+  // start the force layout
+  this._force.on("tick", tick)
+    .start();
+
+  // on force tick, adjust positions of nodes, links, and text
+  function tick() {
+    circles.attr("transform", function (d) {
+      if (d.x < largeNodeSize) d.x = largeNodeSize;
+      if (d.y < largeNodeSize) d.y = largeNodeSize;
+      if (d.x > w - largeNodeSize) d.x = w - largeNodeSize;
+      if (d.y > h - largeNodeSize) d.y = h - largeNodeSize;
+      return "translate(" + d.x + "," + d.y + ")";
+    });
+
+    lines.attr("x1", function (d) {
+      return d.source.x
+    })
+      .attr("y1", function (d) {
+        return d.source.y
+      })
+      .attr("x2", function (d) {
+        return d.target.x
+      })
+      .attr("y2", function (d) {
+        return d.target.y
+      });
+
+    text.attr("transform", function (d) {
+      return "translate(" + d.x + "," + d.y + ")";
+    });
+  }
+
+  // on double click, fix node in place or release it
+  function click() {
+    d3.select(this).attr("fixed", function (d) {
+      if (d.fixed) {
+        d.fixed = false
+      } else {
+        d.fixed = true
+      }
+      return d.fixed;
+    });
+  }
+}
+//define mouseover action on nodes
+DagViewer.prototype._addMouseoverSelection = function (nodes) {
+  var nodeSize = this._nodeSize;
+  var largeNodeSize = this._largeNodeSize;
+  // on mouseover, change size of node 
+  nodes.on("mouseover", function (d) {
+    d3.select(this).transition().attr("r", largeNodeSize);
+  })
+    .on("mouseout", function (d) {
+      d3.select(this).transition().attr("r", nodeSize);
+    });
+}
+//draw Sankey diagram
+DagViewer.prototype._addSankey = function () {
+  var w = this._w;
+  var h = this._h;
+
+  // add svg group
+  var svgg = this._svg.append("g");
+
+  var color = d3.scale.category20();
+
+  // create sankey
+  var sankey = d3.sankey()
+    .nodeWidth(15)
+    .nodePadding(10)
+    .size([w, h * 0.67]);
+
+  // get sankey links
+  var spath = sankey.link();
+
+  // set sankey nodes and links and calculate their positions and sizes
+  sankey
+    .nodes(this._nodes)
+    .links(this._links)
+    .overlapLinksAtSources(true)
+    .layout(32);
+
+  // create links and set their attributes
+  var slink = svgg.append("g").selectAll(".link")
+    .data(this._links)
+    .enter().append("path")
+    .attr("class", "slink")
+    .attr("d", spath)
+    .style("stroke-width", function (d) {
+      return Math.max(1, d.dy);
+    })
+    .sort(function (a, b) {
+      return b.dy - a.dy;
+    });
+
+  // add mouseover text to links
+  slink.append("title")
+    .text(function (d) {
+      return d.source.name + " - " + d.target.name + ": " + d.value;
+    });
+
+  // create node groups, set their attributes, and enable vertical dragging
+  var snode = svgg.append("g").selectAll(".node")
+    .data(this._nodes)
+    .enter().append("g")
+    .attr("class", "snode")
+    .attr("transform", function (d) {
+      return "translate(" + d.x + "," + d.y + ")";
+    })
+    .call(d3.behavior.drag()
+    .origin(function (d) {
+      return d;
+    })
+    .on("dragstart", function () {
+      this.parentNode.appendChild(this);
+    })
+    .on("drag", dragmove));
+
+  // add rectangles to node groups
+  snode.append("rect")
+    .attr("height", function (d) {
+      return d.dy;
+    })
+    .attr("width", sankey.nodeWidth())
+    .style("fill", function (d) {
+      return d.color = color(d.name.replace(/ .*/, ""));
+    })
+    .style("stroke", function (d) {
+      return d3.rgb(d.color).darker(2);
+    })
+    .append("title")
+    .text(function (d) {
+      return "info" in d ? d.info.join("\n") : d.name;
+    });
+
+  // add node labels
+  snode.append("text")
+    .attr("x", -6)
+    .attr("y", function (d) {
+      return d.dy / 2;
+    })
+    .attr("dy", ".35em")
+    .attr("text-anchor", "end")
+    .attr("transform", null)
+    .text(function (d) {
+      return d.name;
+    })
+    .filter(function (d) {
+      return d.x < w / 2;
+    })
+    .attr("x", 6 + sankey.nodeWidth())
+    .attr("text-anchor", "start");
+
+  // add mouseover actions
+  this._addMouseoverSelection(snode);
+
+  // enable vertical dragging with recalculation of link placement
+  function dragmove(d) {
+    d3.select(this).attr("transform", "translate(" + d.x + "," + (d.y = Math.max(0, Math.min(h - d.dy, d3.event.y))) + ")");
+    sankey.relayout();
+    slink.attr("d", spath);
+  }
+}

+ 74 - 0
ambari-web/vendor/styles/cubism.css

@@ -0,0 +1,74 @@
+/*
+ * D3  visualization components 
+ * Styles for Dag viewer and Sankey diagram
+ */
+.wfdag {
+  width: 100%;
+}
+
+#dag_viewer line.link {
+  fill: none;
+  stroke: #666;
+  stroke-width: 2.5px;
+}
+
+#dag_viewer marker#finished {
+  fill: green;
+}
+
+#dag_viewer line.link.finished {
+  stroke: green;
+}
+
+#dag_viewer circle {
+  fill: #ccc;
+  stroke: #333;
+  stroke-width: 1.5px;
+}
+
+#dag_viewer circle.finished {
+  fill: green;
+}
+
+#dag_viewer text {
+  font: 20px sans-serif;
+  pointer-events: none;
+}
+
+#dag_viewer text.hover {
+  font: 10px sans-serif;
+}
+
+#dag_viewer text.hover.shadow {
+  stroke: #fff;
+  stroke-width: 4px;
+  stroke-opacity: .8;
+}
+
+#dag_viewer text.shadow {
+  stroke: #fff;
+  stroke-width: 4px;
+  stroke-opacity: .8;
+}
+
+#dag_viewer .snode rect {
+  cursor: move;
+  fill-opacity: .9;
+  shape-rendering: crispEdges;
+}
+
+#dag_viewer .snode text {
+  pointer-events: none;
+  text-shadow: 0 1px 0 #fff;
+}
+
+#dag_viewer .slink {
+  fill: none;
+  stroke: #000;
+  stroke-opacity: .2;
+}
+
+#dag_viewer .slink:hover {
+  stroke-opacity: .5;
+}
+

Some files were not shown because too many files changed in this diff