]> source.dussan.org Git - jquery-ui.git/commitdiff
(no commit message)
authorPaul Bakaus <paul.bakaus@googlemail.com>
Fri, 23 May 2008 09:26:18 +0000 (09:26 +0000)
committerPaul Bakaus <paul.bakaus@googlemail.com>
Fri, 23 May 2008 09:26:18 +0000 (09:26 +0000)
27 files changed:
ui/source/GPL-LICENSE.txt [new file with mode: 0644]
ui/source/MIT-LICENSE.txt [new file with mode: 0644]
ui/source/effects.blind.js [new file with mode: 0644]
ui/source/effects.bounce.js [new file with mode: 0644]
ui/source/effects.clip.js [new file with mode: 0644]
ui/source/effects.core.js [new file with mode: 0644]
ui/source/effects.drop.js [new file with mode: 0644]
ui/source/effects.explode.js [new file with mode: 0644]
ui/source/effects.fade.js [new file with mode: 0644]
ui/source/effects.fold.js [new file with mode: 0644]
ui/source/effects.highlight.js [new file with mode: 0644]
ui/source/effects.pulsate.js [new file with mode: 0644]
ui/source/effects.scale.js [new file with mode: 0644]
ui/source/effects.shake.js [new file with mode: 0644]
ui/source/effects.slide.js [new file with mode: 0644]
ui/source/effects.transfer.js [new file with mode: 0644]
ui/source/ui.accordion.js [new file with mode: 0644]
ui/source/ui.core.js [new file with mode: 0644]
ui/source/ui.datepicker.js [new file with mode: 0644]
ui/source/ui.dialog.js [new file with mode: 0644]
ui/source/ui.draggable.js [new file with mode: 0644]
ui/source/ui.droppable.js [new file with mode: 0644]
ui/source/ui.resizable.js [new file with mode: 0644]
ui/source/ui.selectable.js [new file with mode: 0644]
ui/source/ui.slider.js [new file with mode: 0644]
ui/source/ui.sortable.js [new file with mode: 0644]
ui/source/ui.tabs.js [new file with mode: 0644]

diff --git a/ui/source/GPL-LICENSE.txt b/ui/source/GPL-LICENSE.txt
new file mode 100644 (file)
index 0000000..4f3d3e8
--- /dev/null
@@ -0,0 +1,278 @@
+        GNU GENERAL PUBLIC LICENSE\r
+           Version 2, June 1991\r
+\r
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.\r
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\r
+ Everyone is permitted to copy and distribute verbatim copies\r
+ of this license document, but changing it is not allowed.\r
+\r
+          Preamble\r
+\r
+  The licenses for most software are designed to take away your\r
+freedom to share and change it.  By contrast, the GNU General Public\r
+License is intended to guarantee your freedom to share and change free\r
+software--to make sure the software is free for all its users.  This\r
+General Public License applies to most of the Free Software\r
+Foundation's software and to any other program whose authors commit to\r
+using it.  (Some other Free Software Foundation software is covered by\r
+the GNU Lesser General Public License instead.)  You can apply it to\r
+your programs, too.\r
+\r
+  When we speak of free software, we are referring to freedom, not\r
+price.  Our General Public Licenses are designed to make sure that you\r
+have the freedom to distribute copies of free software (and charge for\r
+this service if you wish), that you receive source code or can get it\r
+if you want it, that you can change the software or use pieces of it\r
+in new free programs; and that you know you can do these things.\r
+\r
+  To protect your rights, we need to make restrictions that forbid\r
+anyone to deny you these rights or to ask you to surrender the rights.\r
+These restrictions translate to certain responsibilities for you if you\r
+distribute copies of the software, or if you modify it.\r
+\r
+  For example, if you distribute copies of such a program, whether\r
+gratis or for a fee, you must give the recipients all the rights that\r
+you have.  You must make sure that they, too, receive or can get the\r
+source code.  And you must show them these terms so they know their\r
+rights.\r
+\r
+  We protect your rights with two steps: (1) copyright the software, and\r
+(2) offer you this license which gives you legal permission to copy,\r
+distribute and/or modify the software.\r
+\r
+  Also, for each author's protection and ours, we want to make certain\r
+that everyone understands that there is no warranty for this free\r
+software.  If the software is modified by someone else and passed on, we\r
+want its recipients to know that what they have is not the original, so\r
+that any problems introduced by others will not reflect on the original\r
+authors' reputations.\r
+\r
+  Finally, any free program is threatened constantly by software\r
+patents.  We wish to avoid the danger that redistributors of a free\r
+program will individually obtain patent licenses, in effect making the\r
+program proprietary.  To prevent this, we have made it clear that any\r
+patent must be licensed for everyone's free use or not licensed at all.\r
+\r
+  The precise terms and conditions for copying, distribution and\r
+modification follow.\r
+\r
+        GNU GENERAL PUBLIC LICENSE\r
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\r
+\r
+  0. This License applies to any program or other work which contains\r
+a notice placed by the copyright holder saying it may be distributed\r
+under the terms of this General Public License.  The "Program", below,\r
+refers to any such program or work, and a "work based on the Program"\r
+means either the Program or any derivative work under copyright law:\r
+that is to say, a work containing the Program or a portion of it,\r
+either verbatim or with modifications and/or translated into another\r
+language.  (Hereinafter, translation is included without limitation in\r
+the term "modification".)  Each licensee is addressed as "you".\r
+\r
+Activities other than copying, distribution and modification are not\r
+covered by this License; they are outside its scope.  The act of\r
+running the Program is not restricted, and the output from the Program\r
+is covered only if its contents constitute a work based on the\r
+Program (independent of having been made by running the Program).\r
+Whether that is true depends on what the Program does.\r
+\r
+  1. You may copy and distribute verbatim copies of the Program's\r
+source code as you receive it, in any medium, provided that you\r
+conspicuously and appropriately publish on each copy an appropriate\r
+copyright notice and disclaimer of warranty; keep intact all the\r
+notices that refer to this License and to the absence of any warranty;\r
+and give any other recipients of the Program a copy of this License\r
+along with the Program.\r
+\r
+You may charge a fee for the physical act of transferring a copy, and\r
+you may at your option offer warranty protection in exchange for a fee.\r
+\r
+  2. You may modify your copy or copies of the Program or any portion\r
+of it, thus forming a work based on the Program, and copy and\r
+distribute such modifications or work under the terms of Section 1\r
+above, provided that you also meet all of these conditions:\r
+\r
+    a) You must cause the modified files to carry prominent notices\r
+    stating that you changed the files and the date of any change.\r
+\r
+    b) You must cause any work that you distribute or publish, that in\r
+    whole or in part contains or is derived from the Program or any\r
+    part thereof, to be licensed as a whole at no charge to all third\r
+    parties under the terms of this License.\r
+\r
+    c) If the modified program normally reads commands interactively\r
+    when run, you must cause it, when started running for such\r
+    interactive use in the most ordinary way, to print or display an\r
+    announcement including an appropriate copyright notice and a\r
+    notice that there is no warranty (or else, saying that you provide\r
+    a warranty) and that users may redistribute the program under\r
+    these conditions, and telling the user how to view a copy of this\r
+    License.  (Exception: if the Program itself is interactive but\r
+    does not normally print such an announcement, your work based on\r
+    the Program is not required to print an announcement.)\r
+\r
+These requirements apply to the modified work as a whole.  If\r
+identifiable sections of that work are not derived from the Program,\r
+and can be reasonably considered independent and separate works in\r
+themselves, then this License, and its terms, do not apply to those\r
+sections when you distribute them as separate works.  But when you\r
+distribute the same sections as part of a whole which is a work based\r
+on the Program, the distribution of the whole must be on the terms of\r
+this License, whose permissions for other licensees extend to the\r
+entire whole, and thus to each and every part regardless of who wrote it.\r
+\r
+Thus, it is not the intent of this section to claim rights or contest\r
+your rights to work written entirely by you; rather, the intent is to\r
+exercise the right to control the distribution of derivative or\r
+collective works based on the Program.\r
+\r
+In addition, mere aggregation of another work not based on the Program\r
+with the Program (or with a work based on the Program) on a volume of\r
+a storage or distribution medium does not bring the other work under\r
+the scope of this License.\r
+\r
+  3. You may copy and distribute the Program (or a work based on it,\r
+under Section 2) in object code or executable form under the terms of\r
+Sections 1 and 2 above provided that you also do one of the following:\r
+\r
+    a) Accompany it with the complete corresponding machine-readable\r
+    source code, which must be distributed under the terms of Sections\r
+    1 and 2 above on a medium customarily used for software interchange; or,\r
+\r
+    b) Accompany it with a written offer, valid for at least three\r
+    years, to give any third party, for a charge no more than your\r
+    cost of physically performing source distribution, a complete\r
+    machine-readable copy of the corresponding source code, to be\r
+    distributed under the terms of Sections 1 and 2 above on a medium\r
+    customarily used for software interchange; or,\r
+\r
+    c) Accompany it with the information you received as to the offer\r
+    to distribute corresponding source code.  (This alternative is\r
+    allowed only for noncommercial distribution and only if you\r
+    received the program in object code or executable form with such\r
+    an offer, in accord with Subsection b above.)\r
+\r
+The source code for a work means the preferred form of the work for\r
+making modifications to it.  For an executable work, complete source\r
+code means all the source code for all modules it contains, plus any\r
+associated interface definition files, plus the scripts used to\r
+control compilation and installation of the executable.  However, as a\r
+special exception, the source code distributed need not include\r
+anything that is normally distributed (in either source or binary\r
+form) with the major components (compiler, kernel, and so on) of the\r
+operating system on which the executable runs, unless that component\r
+itself accompanies the executable.\r
+\r
+If distribution of executable or object code is made by offering\r
+access to copy from a designated place, then offering equivalent\r
+access to copy the source code from the same place counts as\r
+distribution of the source code, even though third parties are not\r
+compelled to copy the source along with the object code.\r
+\r
+  4. You may not copy, modify, sublicense, or distribute the Program\r
+except as expressly provided under this License.  Any attempt\r
+otherwise to copy, modify, sublicense or distribute the Program is\r
+void, and will automatically terminate your rights under this License.\r
+However, parties who have received copies, or rights, from you under\r
+this License will not have their licenses terminated so long as such\r
+parties remain in full compliance.\r
+\r
+  5. You are not required to accept this License, since you have not\r
+signed it.  However, nothing else grants you permission to modify or\r
+distribute the Program or its derivative works.  These actions are\r
+prohibited by law if you do not accept this License.  Therefore, by\r
+modifying or distributing the Program (or any work based on the\r
+Program), you indicate your acceptance of this License to do so, and\r
+all its terms and conditions for copying, distributing or modifying\r
+the Program or works based on it.\r
+\r
+  6. Each time you redistribute the Program (or any work based on the\r
+Program), the recipient automatically receives a license from the\r
+original licensor to copy, distribute or modify the Program subject to\r
+these terms and conditions.  You may not impose any further\r
+restrictions on the recipients' exercise of the rights granted herein.\r
+You are not responsible for enforcing compliance by third parties to\r
+this License.\r
+\r
+  7. If, as a consequence of a court judgment or allegation of patent\r
+infringement or for any other reason (not limited to patent issues),\r
+conditions are imposed on you (whether by court order, agreement or\r
+otherwise) that contradict the conditions of this License, they do not\r
+excuse you from the conditions of this License.  If you cannot\r
+distribute so as to satisfy simultaneously your obligations under this\r
+License and any other pertinent obligations, then as a consequence you\r
+may not distribute the Program at all.  For example, if a patent\r
+license would not permit royalty-free redistribution of the Program by\r
+all those who receive copies directly or indirectly through you, then\r
+the only way you could satisfy both it and this License would be to\r
+refrain entirely from distribution of the Program.\r
+\r
+If any portion of this section is held invalid or unenforceable under\r
+any particular circumstance, the balance of the section is intended to\r
+apply and the section as a whole is intended to apply in other\r
+circumstances.\r
+\r
+It is not the purpose of this section to induce you to infringe any\r
+patents or other property right claims or to contest validity of any\r
+such claims; this section has the sole purpose of protecting the\r
+integrity of the free software distribution system, which is\r
+implemented by public license practices.  Many people have made\r
+generous contributions to the wide range of software distributed\r
+through that system in reliance on consistent application of that\r
+system; it is up to the author/donor to decide if he or she is willing\r
+to distribute software through any other system and a licensee cannot\r
+impose that choice.\r
+\r
+This section is intended to make thoroughly clear what is believed to\r
+be a consequence of the rest of this License.\r
+\r
+  8. If the distribution and/or use of the Program is restricted in\r
+certain countries either by patents or by copyrighted interfaces, the\r
+original copyright holder who places the Program under this License\r
+may add an explicit geographical distribution limitation excluding\r
+those countries, so that distribution is permitted only in or among\r
+countries not thus excluded.  In such case, this License incorporates\r
+the limitation as if written in the body of this License.\r
+\r
+  9. The Free Software Foundation may publish revised and/or new versions\r
+of the General Public License from time to time.  Such new versions will\r
+be similar in spirit to the present version, but may differ in detail to\r
+address new problems or concerns.\r
+\r
+Each version is given a distinguishing version number.  If the Program\r
+specifies a version number of this License which applies to it and "any\r
+later version", you have the option of following the terms and conditions\r
+either of that version or of any later version published by the Free\r
+Software Foundation.  If the Program does not specify a version number of\r
+this License, you may choose any version ever published by the Free Software\r
+Foundation.\r
+\r
+  10. If you wish to incorporate parts of the Program into other free\r
+programs whose distribution conditions are different, write to the author\r
+to ask for permission.  For software which is copyrighted by the Free\r
+Software Foundation, write to the Free Software Foundation; we sometimes\r
+make exceptions for this.  Our decision will be guided by the two goals\r
+of preserving the free status of all derivatives of our free software and\r
+of promoting the sharing and reuse of software generally.\r
+\r
+          NO WARRANTY\r
+\r
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\r
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\r
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\r
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\r
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\r
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\r
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\r
+REPAIR OR CORRECTION.\r
+\r
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\r
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\r
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\r
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\r
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\r
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\r
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\r
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\r
+POSSIBILITY OF SUCH DAMAGES.\r
diff --git a/ui/source/MIT-LICENSE.txt b/ui/source/MIT-LICENSE.txt
new file mode 100644 (file)
index 0000000..a9b0515
--- /dev/null
@@ -0,0 +1,20 @@
+Copyright (c) 2007 John Resig, http://jquery.com/\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining\r
+a copy of this software and associated documentation files (the\r
+"Software"), to deal in the Software without restriction, including\r
+without limitation the rights to use, copy, modify, merge, publish,\r
+distribute, sublicense, and/or sell copies of the Software, and to\r
+permit persons to whom the Software is furnished to do so, subject to\r
+the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be\r
+included in all copies or substantial portions of the Software.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
diff --git a/ui/source/effects.blind.js b/ui/source/effects.blind.js
new file mode 100644 (file)
index 0000000..1681ae2
--- /dev/null
@@ -0,0 +1,37 @@
+;(function($) {
+  
+  $.effects.blind = function(o) {
+
+    return this.queue(function() {
+
+      // Create element
+      var el = $(this), props = ['position','top','left'];
+      
+      // Set options
+      var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
+      var direction = o.options.direction || 'vertical'; // Default direction
+      
+      // Adjust
+      $.effects.save(el, props); el.show(); // Save & Show
+      var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
+      var ref = (direction == 'vertical') ? 'height' : 'width';
+      var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
+      if(mode == 'show') wrapper.css(ref, 0); // Shift
+      
+      // Animation
+      var animation = {};
+      animation[ref] = mode == 'show' ? distance : 0;
+     
+      // Animate
+      wrapper.animate(animation, o.duration, o.options.easing, function() {
+        if(mode == 'hide') el.hide(); // Hide
+        $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+        if(o.callback) o.callback.apply(this, arguments); // Callback
+        el.dequeue();
+      });
+      
+    });
+    
+  };
+  
+})(jQuery);
\ No newline at end of file
diff --git a/ui/source/effects.bounce.js b/ui/source/effects.bounce.js
new file mode 100644 (file)
index 0000000..2ce40ed
--- /dev/null
@@ -0,0 +1,66 @@
+;(function($) {
+
+  $.effects.bounce = function(o) {
+
+    return this.queue(function() {
+
+      // Create element
+      var el = $(this), props = ['position','top','left'];
+
+      // Set options
+      var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
+      var direction = o.options.direction || 'up'; // Default direction
+      var distance = o.options.distance || 20; // Default distance
+      var times = o.options.times || 5; // Default # of times
+      var speed = o.duration || 250; // Default speed per bounce
+      if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE
+
+      // Adjust
+      $.effects.save(el, props); el.show(); // Save & Show
+      $.effects.createWrapper(el); // Create Wrapper
+      var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
+      var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
+      var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3);
+      if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
+      if (mode == 'hide') distance = distance / (times * 2);
+      if (mode != 'hide') times--;
+      
+      // Animate
+      if (mode == 'show') { // Show Bounce
+        var animation = {opacity: 1};
+        animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
+        el.animate(animation, speed / 2, o.options.easing);
+        distance = distance / 2;
+        times--;
+      };
+      for (var i = 0; i < times; i++) { // Bounces
+        var animation1 = {}, animation2 = {};
+        animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
+        animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
+        el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);
+        distance = (mode == 'hide') ? distance * 2 : distance / 2;
+      };
+      if (mode == 'hide') { // Last Bounce
+        var animation = {opacity: 0};
+        animation[ref] = (motion == 'pos' ? '-=' : '+=')  + distance;
+        el.animate(animation, speed / 2, o.options.easing, function(){
+          el.hide(); // Hide
+          $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+          if(o.callback) o.callback.apply(this, arguments); // Callback
+        });
+      } else {
+        var animation1 = {}, animation2 = {};
+        animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
+        animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
+        el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){
+          $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+          if(o.callback) o.callback.apply(this, arguments); // Callback
+        });
+      };
+      el.queue('fx', function() { el.dequeue(); });
+      el.dequeue();
+    });
+    
+  };
+
+})(jQuery);
\ No newline at end of file
diff --git a/ui/source/effects.clip.js b/ui/source/effects.clip.js
new file mode 100644 (file)
index 0000000..99951b7
--- /dev/null
@@ -0,0 +1,41 @@
+;(function($) {\r
+  \r
+  $.effects.clip = function(o) {\r
+\r
+    return this.queue(function() {\r
+\r
+      // Create element\r
+      var el = $(this), props = ['position','top','left','width','height'];\r
+      \r
+      // Set options\r
+      var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode\r
+      var direction = o.options.direction || 'vertical'; // Default direction\r
+      \r
+      // Adjust\r
+      $.effects.save(el, props); el.show(); // Save & Show\r
+      $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper\r
+      var ref = {\r
+        size: (direction == 'vertical') ? 'height' : 'width',\r
+        position: (direction == 'vertical') ? 'top' : 'left'\r
+      };\r
+      var distance = (direction == 'vertical') ? el.height() : el.width();\r
+      if(mode == 'show') { el.css(ref.size, 0); el.css(ref.position, distance / 2); } // Shift\r
+      \r
+      // Animation\r
+      var animation = {};\r
+      animation[ref.size] = mode == 'show' ? distance : 0;\r
+      animation[ref.position] = mode == 'show' ? 0 : distance / 2;\r
+        \r
+      // Animate\r
+      el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {\r
+        if(mode == 'hide') el.hide(); // Hide\r
+        $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore\r
+        if(o.callback) o.callback.apply(this, arguments); // Callback\r
+        el.dequeue();\r
+      }}); \r
+      \r
+    });\r
+    \r
+  };\r
+  \r
+})(jQuery);\r
diff --git a/ui/source/effects.core.js b/ui/source/effects.core.js
new file mode 100644 (file)
index 0000000..8841cf5
--- /dev/null
@@ -0,0 +1,501 @@
+;(function($) {
+
+  $.effects = $.effects || {}; //Add the 'ec' scope
+
+  $.extend($.effects, {
+    save: function(el, set) {
+      for(var i=0;i<set.length;i++) {
+        if(set[i] !== null) $.data(el[0], "ec.storage."+set[i], el.css(set[i]));
+      }
+    },
+    restore: function(el, set) {
+      for(var i=0;i<set.length;i++) {
+        if(set[i] !== null) el.css(set[i], $.data(el[0], "ec.storage."+set[i]));
+      }
+    },
+    setMode: function(el, mode) {
+      if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
+      return mode;
+    },
+    getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
+      // this should be a little more flexible in the future to handle a string & hash
+      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};
+    },
+    createWrapper: function(el) {
+      if (el.parent().attr('id') == 'fxWrapper')
+        return el;
+      var props = {width: el.outerWidth({margin:true}), height: el.outerHeight({margin:true}), 'float': el.css('float')};
+      el.wrap('<div id="fxWrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');
+      var wrapper = el.parent();
+      if (el.css('position') == 'static'){
+        wrapper.css({position: 'relative'});
+        el.css({position: 'relative'});
+      } else {
+        var top = parseInt(el.css('top'), 10); if (top.constructor != Number) top = 'auto';
+        var left = parseInt(el.css('left'), 10); if (left.constructor != Number) left = 'auto';
+        wrapper.css({ position: el.css('position'), top: top, left: left, zIndex: el.css('z-index') }).show();
+        el.css({position: 'relative', top:0, left:0});
+      }
+      wrapper.css(props);
+      return wrapper;
+    },
+    removeWrapper: function(el) {
+      if (el.parent().attr('id') == 'fxWrapper')
+        return el.parent().replaceWith(el);
+      return el;
+    },
+    setTransition: function(el, list, factor, val) {
+      val = val || {};
+      $.each(list,function(i, x){
+        unit = el.cssUnit(x);
+        if (unit[0] > 0) val[x] = unit[0] * factor + unit[1];
+      });
+      return val;
+    },
+    animateClass: function(value, duration, easing, callback) {
+
+      var cb = (typeof easing == "function" ? easing : (callback ? callback : null));
+      var ea = (typeof easing == "object" ? easing : null);
+
+      return this.each(function() {
+
+        var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || '';
+        if(typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */
+        if(value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; }
+
+        //Let's get a style offset
+        var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
+        if(value.add) that.addClass(value.add); if(value.remove) that.removeClass(value.remove);
+        var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
+        if(value.add) that.removeClass(value.add); if(value.remove) that.addClass(value.remove);
+
+        // The main function to form the object for animation
+        for(var n in newStyle) {
+          if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */
+          && n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */
+          && newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */
+          && (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */
+          && (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */
+          ) offset[n] = newStyle[n];
+        }
+
+        that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object
+          // Change style attribute back to original. For stupid IE, we need to clear the damn object.
+          if(typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr);
+          if(value.add) $(this).addClass(value.add); if(value.remove) $(this).removeClass(value.remove);
+          if(cb) cb.apply(this, arguments);
+        });
+
+      });
+    }
+  });
+
+  //Extend the methods of jQuery
+  $.fn.extend({
+    //Save old methods
+    _show: $.fn.show,
+    _hide: $.fn.hide,
+    __toggle: $.fn.toggle,
+    _addClass: $.fn.addClass,
+    _removeClass: $.fn.removeClass,
+    _toggleClass: $.fn.toggleClass,
+    // New ec methods
+    effect: function(fx,o,speed,callback) {
+      return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options: o || {}, duration: speed, callback: callback }) : null;
+    },
+    show: function() {
+      if(!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])))
+        return this._show.apply(this, arguments);
+      else {
+        var o = arguments[1] || {}; o['mode'] = 'show';
+        return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
+      }
+    },
+    hide: function() {
+      if(!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])))
+        return this._hide.apply(this, arguments);
+      else {
+        var o = arguments[1] || {}; o['mode'] = 'hide';
+        return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
+      }
+    },
+    toggle: function(){
+      if(!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])) || (arguments[0].constructor == Function))
+        return this.__toggle.apply(this, arguments);
+      else {
+        var o = arguments[1] || {}; o['mode'] = 'toggle';
+        return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
+      }
+    },
+    addClass: function(classNames,speed,easing,callback) {
+      return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
+    },
+    removeClass: function(classNames,speed,easing,callback) {
+      return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
+    },
+    toggleClass: function(classNames,speed,easing,callback) {
+      return speed ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames);
+    },
+    morph: function(remove,add,speed,easing,callback) {
+      return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
+    },
+    switchClass: function() {
+      return this.morph.apply(this, arguments);
+    },
+    // 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;
+    }
+  });
+
+  /*
+   * jQuery Color Animations
+   * Copyright 2007 John Resig
+   * Released under the MIT and GPL licenses.
+   */
+
+    // We override the animation for all of these color styles
+    jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
+        jQuery.fx.step[attr] = function(fx){
+            if ( fx.state == 0 ) {
+                fx.start = getColor( fx.elem, attr );
+                fx.end = getRGB( fx.end );
+            }
+
+            fx.elem.style[attr] = "rgb(" + [
+                Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
+                Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
+                Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
+            ].join(",") + ")";
+        }
+    });
+
+    // Color Conversion functions from highlightFade
+    // By Blair Mitchelmore
+    // http://jquery.offput.ca/highlightFade/
+
+    // Parse strings looking for color tuples [255,255,255]
+    function getRGB(color) {
+        var result;
+
+        // Check if we're already dealing with an array of colors
+        if ( color && color.constructor == Array && color.length == 3 )
+            return color;
+
+        // Look for rgb(num,num,num)
+        if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
+            return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
+
+        // Look for rgb(num%,num%,num%)
+        if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
+            return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
+
+        // Look for #a0b1c2
+        if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
+            return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
+
+        // Look for #fff
+        if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
+            return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
+
+        // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
+        if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
+            return colors['transparent']
+
+        // Otherwise, we're most likely dealing with a named color
+        return colors[jQuery.trim(color).toLowerCase()];
+    }
+
+    function getColor(elem, attr) {
+        var color;
+
+        do {
+            color = jQuery.curCSS(elem, attr);
+
+            // Keep going until we find an element that has color, or we hit the body
+            if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
+                break;
+
+            attr = "backgroundColor";
+        } while ( elem = elem.parentNode );
+
+        return getRGB(color);
+    };
+
+    // Some named colors to work with
+    // From Interface by Stefan Petre
+    // http://interface.eyecon.ro/
+
+    var colors = {
+        aqua:[0,255,255],
+        azure:[240,255,255],
+        beige:[245,245,220],
+        black:[0,0,0],
+        blue:[0,0,255],
+        brown:[165,42,42],
+        cyan:[0,255,255],
+        darkblue:[0,0,139],
+        darkcyan:[0,139,139],
+        darkgrey:[169,169,169],
+        darkgreen:[0,100,0],
+        darkkhaki:[189,183,107],
+        darkmagenta:[139,0,139],
+        darkolivegreen:[85,107,47],
+        darkorange:[255,140,0],
+        darkorchid:[153,50,204],
+        darkred:[139,0,0],
+        darksalmon:[233,150,122],
+        darkviolet:[148,0,211],
+        fuchsia:[255,0,255],
+        gold:[255,215,0],
+        green:[0,128,0],
+        indigo:[75,0,130],
+        khaki:[240,230,140],
+        lightblue:[173,216,230],
+        lightcyan:[224,255,255],
+        lightgreen:[144,238,144],
+        lightgrey:[211,211,211],
+        lightpink:[255,182,193],
+        lightyellow:[255,255,224],
+        lime:[0,255,0],
+        magenta:[255,0,255],
+        maroon:[128,0,0],
+        navy:[0,0,128],
+        olive:[128,128,0],
+        orange:[255,165,0],
+        pink:[255,192,203],
+        purple:[128,0,128],
+        violet:[128,0,128],
+        red:[255,0,0],
+        silver:[192,192,192],
+        white:[255,255,255],
+        yellow:[255,255,0],
+        transparent: [255,255,255]
+    };
+    
+
+/*
+ * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
+ *
+ * Uses the built in easing capabilities added In jQuery 1.1
+ * to offer multiple easing options
+ *
+ * TERMS OF USE - jQuery Easing
+ * 
+ * Open source under the BSD License. 
+ * 
+ * Copyright Ã‚© 2008 George McGinley Smith
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without modification, 
+ * are permitted provided that the following conditions are met:
+ * 
+ * Redistributions of source code must retain the above copyright notice, this list of 
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list 
+ * of conditions and the following disclaimer in the documentation and/or other materials 
+ * provided with the distribution.
+ * 
+ * Neither the name of the author nor the names of contributors may be used to endorse 
+ * or promote products derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
+ * OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *
+*/
+
+// t: current time, b: begInnIng value, c: change In value, d: duration
+jQuery.easing['jswing'] = jQuery.easing['swing'];
+
+jQuery.extend( jQuery.easing,
+{
+       def: 'easeOutQuad',
+       swing: function (x, t, b, c, d) {
+               //alert(jQuery.easing.default);
+               return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
+       },
+       easeInQuad: function (x, t, b, c, d) {
+               return c*(t/=d)*t + b;
+       },
+       easeOutQuad: function (x, t, b, c, d) {
+               return -c *(t/=d)*(t-2) + b;
+       },
+       easeInOutQuad: function (x, t, b, c, d) {
+               if ((t/=d/2) < 1) return c/2*t*t + b;
+               return -c/2 * ((--t)*(t-2) - 1) + b;
+       },
+       easeInCubic: function (x, t, b, c, d) {
+               return c*(t/=d)*t*t + b;
+       },
+       easeOutCubic: function (x, t, b, c, d) {
+               return c*((t=t/d-1)*t*t + 1) + b;
+       },
+       easeInOutCubic: function (x, t, b, c, d) {
+               if ((t/=d/2) < 1) return c/2*t*t*t + b;
+               return c/2*((t-=2)*t*t + 2) + b;
+       },
+       easeInQuart: function (x, t, b, c, d) {
+               return c*(t/=d)*t*t*t + b;
+       },
+       easeOutQuart: function (x, t, b, c, d) {
+               return -c * ((t=t/d-1)*t*t*t - 1) + b;
+       },
+       easeInOutQuart: function (x, t, b, c, d) {
+               if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
+               return -c/2 * ((t-=2)*t*t*t - 2) + b;
+       },
+       easeInQuint: function (x, t, b, c, d) {
+               return c*(t/=d)*t*t*t*t + b;
+       },
+       easeOutQuint: function (x, t, b, c, d) {
+               return c*((t=t/d-1)*t*t*t*t + 1) + b;
+       },
+       easeInOutQuint: function (x, t, b, c, d) {
+               if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
+               return c/2*((t-=2)*t*t*t*t + 2) + b;
+       },
+       easeInSine: function (x, t, b, c, d) {
+               return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
+       },
+       easeOutSine: function (x, t, b, c, d) {
+               return c * Math.sin(t/d * (Math.PI/2)) + b;
+       },
+       easeInOutSine: function (x, t, b, c, d) {
+               return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
+       },
+       easeInExpo: function (x, t, b, c, d) {
+               return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
+       },
+       easeOutExpo: function (x, t, b, c, d) {
+               return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
+       },
+       easeInOutExpo: function (x, t, b, c, d) {
+               if (t==0) return b;
+               if (t==d) return b+c;
+               if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
+               return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
+       },
+       easeInCirc: function (x, t, b, c, d) {
+               return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
+       },
+       easeOutCirc: function (x, t, b, c, d) {
+               return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
+       },
+       easeInOutCirc: function (x, t, b, c, d) {
+               if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
+               return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
+       },
+       easeInElastic: function (x, t, b, c, d) {
+               var s=1.70158;var p=0;var a=c;
+               if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
+               if (a < Math.abs(c)) { a=c; var s=p/4; }
+               else var s = p/(2*Math.PI) * Math.asin (c/a);
+               return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+       },
+       easeOutElastic: function (x, t, b, c, d) {
+               var s=1.70158;var p=0;var a=c;
+               if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
+               if (a < Math.abs(c)) { a=c; var s=p/4; }
+               else var s = p/(2*Math.PI) * Math.asin (c/a);
+               return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
+       },
+       easeInOutElastic: function (x, t, b, c, d) {
+               var s=1.70158;var p=0;var a=c;
+               if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
+               if (a < Math.abs(c)) { a=c; var s=p/4; }
+               else var s = p/(2*Math.PI) * Math.asin (c/a);
+               if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+               return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
+       },
+       easeInBack: function (x, t, b, c, d, s) {
+               if (s == undefined) s = 1.70158;
+               return c*(t/=d)*t*((s+1)*t - s) + b;
+       },
+       easeOutBack: function (x, t, b, c, d, s) {
+               if (s == undefined) s = 1.70158;
+               return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
+       },
+       easeInOutBack: function (x, t, b, c, d, s) {
+               if (s == undefined) s = 1.70158; 
+               if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
+               return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
+       },
+       easeInBounce: function (x, t, b, c, d) {
+               return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
+       },
+       easeOutBounce: function (x, t, b, c, d) {
+               if ((t/=d) < (1/2.75)) {
+                       return c*(7.5625*t*t) + b;
+               } else if (t < (2/2.75)) {
+                       return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
+               } else if (t < (2.5/2.75)) {
+                       return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
+               } else {
+                       return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
+               }
+       },
+       easeInOutBounce: function (x, t, b, c, d) {
+               if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
+               return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
+       }
+});
+
+/*
+ *
+ * TERMS OF USE - EASING EQUATIONS
+ * 
+ * Open source under the BSD License. 
+ * 
+ * Copyright Ã‚© 2001 Robert Penner
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without modification, 
+ * are permitted provided that the following conditions are met:
+ * 
+ * Redistributions of source code must retain the above copyright notice, this list of 
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list 
+ * of conditions and the following disclaimer in the documentation and/or other materials 
+ * provided with the distribution.
+ * 
+ * Neither the name of the author nor the names of contributors may be used to endorse 
+ * or promote products derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
+ * OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *
+ */
+
+})(jQuery);
\ No newline at end of file
diff --git a/ui/source/effects.drop.js b/ui/source/effects.drop.js
new file mode 100644 (file)
index 0000000..3e55bdd
--- /dev/null
@@ -0,0 +1,38 @@
+;(function($) {\r
+  \r
+  $.effects.drop = function(o) {\r
+\r
+    return this.queue(function() {\r
+\r
+      // Create element\r
+      var el = $(this), props = ['position','top','left','opacity'];\r
+      \r
+      // Set options\r
+      var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode\r
+      var direction = o.options.direction || 'left'; // Default Direction\r
+      \r
+      // Adjust\r
+      $.effects.save(el, props); el.show(); // Save & Show\r
+      $.effects.createWrapper(el); // Create Wrapper\r
+      var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';\r
+      var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';\r
+      var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);\r
+      if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift\r
+      \r
+      // Animation\r
+      var animation = {opacity: mode == 'show' ? 1 : 0};\r
+      animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;\r
+      \r
+      // Animate\r
+      el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {\r
+        if(mode == 'hide') el.hide(); // Hide\r
+        $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore\r
+        if(o.callback) o.callback.apply(this, arguments); // Callback\r
+        el.dequeue();\r
+      }});\r
+      \r
+    });\r
+    \r
+  };\r
+  \r
+})(jQuery);\r
diff --git a/ui/source/effects.explode.js b/ui/source/effects.explode.js
new file mode 100644 (file)
index 0000000..4962c5d
--- /dev/null
@@ -0,0 +1,62 @@
+;(function($) {\r
+  \r
+  $.effects.explode = function(o) {\r
+\r
+    return this.queue(function() {\r
+\r
+               var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;\r
+               var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;\r
+               \r
+               o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;\r
+               var el = $(this).show().css('visibility', 'hidden');\r
+               var offset = el.offset();\r
+               var width = el.outerWidth();\r
+               var height = el.outerHeight();\r
+\r
+               for(var i=0;i<rows;i++) { // =\r
+                       for(var j=0;j<cells;j++) { // ||\r
+                               el\r
+                                       .clone()\r
+                                       .appendTo('body')\r
+                                       .wrap('<div></div>')\r
+                                       .css({\r
+                                               position: 'absolute',\r
+                                               visibility: 'visible',\r
+                                               left: -j*(width/cells),\r
+                                               top: -i*(height/rows)\r
+                                       })\r
+                                       .parent()\r
+                                       .addClass('ec-explode')\r
+                                       .css({\r
+                                               position: 'absolute',\r
+                                               overflow: 'hidden',\r
+                                               width: width/cells,\r
+                                               height: height/rows,\r
+                                               left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),\r
+                                               top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),\r
+                                               opacity: o.options.mode == 'show' ? 0 : 1\r
+                                       }).animate({\r
+                                               left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),\r
+                                               top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),\r
+                                               opacity: o.options.mode == 'show' ? 1 : 0\r
+                                       }, o.duration || 500);\r
+                       }\r
+               }\r
+\r
+               // Set a timeout, to call the callback approx. when the other animations have finished\r
+               setTimeout(function() {\r
+                       \r
+                       o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();\r
+               if(o.callback) o.callback.apply(el[0]); // Callback\r
+               el.dequeue();\r
+               \r
+               $('.ec-explode').remove();\r
+                       \r
+               }, o.duration || 500);\r
+               \r
+      \r
+    });\r
+    \r
+  };\r
+  \r
+})(jQuery);
\ No newline at end of file
diff --git a/ui/source/effects.fade.js b/ui/source/effects.fade.js
new file mode 100644 (file)
index 0000000..2d265bf
--- /dev/null
@@ -0,0 +1,35 @@
+;(function($) {
+  
+  $.effects.fade = function(o) {
+
+    return this.queue(function() {
+      
+      // Create element
+      var el = $(this), props = ['opacity'];
+      
+      // Set options
+      var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
+      if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
+      var opacity = o.options.opacity || 0; // Default fade opacity
+      var original_opacity = el.css('opacity');
+      
+      // Adjust
+      $.effects.save(el, props); el.show(); // Save & Show
+      if(mode == 'show') el.css({opacity: 0}); // Shift
+      
+      // Animation
+      var animation = {opacity: mode == 'show' ? original_opacity : opacity};
+      
+      // Animate
+      el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
+        if(mode == 'hide') el.hide(); // Hide
+        if(mode == 'hide') $.effects.restore(el, props); // Restore
+        if(o.callback) o.callback.apply(this, arguments); // Callback
+        el.dequeue();
+      }});
+      
+    });
+    
+  };
+  
+})(jQuery);
\ No newline at end of file
diff --git a/ui/source/effects.fold.js b/ui/source/effects.fold.js
new file mode 100644 (file)
index 0000000..f2738c2
--- /dev/null
@@ -0,0 +1,39 @@
+;(function($) {
+  
+  $.effects.fold = function(o) {
+
+    return this.queue(function() {
+
+      // Create element
+      var el = $(this), props = ['position','top','left'];
+      
+      // Set options
+      var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
+      var size = o.options.size || 15; // Default fold size
+      
+      // Adjust
+      $.effects.save(el, props); el.show(); // Save & Show
+      var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
+      var ref = (mode == 'show') ? ['width', 'height'] : ['height', 'width'];
+      var distance = (mode == 'show') ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
+      if(mode == 'show') wrapper.css({height: size, width: 0}); // Shift
+      
+      // Animation
+      var animation1 = {}, animation2 = {};
+      animation1[ref[0]] = mode == 'show' ? distance[0] : size;
+      animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
+      
+      // Animate
+      wrapper.animate(animation1, o.duration / 2, o.options.easing)
+      .animate(animation2, o.duration / 2, o.options.easing, function() {
+        if(mode == 'hide') el.hide(); // Hide
+        $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
+        if(o.callback) o.callback.apply(this, arguments); // Callback
+        el.dequeue();
+      });
+      
+    });
+    
+  };
+  
+})(jQuery);
\ No newline at end of file
diff --git a/ui/source/effects.highlight.js b/ui/source/effects.highlight.js
new file mode 100644 (file)
index 0000000..8eeabe3
--- /dev/null
@@ -0,0 +1,35 @@
+;(function($) {\r
+  \r
+  $.effects.highlight = function(o) {\r
+\r
+    return this.queue(function() {\r
+      \r
+      // Create element\r
+      var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];\r
+      \r
+      // Set options\r
+      var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode\r
+      var color = o.options.color || "#ffff99"; // Default highlight color\r
+      \r
+      // Adjust\r
+      $.effects.save(el, props); el.show(); // Save & Show\r
+      el.css({backgroundImage: 'none', backgroundColor: color}); // Shift\r
+      \r
+      // Animation\r
+      var animation = {backgroundColor: $.data(this, "ec.storage.backgroundColor")};\r
+      if (mode == "hide") animation['opacity'] = 0;\r
+      \r
+      // Animate\r
+      el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {\r
+        if(mode == "hide") el.hide();\r
+        $.effects.restore(el, props);\r
+           if (mode == "show" && jQuery.browser.msie) this.style.removeAttribute('filter'); \r
+        if(o.callback) o.callback.apply(this, arguments);\r
+        el.dequeue();\r
+      }});\r
+      \r
+    });\r
+    \r
+  };\r
+  \r
+})(jQuery);
\ No newline at end of file
diff --git a/ui/source/effects.pulsate.js b/ui/source/effects.pulsate.js
new file mode 100644 (file)
index 0000000..aee1525
--- /dev/null
@@ -0,0 +1,43 @@
+;(function($) {\r
+  \r
+  $.effects.pulsate = function(o) {\r
+\r
+    return this.queue(function() {\r
+      \r
+      // Create element\r
+      var el = $(this);\r
+      \r
+      // Set options\r
+      var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode\r
+      var times = o.options.times || 5; // Default # of times\r
+      \r
+      // Adjust\r
+      if (mode != 'hide') times--;\r
+      if (el.is(':hidden')) { // Show fadeIn\r
+        el.css('opacity', 0);\r
+        el.show(); // Show\r
+        el.animate({opacity: 1}, o.duration / 2, o.options.easing);\r
+        times--;\r
+      }\r
+      \r
+      // Animate\r
+      for (var i = 0; i < times; i++) { // Pulsate\r
+        el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing);\r
+      };\r
+      if (mode == 'hide') { // Last Pulse\r
+        el.animate({opacity: 0}, o.duration / 2, o.options.easing, function(){\r
+          el.hide(); // Hide\r
+          if(o.callback) o.callback.apply(this, arguments); // Callback\r
+        });\r
+      } else {\r
+        el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing, function(){\r
+          if(o.callback) o.callback.apply(this, arguments); // Callback\r
+        });\r
+      };\r
+      el.queue('fx', function() { el.dequeue(); });\r
+      el.dequeue();\r
+    });\r
+    \r
+  };\r
+  \r
+})(jQuery);
\ No newline at end of file
diff --git a/ui/source/effects.scale.js b/ui/source/effects.scale.js
new file mode 100644 (file)
index 0000000..46d2c1f
--- /dev/null
@@ -0,0 +1,165 @@
+;(function($) {\r
+  \r
+  $.effects.puff = function(o) {\r
+  \r
+    return this.queue(function() {\r
+  \r
+      // Create element\r
+      var el = $(this);\r
+    \r
+      // Set options\r
+      var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode\r
+      var percent = parseInt(o.options.percent) || 150; // Set default puff percent\r
+      o.options.fade = true; // It's not a puff if it doesn't fade! :)\r
+      var original = {height: el.height(), width: el.width()}; // Save original\r
+    \r
+      // Adjust\r
+      var factor = percent / 100;\r
+      el.from = (mode == 'hide') ? original : {height: original.height * factor, width: original.width * factor};\r
+    \r
+      // Animation\r
+      o.options.from = el.from;\r
+      o.options.percent = (mode == 'hide') ? percent : 100;\r
+      o.options.mode = mode;\r
+    \r
+      // Animate\r
+      el.effect('scale', o.options, o.duration, o.callback);\r
+      el.dequeue();\r
+    });\r
+    \r
+  };\r
+\r
+  $.effects.scale = function(o) {\r
+    \r
+    return this.queue(function() {\r
+    \r
+      // Create element\r
+      var el = $(this);\r
+\r
+      // Set options\r
+      var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode\r
+      var percent = parseInt(o.options.percent) || (parseInt(o.options.percent) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent\r
+      var direction = o.options.direction || 'both'; // Set default axis\r
+      var origin = o.options.origin; // The origin of the scaling\r
+      if (mode != 'effect') { // Set default origin and restore for show/hide\r
+        origin = origin || ['middle','center'];\r
+        o.options.restore = true;\r
+      }\r
+      var original = {height: el.height(), width: el.width()}; // Save original\r
+      el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state\r
+    \r
+      // Adjust\r
+      var factor = { // Set scaling factor\r
+        y: direction != 'horizontal' ? (percent / 100) : 1,\r
+        x: direction != 'vertical' ? (percent / 100) : 1\r
+      };\r
+      el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state\r
+      if (origin) { // Calculate baseline shifts\r
+        var baseline = $.effects.getBaseline(origin, original);\r
+        el.from.top = (original.height - el.from.height) * baseline.y;\r
+        el.from.left = (original.width - el.from.width) * baseline.x;\r
+        el.to.top = (original.height - el.to.height) * baseline.y;\r
+        el.to.left = (original.width - el.to.width) * baseline.x;\r
+      };\r
+      if (o.options.fade) { // Fade option to support puff\r
+        if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};\r
+        if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};\r
+      };\r
+    \r
+      // Animation\r
+      o.options.from = el.from; o.options.to = el.to;\r
+    \r
+      // Animate\r
+      el.effect('size', o.options, o.duration, o.callback);\r
+      el.dequeue();\r
+    });\r
+    \r
+  };\r
+  \r
+  $.effects.size = function(o) {\r
+\r
+    return this.queue(function() {\r
+      \r
+      // Create element\r
+      var el = $(this), props = ['position','top','left','width','height','overflow','opacity'];\r
+      var props1 = ['position','overflow','opacity']; // Always restore\r
+      var props2 = ['width','height','overflow']; // Copy for children\r
+      var cProps = ['fontSize'];\r
+      var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];\r
+      var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];\r
+      \r
+      // Set options\r
+      var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode\r
+      var restore = o.options.restore || false; // Default restore\r
+      var scale = o.options.scale || 'both'; // Default scale mode\r
+      var original = {height: el.height(), width: el.width()}; // Save original\r
+      el.from = o.options.from || original; // Default from state\r
+      el.to = o.options.to || original; // Default to state\r
+      \r
+      // Adjust\r
+      var factor = { // Set scaling factor\r
+        from: {y: el.from.height / original.height, x: el.from.width / original.width},\r
+        to: {y: el.to.height / original.height, x: el.to.width / original.width}\r
+      };\r
+      if (scale == 'box' || scale == 'both') { // Scale the css box\r
+        if (factor.from.y != factor.to.y) { // Vertical props scaling\r
+          props = props.concat(vProps);\r
+          el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from);\r
+          el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to);\r
+        };\r
+        if (factor.from.x != factor.to.x) { // Horizontal props scaling\r
+          props = props.concat(hProps);\r
+          el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from);\r
+          el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to);\r
+        };\r
+      };\r
+      if (scale == 'content' || scale == 'both') { // Scale the content\r
+        if (factor.from.y != factor.to.y) { // Vertical props scaling\r
+          props = props.concat(cProps);\r
+          el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from);\r
+          el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to);\r
+        };\r
+      };\r
+      $.effects.save(el, restore ? props : props1); el.show(); // Save & Show\r
+      $.effects.createWrapper(el); // Create Wrapper\r
+      el.css('overflow','hidden').css(el.from); // Shift\r
+      \r
+      // Animate\r
+      if (scale == 'content' || scale == 'both') { // Scale the children\r
+        vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size\r
+        hProps = hProps.concat(['marginLeft','marginRight']); // Add margins\r
+        props2 = props.concat(vProps).concat(hProps); // Concat\r
+        el.find("*[width]").each(function(){\r
+          child = $(this);\r
+          if (restore) $.effects.save(child, props2);\r
+          var c_original = {height: child.height(), width: child.width()}; // Save original\r
+          child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x};\r
+          child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x};\r
+          if (factor.from.y != factor.to.y) { // Vertical props scaling\r
+            child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from);\r
+            child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to);\r
+          };\r
+          if (factor.from.x != factor.to.x) { // Horizontal props scaling\r
+            child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from);\r
+            child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to);\r
+          };\r
+          child.css(child.from); // Shift children\r
+          child.animate(child.to, o.duration, o.options.easing, function(){\r
+            if (restore) $.effects.restore(child, props2); // Restore children\r
+          }); // Animate children\r
+        });\r
+      };\r
+      \r
+      // Animate\r
+      el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {\r
+        if(mode == 'hide') el.hide(); // Hide\r
+        $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore\r
+        if(o.callback) o.callback.apply(this, arguments); // Callback\r
+        el.dequeue();\r
+      }}); \r
+      \r
+    });\r
+\r
+  };\r
+  \r
+})(jQuery);
\ No newline at end of file
diff --git a/ui/source/effects.shake.js b/ui/source/effects.shake.js
new file mode 100644 (file)
index 0000000..ae7635a
--- /dev/null
@@ -0,0 +1,45 @@
+;(function($) {\r
+  \r
+  $.effects.shake = function(o) {\r
+\r
+    return this.queue(function() {\r
+\r
+      // Create element\r
+      var el = $(this), props = ['position','top','left'];\r
+      \r
+      // Set options\r
+      var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode\r
+      var direction = o.options.direction || 'left'; // Default direction\r
+      var distance = o.options.distance || 20; // Default distance\r
+      var times = o.options.times || 3; // Default # of times\r
+      var speed = o.duration || o.options.duration || 140; // Default speed per shake\r
+      \r
+      // Adjust\r
+      $.effects.save(el, props); el.show(); // Save & Show\r
+      $.effects.createWrapper(el); // Create Wrapper\r
+      var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';\r
+      var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';\r
+      \r
+      // Animation\r
+      var animation = {}, animation1 = {}, animation2 = {};\r
+      animation[ref] = (motion == 'pos' ? '-=' : '+=')  + distance;\r
+      animation1[ref] = (motion == 'pos' ? '+=' : '-=')  + distance * 2;\r
+      animation2[ref] = (motion == 'pos' ? '-=' : '+=')  + distance * 2;\r
+      \r
+      // Animate\r
+      el.animate(animation, speed, o.options.easing);\r
+      for (var i = 1; i < times; i++) { // Shakes\r
+        el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);\r
+      };\r
+      el.animate(animation1, speed, o.options.easing).\r
+      animate(animation, speed / 2, o.options.easing, function(){ // Last shake\r
+        $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore\r
+        if(o.callback) o.callback.apply(this, arguments); // Callback\r
+      });\r
+      el.queue('fx', function() { el.dequeue(); });\r
+      el.dequeue();\r
+    });\r
+    \r
+  };\r
+  \r
+})(jQuery);\r
diff --git a/ui/source/effects.slide.js b/ui/source/effects.slide.js
new file mode 100644 (file)
index 0000000..80e3f5a
--- /dev/null
@@ -0,0 +1,38 @@
+;(function($) {\r
+  \r
+  $.effects.slide = function(o) {\r
+\r
+    return this.queue(function() {\r
+\r
+      // Create element\r
+      var el = $(this), props = ['position','top','left'];\r
+      \r
+      // Set options\r
+      var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode\r
+      var direction = o.options.direction || 'left'; // Default Direction\r
+      \r
+      // Adjust\r
+      $.effects.save(el, props); el.show(); // Save & Show\r
+      $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper\r
+      var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';\r
+      var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';\r
+      var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));\r
+      if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift\r
+      \r
+      // Animation\r
+      var animation = {};\r
+      animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;\r
+      \r
+      // Animate\r
+      el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {\r
+        if(mode == 'hide') el.hide(); // Hide\r
+        $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore\r
+        if(o.callback) o.callback.apply(this, arguments); // Callback\r
+        el.dequeue();\r
+      }});\r
+      \r
+    });\r
+    \r
+  };\r
+  \r
+})(jQuery);
\ No newline at end of file
diff --git a/ui/source/effects.transfer.js b/ui/source/effects.transfer.js
new file mode 100644 (file)
index 0000000..f83700c
--- /dev/null
@@ -0,0 +1,46 @@
+;(function($) {\r
+  \r
+  $.effects.transfer = function(o) {\r
+\r
+    return this.queue(function() {\r
+\r
+      // Create element\r
+      var el = $(this);\r
+      \r
+      // Set options\r
+      var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode\r
+      var target = $(o.options.to); // Find Target\r
+      var position = el.position();\r
+         var transfer = $('<div id="fxTransfer"></div>').appendTo(document.body)\r
+      \r
+      // Set target css\r
+      transfer.addClass(o.options.className);\r
+      transfer.css({\r
+        top: position['top'],\r
+        left: position['left'],\r
+        height: el.outerHeight({margin:true}) - parseInt(transfer.css('borderTopWidth')) - parseInt(transfer.css('borderBottomWidth')),\r
+        width: el.outerWidth({margin:true}) - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth')),\r
+        position: 'absolute'\r
+      });\r
+      \r
+      // Animation\r
+      position = target.position();\r
+      animation = {\r
+        top: position['top'],\r
+        left: position['left'],\r
+        height: target.outerHeight() - parseInt(transfer.css('borderTopWidth')) - parseInt(transfer.css('borderBottomWidth')),\r
+        width: target.outerWidth() - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth'))\r
+      };\r
+      \r
+      // Animate\r
+      transfer.animate(animation, o.duration, o.options.easing, function() {\r
+        transfer.remove(); // Remove div\r
+        if(o.callback) o.callback.apply(this, arguments); // Callback\r
+        el.dequeue();\r
+      }); \r
+      \r
+    });\r
+    \r
+  };\r
+  \r
+})(jQuery);\r
diff --git a/ui/source/ui.accordion.js b/ui/source/ui.accordion.js
new file mode 100644 (file)
index 0000000..a4bd593
--- /dev/null
@@ -0,0 +1,303 @@
+/*\r
+ * jQuery UI Accordion\r
+ * \r
+ * Copyright (c) 2007, 2008 Jörn Zaefferer\r
+ * Dual licensed under the MIT (MIT-LICENSE.txt)\r
+ * and GPL (GPL-LICENSE.txt) licenses.\r
+ *\r
+ * http://docs.jquery.com/UI/Accordion\r
+ *\r
+ * Depends:\r
+ *     ui.core.js\r
+ *\r
+ * Revision: $Id: ui.accordion.js 5656 2008-05-21 19:35:33Z braeker $\r
+ */\r
+\r
+;(function($) {\r
+\r
+       $.widget("ui.accordion", {\r
+               init: function() {\r
+                       var options = this.options;\r
+                       \r
+                       if ( options.navigation ) {\r
+                               var current = this.element.find("a").filter(options.navigationFilter);\r
+                               if ( current.length ) {\r
+                                       if ( current.filter(options.header).length ) {\r
+                                               options.active = current;\r
+                                       } else {\r
+                                               options.active = current.parent().parent().prev();\r
+                                               current.addClass("current");\r
+                                       }\r
+                               }\r
+                       }\r
+                       \r
+                       // calculate active if not specified, using the first header\r
+                       options.headers = this.element.find(options.header);\r
+                       options.active = findActive(options.headers, options.active);\r
+                       \r
+                       // IE7-/Win - Extra vertical space in Lists fixed\r
+                       if ($.browser.msie) {\r
+                               this.element.find('a').css('zoom', '1');\r
+                       }\r
+                       \r
+                       if (!this.element.hasClass("ui-accordion")) {\r
+                               this.element.addClass("ui-accordion");\r
+                               $("<span class='ui-accordion-left'/>").insertBefore(options.headers);\r
+                               $("<span class='ui-accordion-right'/>").appendTo(options.headers);\r
+                               options.headers.addClass("ui-accordion-header").attr("tabindex", "0");\r
+                       }\r
+                       \r
+                       var maxHeight;\r
+                       if ( options.fillSpace ) {\r
+                               maxHeight = this.element.parent().height();\r
+                               options.headers.each(function() {\r
+                                       maxHeight -= $(this).outerHeight();\r
+                               });\r
+                               var maxPadding = 0;\r
+                               options.headers.next().each(function() {\r
+                                       maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());\r
+                               }).height(maxHeight - maxPadding);\r
+                       } else if ( options.autoHeight ) {\r
+                               maxHeight = 0;\r
+                               options.headers.next().each(function() {\r
+                                       maxHeight = Math.max(maxHeight, $(this).outerHeight());\r
+                               }).height(maxHeight);\r
+                       }\r
+               \r
+                       options.headers\r
+                               .not(options.active || "")\r
+                               .next()\r
+                               .hide();\r
+                       options.active.parent().andSelf().addClass(options.selectedClass);\r
+                       \r
+                       if (options.event) {\r
+                               this.element.bind((options.event) + ".accordion", clickHandler);\r
+                       }\r
+               },\r
+               activate: function(index) {\r
+                       // call clickHandler with custom event\r
+                       clickHandler.call(this.element[0], {\r
+                               target: findActive( this.options.headers, index )[0]\r
+                       });\r
+               },\r
+               destroy: function() {\r
+                       this.options.headers.next().css("display", "");\r
+                       if ( this.options.fillSpace || this.options.autoHeight ) {\r
+                               this.options.headers.next().css("height", "");\r
+                       }\r
+                       $.removeData(this.element[0], "accordion");\r
+                       this.element.removeClass("ui-accordion").unbind(".accordion");\r
+               }\r
+       });\r
+       \r
+       function scopeCallback(callback, scope) {\r
+               return function() {\r
+                       return callback.apply(scope, arguments);\r
+               };\r
+       };\r
+       \r
+       function completed(cancel) {\r
+               // if removed while animated data can be empty\r
+               if (!$.data(this, "accordion")) {\r
+                       return;\r
+               }\r
+               \r
+               var instance = $.data(this, "accordion");\r
+               var options = instance.options;\r
+               options.running = cancel ? 0 : --options.running;\r
+               if ( options.running ) {\r
+                       return;\r
+               }\r
+               if ( options.clearStyle ) {\r
+                       options.toShow.add(options.toHide).css({\r
+                               height: "",\r
+                               overflow: ""\r
+                       });\r
+               }\r
+               $(this).triggerHandler("accordionchange", [options.data], options.change);\r
+       }\r
+       \r
+       function toggle(toShow, toHide, data, clickedActive, down) {\r
+               var options = $.data(this, "accordion").options;\r
+               options.toShow = toShow;\r
+               options.toHide = toHide;\r
+               options.data = data;\r
+               var complete = scopeCallback(completed, this);\r
+               \r
+               // count elements to animate\r
+               options.running = toHide.size() === 0 ? toShow.size() : toHide.size();\r
+               \r
+               if ( options.animated ) {\r
+                       if ( !options.alwaysOpen && clickedActive ) {\r
+                               $.ui.accordion.animations[options.animated]({\r
+                                       toShow: jQuery([]),\r
+                                       toHide: toHide,\r
+                                       complete: complete,\r
+                                       down: down,\r
+                                       autoHeight: options.autoHeight\r
+                               });\r
+                       } else {\r
+                               $.ui.accordion.animations[options.animated]({\r
+                                       toShow: toShow,\r
+                                       toHide: toHide,\r
+                                       complete: complete,\r
+                                       down: down,\r
+                                       autoHeight: options.autoHeight\r
+                               });\r
+                       }\r
+               } else {\r
+                       if ( !options.alwaysOpen && clickedActive ) {\r
+                               toShow.toggle();\r
+                       } else {\r
+                               toHide.hide();\r
+                               toShow.show();\r
+                       }\r
+                       complete(true);\r
+               }\r
+       }\r
+       \r
+       function clickHandler(event) {\r
+               var options = $.data(this, "accordion").options;\r
+               if (options.disabled) {\r
+                       return false;\r
+               }\r
+               \r
+               // called only when using activate(false) to close all parts programmatically\r
+               if ( !event.target && !options.alwaysOpen ) {\r
+                       options.active.parent().andSelf().toggleClass(options.selectedClass);\r
+                       var toHide = options.active.next(),\r
+                               data = {\r
+                                       instance: this,\r
+                                       options: options,\r
+                                       newHeader: jQuery([]),\r
+                                       oldHeader: options.active,\r
+                                       newContent: jQuery([]),\r
+                                       oldContent: toHide\r
+                               },\r
+                               toShow = (options.active = $([]));\r
+                       toggle.call(this, toShow, toHide, data );\r
+                       return false;\r
+               }\r
+               // get the click target\r
+               var clicked = $(event.target);\r
+               \r
+               // due to the event delegation model, we have to check if one\r
+               // of the parent elements is our actual header, and find that\r
+               if ( clicked.parents(options.header).length ) {\r
+                       while ( !clicked.is(options.header) ) {\r
+                               clicked = clicked.parent();\r
+                       }\r
+               }\r
+               \r
+               var clickedActive = clicked[0] == options.active[0];\r
+               \r
+               // if animations are still active, or the active header is the target, ignore click\r
+               if (options.running || (options.alwaysOpen && clickedActive)) {\r
+                       return false;\r
+               }\r
+               if (!clicked.is(options.header)) {\r
+                       return;\r
+               }\r
+               \r
+               // switch classes\r
+               options.active.parent().andSelf().toggleClass(options.selectedClass);\r
+               if ( !clickedActive ) {\r
+                       clicked.parent().andSelf().addClass(options.selectedClass);\r
+               }\r
+               \r
+               // find elements to show and hide\r
+               var toShow = clicked.next(),\r
+                       toHide = options.active.next(),\r
+                       //data = [clicked, options.active, toShow, toHide],\r
+                       data = {\r
+                               instance: this,\r
+                               options: options,\r
+                               newHeader: clicked,\r
+                               oldHeader: options.active,\r
+                               newContent: toShow,\r
+                               oldContent: toHide\r
+                       },\r
+                       down = options.headers.index( options.active[0] ) > options.headers.index( clicked[0] );\r
+               \r
+               options.active = clickedActive ? $([]) : clicked;\r
+               toggle.call(this, toShow, toHide, data, clickedActive, down );\r
+       \r
+               return false;\r
+       };\r
+       \r
+       function findActive(headers, selector) {\r
+               return selector != undefined\r
+                       ? typeof selector == "number"\r
+                               ? headers.filter(":eq(" + selector + ")")\r
+                               : headers.not(headers.not(selector))\r
+                       : selector === false\r
+                               ? $([])\r
+                               : headers.filter(":eq(0)");\r
+       }\r
+       \r
+       $.extend($.ui.accordion, {\r
+               defaults: {\r
+                       selectedClass: "selected",\r
+                       alwaysOpen: true,\r
+                       animated: 'slide',\r
+                       event: "click",\r
+                       header: "a",\r
+                       autoHeight: true,\r
+                       running: 0,\r
+                       navigationFilter: function() {\r
+                               return this.href.toLowerCase() == location.href.toLowerCase();\r
+                       }\r
+               },\r
+               animations: {\r
+                       slide: function(options, additions) {\r
+                               options = $.extend({\r
+                                       easing: "swing",\r
+                                       duration: 300\r
+                               }, options, additions);\r
+                               if ( !options.toHide.size() ) {\r
+                                       options.toShow.animate({height: "show"}, options);\r
+                                       return;\r
+                               }\r
+                               var hideHeight = options.toHide.height(),\r
+                                       showHeight = options.toShow.height(),\r
+                                       difference = showHeight / hideHeight;\r
+                               options.toShow.css({ height: 0, overflow: 'hidden' }).show();\r
+                               options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({height:"hide"},{\r
+                                       step: function(now) {\r
+                                               var current = (hideHeight - now) * difference;\r
+                                               if ($.browser.msie || $.browser.opera) {\r
+                                                       current = Math.ceil(current);\r
+                                               }\r
+                                               options.toShow.height( current );\r
+                                       },\r
+                                       duration: options.duration,\r
+                                       easing: options.easing,\r
+                                       complete: function() {\r
+                                               if ( !options.autoHeight ) {\r
+                                                       options.toShow.css("height", "auto");\r
+                                               }\r
+                                               options.complete();\r
+                                       }\r
+                               });\r
+                       },\r
+                       bounceslide: function(options) {\r
+                               this.slide(options, {\r
+                                       easing: options.down ? "bounceout" : "swing",\r
+                                       duration: options.down ? 1000 : 200\r
+                               });\r
+                       },\r
+                       easeslide: function(options) {\r
+                               this.slide(options, {\r
+                                       easing: "easeinout",\r
+                                       duration: 700\r
+                               });\r
+                       }\r
+               }\r
+       });\r
+       \r
+       // deprecated, use accordion("activate", index) instead\r
+       $.fn.activate = function(index) {\r
+               return this.accordion("activate", index);\r
+       };\r
+\r
+})(jQuery);\r
diff --git a/ui/source/ui.core.js b/ui/source/ui.core.js
new file mode 100644 (file)
index 0000000..500cbdc
--- /dev/null
@@ -0,0 +1,241 @@
+/*\r
+ * jQuery UI @VERSION\r
+ *\r
+ * Copyright (c) 2008 Paul Bakaus (ui.jquery.com)\r
+ * Dual licensed under the MIT (MIT-LICENSE.txt)\r
+ * and GPL (GPL-LICENSE.txt) licenses.\r
+ *\r
+ * http://docs.jquery.com/UI\r
+ *\r
+ * $Id: ui.core.js 5634 2008-05-19 20:53:51Z joern.zaefferer $\r
+ */\r
+;(function($) {\r
+       \r
+       $.ui = {\r
+               plugin: {\r
+                       add: function(module, option, set) {\r
+                               var proto = $.ui[module].prototype;\r
+                               for(var i in set) {\r
+                                       proto.plugins[i] = proto.plugins[i] || [];\r
+                                       proto.plugins[i].push([option, set[i]]);\r
+                               }\r
+                       },\r
+                       call: function(instance, name, args) {\r
+                               var set = instance.plugins[name];\r
+                               if(!set) { return; }\r
+                               \r
+                               for (var i = 0; i < set.length; i++) {\r
+                                       if (instance.options[set[i][0]]) {\r
+                                               set[i][1].apply(instance.element, args);\r
+                                       }\r
+                               }\r
+                       }       \r
+               },\r
+               cssCache: {},\r
+               css: function(name) {\r
+                       if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }\r
+                       var tmp = $('<div class="ui-resizable-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body');\r
+                       \r
+                       //if (!$.browser.safari)\r
+                               //tmp.appendTo('body'); \r
+                       \r
+                       //Opera and Safari set width and height to 0px instead of auto\r
+                       //Safari returns rgba(0,0,0,0) when bgcolor is not set\r
+                       $.ui.cssCache[name] = !!(\r
+                               (!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || \r
+                               !(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))\r
+                       );\r
+                       try { $('body').get(0).removeChild(tmp.get(0)); } catch(e){}\r
+                       return $.ui.cssCache[name];\r
+               },\r
+               disableSelection: function(e) {\r
+                       e.unselectable = "on";\r
+                       e.onselectstart = function() { return false; };\r
+                       if (e.style) { e.style.MozUserSelect = "none"; }\r
+               },\r
+               enableSelection: function(e) {\r
+                       e.unselectable = "off";\r
+                       e.onselectstart = function() { return true; };\r
+                       if (e.style) { e.style.MozUserSelect = ""; }\r
+               },\r
+               hasScroll: function(e, a) {\r
+                       var scroll = /top/.test(a||"top") ? 'scrollTop' : 'scrollLeft', has = false;\r
+                       if (e[scroll] > 0) return true; e[scroll] = 1;\r
+                       has = e[scroll] > 0 ? true : false; e[scroll] = 0;\r
+                       return has;\r
+               }\r
+       };\r
+       \r
+       \r
+       /** jQuery core modifications and additions **/\r
+       \r
+       var _remove = $.fn.remove;\r
+       $.fn.remove = function() {\r
+               $("*", this).add(this).trigger("remove");\r
+               return _remove.apply(this, arguments );\r
+       };\r
+       \r
+       // $.widget is a factory to create jQuery plugins\r
+       // taking some boilerplate code out of the plugin code\r
+       // created by Scott González and Jörn Zaefferer\r
+       function getter(namespace, plugin, method) {\r
+               var methods = $[namespace][plugin].getter || [];\r
+               methods = (typeof methods == "string" ? methods.split(/,?\s+/) : methods);\r
+               return ($.inArray(method, methods) != -1);\r
+       }\r
+       \r
+       var widgetPrototype = {\r
+               init: function() {},\r
+               destroy: function() {\r
+                       this.element.removeData(this.widgetName);\r
+               },\r
+               \r
+               getData: function(key) {\r
+                       return this.options[key];\r
+               },\r
+               setData: function(key, value) {\r
+                       this.options[key] = value;\r
+               },\r
+               \r
+               enable: function() {\r
+                       this.setData('disabled', false);\r
+               },\r
+               disable: function() {\r
+                       this.setData('disabled', true);\r
+               }\r
+       };\r
+       \r
+       $.widget = function(name, prototype) {\r
+               var namespace = name.split(".")[0];\r
+               name = name.split(".")[1];\r
+               // create plugin method\r
+               $.fn[name] = function(options) {\r
+                       var isMethodCall = (typeof options == 'string'),\r
+                               args = Array.prototype.slice.call(arguments, 1);\r
+                       \r
+                       if (isMethodCall && getter(namespace, name, options)) {\r
+                               var instance = $.data(this[0], name);\r
+                               return (instance ? instance[options].apply(instance, args)\r
+                                       : undefined);\r
+                       }\r
+                       \r
+                       return this.each(function() {\r
+                               var instance = $.data(this, name);\r
+                               if (!instance) {\r
+                                       $.data(this, name, new $[namespace][name](this, options));\r
+                               } else if (isMethodCall) {\r
+                                       instance[options].apply(instance, args);\r
+                               }\r
+                       });\r
+               };\r
+               \r
+               // create widget constructor\r
+               $[namespace][name] = function(element, options) {\r
+                       var self = this;\r
+                       \r
+                       this.widgetName = name;\r
+                       \r
+                       this.options = $.extend({}, $[namespace][name].defaults, options);\r
+                       this.element = $(element)\r
+                               .bind('setData.' + name, function(e, key, value) {\r
+                                       return self.setData(key, value);\r
+                               })\r
+                               .bind('getData.' + name, function(e, key) {\r
+                                       return self.getData(key);\r
+                               })\r
+                               .bind('remove', function() {\r
+                                       return self.destroy();\r
+                               });\r
+                       this.init();\r
+               };\r
+               \r
+               // add widget prototype\r
+               $[namespace][name].prototype = $.extend({}, widgetPrototype, prototype);\r
+       };\r
+       \r
+       \r
+       /** Mouse Interaction Plugin **/\r
+       \r
+       $.widget("ui.mouse", {\r
+               init: function() {\r
+                       var self = this;\r
+                       \r
+                       this.element\r
+                               .bind('mousedown.mouse', function() { return self.click.apply(self, arguments); })\r
+                               .bind('mouseup.mouse', function() { (self.timer && clearTimeout(self.timer)); })\r
+                               .bind('click.mouse', function() { if(self.initialized) { self.initialized = false; return false; } });\r
+                       //Prevent text selection in IE\r
+                       if ($.browser.msie) {\r
+                               this.unselectable = this.element.attr('unselectable');\r
+                               this.element.attr('unselectable', 'on');\r
+                       }\r
+               },\r
+               destroy: function() {\r
+                       this.element.unbind('.mouse').removeData("mouse");\r
+                       ($.browser.msie && this.element.attr('unselectable', this.unselectable));\r
+               },\r
+               trigger: function() { return this.click.apply(this, arguments); },\r
+               click: function(e) {\r
+               \r
+                       if(    e.which != 1 //only left click starts dragging\r
+                               || $.inArray(e.target.nodeName.toLowerCase(), this.options.dragPrevention || []) != -1 // Prevent execution on defined elements\r
+                               || (this.options.condition && !this.options.condition.apply(this.options.executor || this, [e, this.element])) //Prevent execution on condition\r
+                       ) { return true; }\r
+               \r
+                       var self = this;\r
+                       this.initialized = false;\r
+                       var initialize = function() {\r
+                               self._MP = { left: e.pageX, top: e.pageY }; // Store the click mouse position\r
+                               $(document).bind('mouseup.mouse', function() { return self.stop.apply(self, arguments); });\r
+                               $(document).bind('mousemove.mouse', function() { return self.drag.apply(self, arguments); });\r
+               \r
+                               if(!self.initalized && Math.abs(self._MP.left-e.pageX) >= self.options.distance || Math.abs(self._MP.top-e.pageY) >= self.options.distance) {\r
+                                       (self.options.start && self.options.start.call(self.options.executor || self, e, self.element));\r
+                                       (self.options.drag && self.options.drag.call(self.options.executor || self, e, this.element)); //This is actually not correct, but expected\r
+                                       self.initialized = true;\r
+                               }\r
+                       };\r
+\r
+                       if(this.options.delay) {\r
+                               if(this.timer) { clearTimeout(this.timer); }\r
+                               this.timer = setTimeout(initialize, this.options.delay);\r
+                       } else {\r
+                               initialize();\r
+                       }\r
+                               \r
+                       return false;\r
+                       \r
+               },\r
+               stop: function(e) {\r
+                       \r
+                       if(!this.initialized) {\r
+                               return $(document).unbind('mouseup.mouse').unbind('mousemove.mouse');\r
+                       }\r
+\r
+                       (this.options.stop && this.options.stop.call(this.options.executor || this, e, this.element));\r
+                       \r
+                       $(document).unbind('mouseup.mouse').unbind('mousemove.mouse');\r
+                       return false;\r
+                       \r
+               },\r
+               drag: function(e) {\r
+\r
+                       var o = this.options;\r
+                       if ($.browser.msie && !e.button) {\r
+                               return this.stop.call(this, e); // IE mouseup check\r
+                       }\r
+                       \r
+                       if(!this.initialized && (Math.abs(this._MP.left-e.pageX) >= o.distance || Math.abs(this._MP.top-e.pageY) >= o.distance)) {\r
+                               (o.start && o.start.call(o.executor || this, e, this.element));\r
+                               this.initialized = true;\r
+                       } else {\r
+                               if(!this.initialized) { return false; }\r
+                       }\r
+\r
+                       (o.drag && o.drag.call(this.options.executor || this, e, this.element));\r
+                       return false;\r
+                       \r
+               }\r
+       });\r
+       \r
+})(jQuery);\r
diff --git a/ui/source/ui.datepicker.js b/ui/source/ui.datepicker.js
new file mode 100644 (file)
index 0000000..4d49d4a
--- /dev/null
@@ -0,0 +1,1440 @@
+/* jQuery UI Date Picker v3.4.3 (previously jQuery Calendar)\r
+   Written by Marc Grabanski (m@marcgrabanski.com) and Keith Wood (kbwood@virginbroadband.com.au).\r
+\r
+   Copyright (c) 2007 Marc Grabanski (http://marcgrabanski.com/code/ui-datepicker)\r
+   Dual licensed under the MIT (MIT-LICENSE.txt)\r
+   and GPL (GPL-LICENSE.txt) licenses.\r
+   Date: 09-03-2007  */\r
+   \r
+;(function($) { // hide the namespace\r
+\r
+/* Date picker manager.\r
+   Use the singleton instance of this class, $.datepicker, to interact with the date picker.\r
+   Settings for (groups of) date pickers are maintained in an instance object\r
+   (DatepickerInstance), allowing multiple different settings on the same page. */\r
+\r
+function Datepicker() {\r
+       this.debug = false; // Change this to true to start debugging\r
+       this._nextId = 0; // Next ID for a date picker instance\r
+       this._inst = []; // List of instances indexed by ID\r
+       this._curInst = null; // The current instance in use\r
+       this._disabledInputs = []; // List of date picker inputs that have been disabled\r
+       this._datepickerShowing = false; // True if the popup picker is showing , false if not\r
+       this._inDialog = false; // True if showing within a "dialog", false if not\r
+       this.regional = []; // Available regional settings, indexed by language code\r
+       this.regional[''] = { // Default regional settings\r
+               clearText: 'Clear', // Display text for clear link\r
+               clearStatus: 'Erase the current date', // Status text for clear link\r
+               closeText: 'Close', // Display text for close link\r
+               closeStatus: 'Close without change', // Status text for close link\r
+               prevText: '&#x3c;Prev', // Display text for previous month link\r
+               prevStatus: 'Show the previous month', // Status text for previous month link\r
+               nextText: 'Next&#x3e;', // Display text for next month link\r
+               nextStatus: 'Show the next month', // Status text for next month link\r
+               currentText: 'Today', // Display text for current month link\r
+               currentStatus: 'Show the current month', // Status text for current month link\r
+               monthNames: ['January','February','March','April','May','June',\r
+                       'July','August','September','October','November','December'], // Names of months for drop-down and formatting\r
+               monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\r
+               monthStatus: 'Show a different month', // Status text for selecting a month\r
+               yearStatus: 'Show a different year', // Status text for selecting a year\r
+               weekHeader: 'Wk', // Header for the week of the year column\r
+               weekStatus: 'Week of the year', // Status text for the week of the year column\r
+               dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\r
+               dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\r
+               dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\r
+               dayStatus: 'Set DD as first week day', // Status text for the day of the week selection\r
+               dateStatus: 'Select DD, M d', // Status text for the date selection\r
+               dateFormat: 'mm/dd/yy', // See format options on parseDate\r
+               firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\r
+               initStatus: 'Select a date', // Initial Status text on opening\r
+               isRTL: false // True if right-to-left language, false if left-to-right\r
+       };\r
+       this._defaults = { // Global defaults for all the date picker instances\r
+               showOn: 'focus', // 'focus' for popup on focus,\r
+                       // 'button' for trigger button, or 'both' for either\r
+               showAnim: 'show', // Name of jQuery animation for popup\r
+               defaultDate: null, // Used when field is blank: actual date,\r
+                       // +/-number for offset from today, null for today\r
+               appendText: '', // Display text following the input box, e.g. showing the format\r
+               buttonText: '...', // Text for trigger button\r
+               buttonImage: '', // URL for trigger button image\r
+               buttonImageOnly: false, // True if the image appears alone, false if it appears on a button\r
+               closeAtTop: true, // True to have the clear/close at the top,\r
+                       // false to have them at the bottom\r
+               mandatory: false, // True to hide the Clear link, false to include it\r
+               hideIfNoPrevNext: false, // True to hide next/previous month links\r
+                       // if not applicable, false to just disable them\r
+               changeMonth: true, // True if month can be selected directly, false if only prev/next\r
+               changeYear: true, // True if year can be selected directly, false if only prev/next\r
+               yearRange: '-10:+10', // Range of years to display in drop-down,\r
+                       // either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)\r
+               changeFirstDay: true, // True to click on day name to change, false to remain as set\r
+               showOtherMonths: false, // True to show dates in other months, false to leave blank\r
+               showWeeks: false, // True to show week of the year, false to omit\r
+               calculateWeek: this.iso8601Week, // How to calculate the week of the year,\r
+                       // takes a Date and returns the number of the week for it\r
+               shortYearCutoff: '+10', // Short year values < this are in the current century,\r
+                       // > this are in the previous century, \r
+                       // string value starting with '+' for current year + value\r
+               showStatus: false, // True to show status bar at bottom, false to not show it\r
+               statusForDate: this.dateStatus, // Function to provide status text for a date -\r
+                       // takes date and instance as parameters, returns display text\r
+               minDate: null, // The earliest selectable date, or null for no limit\r
+               maxDate: null, // The latest selectable date, or null for no limit\r
+               speed: 'normal', // Speed of display/closure\r
+               beforeShowDay: null, // Function that takes a date and returns an array with\r
+                       // [0] = true if selectable, false if not,\r
+                       // [1] = custom CSS class name(s) or '', e.g. $.datepicker.noWeekends\r
+               beforeShow: null, // Function that takes an input field and\r
+                       // returns a set of custom settings for the date picker\r
+               onSelect: null, // Define a callback function when a date is selected\r
+               onClose: null, // Define a callback function when the datepicker is closed\r
+               numberOfMonths: 1, // Number of months to show at a time\r
+               stepMonths: 1, // Number of months to step back/forward\r
+               rangeSelect: false, // Allows for selecting a date range on one date picker\r
+               rangeSeparator: ' - ' // Text between two dates in a range\r
+       };\r
+       $.extend(this._defaults, this.regional['']);\r
+       this._datepickerDiv = $('<div id="datepicker_div"></div>');\r
+}\r
+\r
+$.extend(Datepicker.prototype, {\r
+       /* Class name added to elements to indicate already configured with a date picker. */\r
+       markerClassName: 'hasDatepicker',\r
+\r
+       /* Debug logging (if enabled). */\r
+       log: function () {\r
+               if (this.debug)\r
+                       console.log.apply('', arguments);\r
+       },\r
+       \r
+       /* Register a new date picker instance - with custom settings. */\r
+       _register: function(inst) {\r
+               var id = this._nextId++;\r
+               this._inst[id] = inst;\r
+               return id;\r
+       },\r
+\r
+       /* Retrieve a particular date picker instance based on its ID. */\r
+       _getInst: function(id) {\r
+               return this._inst[id] || id;\r
+       },\r
+\r
+       /* Override the default settings for all instances of the date picker. \r
+          @param  settings  object - the new settings to use as defaults (anonymous object)\r
+          @return the manager object */\r
+       setDefaults: function(settings) {\r
+               extendRemove(this._defaults, settings || {});\r
+               return this;\r
+       },\r
+\r
+       /* Attach the date picker to a jQuery selection.\r
+          @param  target    element - the target input field or division or span\r
+          @param  settings  object - the new settings to use for this date picker instance (anonymous) */\r
+       _attachDatepicker: function(target, settings) {\r
+               // check for settings on the control itself - in namespace 'date:'\r
+               var inlineSettings = null;\r
+               for (attrName in this._defaults) {\r
+                       var attrValue = target.getAttribute('date:' + attrName);\r
+                       if (attrValue) {\r
+                               inlineSettings = inlineSettings || {};\r
+                               try {\r
+                                       inlineSettings[attrName] = eval(attrValue);\r
+                               } catch (err) {\r
+                                       inlineSettings[attrName] = attrValue;\r
+                               }\r
+                       }\r
+               }\r
+               var nodeName = target.nodeName.toLowerCase();\r
+               var instSettings = (inlineSettings ? \r
+                       $.extend(settings || {}, inlineSettings || {}) : settings);\r
+               if (nodeName == 'input') {\r
+                       var inst = (inst && !inlineSettings ? inst :\r
+                               new DatepickerInstance(instSettings, false));\r
+                       this._connectDatepicker(target, inst);\r
+               } else if (nodeName == 'div' || nodeName == 'span') {\r
+                       var inst = new DatepickerInstance(instSettings, true);\r
+                       this._inlineDatepicker(target, inst);\r
+               }\r
+       },\r
+\r
+       /* Detach a datepicker from its control.\r
+          @param  target    element - the target input field or division or span */\r
+       _destroyDatepicker: function(target) {\r
+               var nodeName = target.nodeName.toLowerCase();\r
+               var calId = target._calId;\r
+               target._calId = null;\r
+               var $target = $(target);\r
+               if (nodeName == 'input') {\r
+                       $target.siblings('.datepicker_append').replaceWith('').end()\r
+                               .siblings('.datepicker_trigger').replaceWith('').end()\r
+                               .removeClass(this.markerClassName)\r
+                               .unbind('focus', this._showDatepicker)\r
+                               .unbind('keydown', this._doKeyDown)\r
+                               .unbind('keypress', this._doKeyPress);\r
+                       var wrapper = $target.parents('.datepicker_wrap');\r
+                       if (wrapper)\r
+                               wrapper.replaceWith(wrapper.html());\r
+               } else if (nodeName == 'div' || nodeName == 'span')\r
+                       $target.removeClass(this.markerClassName).empty();\r
+               if ($('input[_calId=' + calId + ']').length == 0)\r
+                       // clean up if last for this ID\r
+                       this._inst[calId] = null;\r
+       },\r
+\r
+       /* Enable the date picker to a jQuery selection.\r
+          @param  target    element - the target input field or division or span */\r
+       _enableDatepicker: function(target) {\r
+               target.disabled = false;\r
+               $(target).siblings('button.datepicker_trigger').each(function() { this.disabled = false; }).end()\r
+                       .siblings('img.datepicker_trigger').css({opacity: '1.0', cursor: ''});\r
+               this._disabledInputs = $.map(this._disabledInputs,\r
+                       function(value) { return (value == target ? null : value); }); // delete entry\r
+       },\r
+\r
+       /* Disable the date picker to a jQuery selection.\r
+          @param  target    element - the target input field or division or span */\r
+       _disableDatepicker: function(target) {\r
+               target.disabled = true;\r
+               $(target).siblings('button.datepicker_trigger').each(function() { this.disabled = true; }).end()\r
+                       .siblings('img.datepicker_trigger').css({opacity: '0.5', cursor: 'default'});\r
+               this._disabledInputs = $.map($.datepicker._disabledInputs,\r
+                       function(value) { return (value == target ? null : value); }); // delete entry\r
+               this._disabledInputs[$.datepicker._disabledInputs.length] = target;\r
+       },\r
+\r
+       /* Is the first field in a jQuery collection disabled as a datepicker?\r
+          @param  target    element - the target input field or division or span\r
+          @return boolean - true if disabled, false if enabled */\r
+       _isDisabledDatepicker: function(target) {\r
+               if (!target)\r
+                       return false;\r
+               for (var i = 0; i < this._disabledInputs.length; i++) {\r
+                       if (this._disabledInputs[i] == target)\r
+                               return true;\r
+               }\r
+               return false;\r
+       },\r
+\r
+       /* Update the settings for a date picker attached to an input field or division.\r
+          @param  target  element - the target input field or division or span\r
+          @param  name    string - the name of the setting to change or\r
+                          object - the new settings to update\r
+          @param  value   any - the new value for the setting (omit if above is an object) */\r
+       _changeDatepicker: function(target, name, value) {\r
+               var settings = name || {};\r
+               if (typeof name == 'string') {\r
+                       settings = {};\r
+                       settings[name] = value;\r
+               }\r
+               if (inst = this._getInst(target._calId)) {\r
+                       extendRemove(inst._settings, settings);\r
+                       this._updateDatepicker(inst);\r
+               }\r
+       },\r
+\r
+       /* Set the dates for a jQuery selection.\r
+          @param  target   element - the target input field or division or span\r
+          @param  date     Date - the new date\r
+          @param  endDate  Date - the new end date for a range (optional) */\r
+       _setDateDatepicker: function(target, date, endDate) {\r
+               if (inst = this._getInst(target._calId)) {\r
+                       inst._setDate(date, endDate);\r
+                       this._updateDatepicker(inst);\r
+               }\r
+       },\r
+\r
+       /* Get the date(s) for the first entry in a jQuery selection.\r
+          @param  target  element - the target input field or division or span\r
+          @return Date - the current date or\r
+                  Date[2] - the current dates for a range */\r
+       _getDateDatepicker: function(target) {\r
+               var inst = this._getInst(target._calId);\r
+               return (inst ? inst._getDate() : null);\r
+       },\r
+\r
+       /* Handle keystrokes. */\r
+       _doKeyDown: function(e) {\r
+               var inst = $.datepicker._getInst(this._calId);\r
+               if ($.datepicker._datepickerShowing)\r
+                       switch (e.keyCode) {\r
+                               case 9:  $.datepicker._hideDatepicker(null, '');\r
+                                               break; // hide on tab out\r
+                               case 13: $.datepicker._selectDay(inst, inst._selectedMonth, inst._selectedYear,\r
+                                                       $('td.datepicker_daysCellOver', inst._datepickerDiv)[0]);\r
+                                               return false; // don't submit the form\r
+                                               break; // select the value on enter\r
+                               case 27: $.datepicker._hideDatepicker(null, inst._get('speed'));\r
+                                               break; // hide on escape\r
+                               case 33: $.datepicker._adjustDate(inst,\r
+                                                       (e.ctrlKey ? -1 : -inst._get('stepMonths')), (e.ctrlKey ? 'Y' : 'M'));\r
+                                               break; // previous month/year on page up/+ ctrl\r
+                               case 34: $.datepicker._adjustDate(inst,\r
+                                                       (e.ctrlKey ? +1 : +inst._get('stepMonths')), (e.ctrlKey ? 'Y' : 'M'));\r
+                                               break; // next month/year on page down/+ ctrl\r
+                               case 35: if (e.ctrlKey) $.datepicker._clearDate(inst);\r
+                                               break; // clear on ctrl+end\r
+                               case 36: if (e.ctrlKey) $.datepicker._gotoToday(inst);\r
+                                               break; // current on ctrl+home\r
+                               case 37: if (e.ctrlKey) $.datepicker._adjustDate(inst, -1, 'D');\r
+                                               break; // -1 day on ctrl+left\r
+                               case 38: if (e.ctrlKey) $.datepicker._adjustDate(inst, -7, 'D');\r
+                                               break; // -1 week on ctrl+up\r
+                               case 39: if (e.ctrlKey) $.datepicker._adjustDate(inst, +1, 'D');\r
+                                               break; // +1 day on ctrl+right\r
+                               case 40: if (e.ctrlKey) $.datepicker._adjustDate(inst, +7, 'D');\r
+                                               break; // +1 week on ctrl+down\r
+                       }\r
+               else if (e.keyCode == 36 && e.ctrlKey) // display the date picker on ctrl+home\r
+                       $.datepicker._showDatepicker(this);\r
+       },\r
+\r
+       /* Filter entered characters - based on date format. */\r
+       _doKeyPress: function(e) {\r
+               var inst = $.datepicker._getInst(this._calId);\r
+               var chars = $.datepicker._possibleChars(inst._get('dateFormat'));\r
+               var chr = String.fromCharCode(e.charCode == undefined ? e.keyCode : e.charCode);\r
+               return e.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);\r
+       },\r
+\r
+       /* Attach the date picker to an input field. */\r
+       _connectDatepicker: function(target, inst) {\r
+               var input = $(target);\r
+               if (input.is('.' + this.markerClassName))\r
+                       return;\r
+               var appendText = inst._get('appendText');\r
+               var isRTL = inst._get('isRTL');\r
+               if (appendText) {\r
+                       if (isRTL)\r
+                               input.before('<span class="datepicker_append">' + appendText);\r
+                       else\r
+                               input.after('<span class="datepicker_append">' + appendText);\r
+               }\r
+               var showOn = inst._get('showOn');\r
+               if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field\r
+                       input.focus(this._showDatepicker);\r
+               if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked\r
+                       input.wrap('<span class="datepicker_wrap">');\r
+                       var buttonText = inst._get('buttonText');\r
+                       var buttonImage = inst._get('buttonImage');\r
+                       var trigger = $(inst._get('buttonImageOnly') ? \r
+                               $('<img>').addClass('datepicker_trigger').attr({ src: buttonImage, alt: buttonText, title: buttonText }) :\r
+                               $('<button>').addClass('datepicker_trigger').attr({ type: 'button' }).html(buttonImage != '' ? \r
+                                               $('<img>').attr({ src:buttonImage, alt:buttonText, title:buttonText }) : buttonText));\r
+                       if (isRTL)\r
+                               input.before(trigger);\r
+                       else\r
+                               input.after(trigger);\r
+                       trigger.click(function() {\r
+                               if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target)\r
+                                       $.datepicker._hideDatepicker();\r
+                               else\r
+                                       $.datepicker._showDatepicker(target);\r
+                       });\r
+        }\r
+               input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress)\r
+                       .bind("setData.datepicker", function(event, key, value) {\r
+                               inst._settings[key] = value;\r
+                       }).bind("getData.datepicker", function(event, key) {\r
+                               return inst._get(key);\r
+                       });\r
+               input[0]._calId = inst._id;\r
+       },\r
+\r
+       /* Attach an inline date picker to a div. */\r
+       _inlineDatepicker: function(target, inst) {\r
+               var input = $(target);\r
+               if (input.is('.' + this.markerClassName))\r
+                       return;\r
+               input.addClass(this.markerClassName).append(inst._datepickerDiv)\r
+                       .bind("setData.datepicker", function(event, key, value){\r
+                               inst._settings[key] = value;\r
+                       }).bind("getData.datepicker", function(event, key){\r
+                               return inst._get(key);\r
+                       });\r
+               input[0]._calId = inst._id;\r
+               this._updateDatepicker(inst);\r
+       },\r
+\r
+       /* Tidy up after displaying the date picker. */\r
+       _inlineShow: function(inst) {\r
+               var numMonths = inst._getNumberOfMonths(); // fix width for dynamic number of date pickers\r
+               inst._datepickerDiv.width(numMonths[1] * $('.datepicker', inst._datepickerDiv[0]).width());\r
+       }, \r
+\r
+       /* Pop-up the date picker in a "dialog" box.\r
+          @param  input     element - ignored\r
+          @param  dateText  string - the initial date to display (in the current format)\r
+          @param  onSelect  function - the function(dateText) to call when a date is selected\r
+          @param  settings  object - update the dialog date picker instance's settings (anonymous object)\r
+          @param  pos       int[2] - coordinates for the dialog's position within the screen or\r
+                            event - with x/y coordinates or\r
+                            leave empty for default (screen centre)\r
+          @return the manager object */\r
+       _dialogDatepicker: function(input, dateText, onSelect, settings, pos) {\r
+               var inst = this._dialogInst; // internal instance\r
+               if (!inst) {\r
+                       inst = this._dialogInst = new DatepickerInstance({}, false);\r
+                       this._dialogInput = $('<input type="text" size="1" style="position: absolute; top: -100px;"/>');\r
+                       this._dialogInput.keydown(this._doKeyDown);\r
+                       $('body').append(this._dialogInput);\r
+                       this._dialogInput[0]._calId = inst._id;\r
+               }\r
+               extendRemove(inst._settings, settings || {});\r
+               this._dialogInput.val(dateText);\r
+\r
+               this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);\r
+               if (!this._pos) {\r
+                       var browserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\r
+                       var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\r
+                       var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;\r
+                       var scrollY = document.documentElement.scrollTop || document.body.scrollTop;\r
+                       this._pos = // should use actual width/height below\r
+                               [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];\r
+               }\r
+\r
+               // move input on screen for focus, but hidden behind dialog\r
+               this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');\r
+               inst._settings.onSelect = onSelect;\r
+               this._inDialog = true;\r
+               this._datepickerDiv.addClass('datepicker_dialog');\r
+               this._showDatepicker(this._dialogInput[0]);\r
+               if ($.blockUI)\r
+                       $.blockUI(this._datepickerDiv);\r
+               return this;\r
+       },\r
+\r
+       /* Pop-up the date picker for a given input field.\r
+          @param  input  element - the input field attached to the date picker or\r
+                         event - if triggered by focus */\r
+       _showDatepicker: function(input) {\r
+               input = input.target || input;\r
+               if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger\r
+                       input = $('input', input.parentNode)[0];\r
+               if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here\r
+                       return;\r
+               var inst = $.datepicker._getInst(input._calId);\r
+               var beforeShow = inst._get('beforeShow');\r
+               extendRemove(inst._settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));\r
+               $.datepicker._hideDatepicker(null, '');\r
+               $.datepicker._lastInput = input;\r
+               inst._setDateFromField(input);\r
+               if ($.datepicker._inDialog) // hide cursor\r
+                       input.value = '';\r
+               if (!$.datepicker._pos) { // position below input\r
+                       $.datepicker._pos = $.datepicker._findPos(input);\r
+                       $.datepicker._pos[1] += input.offsetHeight; // add the height\r
+               }\r
+               var isFixed = false;\r
+               $(input).parents().each(function() {\r
+                       isFixed |= $(this).css('position') == 'fixed';\r
+               });\r
+               if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled\r
+                       $.datepicker._pos[0] -= document.documentElement.scrollLeft;\r
+                       $.datepicker._pos[1] -= document.documentElement.scrollTop;\r
+               }\r
+               inst._datepickerDiv.css('position', ($.datepicker._inDialog && $.blockUI ?\r
+                       'static' : (isFixed ? 'fixed' : 'absolute')))\r
+                       .css({ left: $.datepicker._pos[0] + 'px', top: $.datepicker._pos[1] + 'px' });\r
+               $.datepicker._pos = null;\r
+               inst._rangeStart = null;\r
+               $.datepicker._updateDatepicker(inst);\r
+               if (!inst._inline) {\r
+                       var speed = inst._get('speed');\r
+                       var postProcess = function() {\r
+                               $.datepicker._datepickerShowing = true;\r
+                               $.datepicker._afterShow(inst);\r
+                       };\r
+                       var showAnim = inst._get('showAnim') || 'show';\r
+                       inst._datepickerDiv[showAnim](speed, postProcess);\r
+                       if (speed == '')\r
+                               postProcess();\r
+                       if (inst._input[0].type != 'hidden')\r
+                               inst._input[0].focus();\r
+                       $.datepicker._curInst = inst;\r
+               }\r
+       },\r
+\r
+       /* Generate the date picker content. */\r
+       _updateDatepicker: function(inst) {\r
+               inst._datepickerDiv.empty().append(inst._generateDatepicker());\r
+               var numMonths = inst._getNumberOfMonths();\r
+               if (numMonths[0] != 1 || numMonths[1] != 1)\r
+                       inst._datepickerDiv.addClass('datepicker_multi');\r
+               else\r
+                       inst._datepickerDiv.removeClass('datepicker_multi');\r
+\r
+               if (inst._get('isRTL'))\r
+                       inst._datepickerDiv.addClass('datepicker_rtl');\r
+               else\r
+                       inst._datepickerDiv.removeClass('datepicker_rtl');\r
+\r
+               if (inst._input && inst._input[0].type != 'hidden')\r
+                       $(inst._input[0]).focus();\r
+       },\r
+\r
+       /* Tidy up after displaying the date picker. */\r
+       _afterShow: function(inst) {\r
+               var numMonths = inst._getNumberOfMonths(); // fix width for dynamic number of date pickers\r
+               inst._datepickerDiv.width(numMonths[1] * $('.datepicker', inst._datepickerDiv[0])[0].offsetWidth);\r
+               if ($.browser.msie && parseInt($.browser.version) < 7) { // fix IE < 7 select problems\r
+                       $('iframe.datepicker_cover').css({width: inst._datepickerDiv.width() + 4,\r
+                               height: inst._datepickerDiv.height() + 4});\r
+               }\r
+               // re-position on screen if necessary\r
+               var isFixed = inst._datepickerDiv.css('position') == 'fixed';\r
+               var pos = inst._input ? $.datepicker._findPos(inst._input[0]) : null;\r
+               var browserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\r
+               var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\r
+               var scrollX = (isFixed ? 0 : document.documentElement.scrollLeft || document.body.scrollLeft);\r
+               var scrollY = (isFixed ? 0 : document.documentElement.scrollTop || document.body.scrollTop);\r
+               // reposition date picker horizontally if outside the browser window\r
+               if ((inst._datepickerDiv.offset().left + inst._datepickerDiv.width() -\r
+                               (isFixed && $.browser.msie ? document.documentElement.scrollLeft : 0)) >\r
+                               (browserWidth + scrollX)) {\r
+                       inst._datepickerDiv.css('left', Math.max(scrollX,\r
+                               pos[0] + (inst._input ? $(inst._input[0]).width() : null) - inst._datepickerDiv.width() -\r
+                               (isFixed && $.browser.opera ? document.documentElement.scrollLeft : 0)) + 'px');\r
+               }\r
+               // reposition date picker vertically if outside the browser window\r
+               if ((inst._datepickerDiv.offset().top + inst._datepickerDiv.height() -\r
+                               (isFixed && $.browser.msie ? document.documentElement.scrollTop : 0)) >\r
+                               (browserHeight + scrollY) ) {\r
+                       inst._datepickerDiv.css('top', Math.max(scrollY,\r
+                               pos[1] - (this._inDialog ? 0 : inst._datepickerDiv.height()) -\r
+                               (isFixed && $.browser.opera ? document.documentElement.scrollTop : 0)) + 'px');\r
+               }\r
+       },\r
+       \r
+       /* Find an object's position on the screen. */\r
+       _findPos: function(obj) {\r
+        while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {\r
+            obj = obj.nextSibling;\r
+        }\r
+        var position = $(obj).offset();\r
+           return [position.left, position.top];\r
+       },\r
+\r
+       /* Hide the date picker from view.\r
+          @param  input  element - the input field attached to the date picker\r
+          @param  speed  string - the speed at which to close the date picker */\r
+       _hideDatepicker: function(input, speed) {\r
+               var inst = this._curInst;\r
+               if (!inst)\r
+                       return;\r
+               var rangeSelect = inst._get('rangeSelect');\r
+               if (rangeSelect && this._stayOpen) {\r
+                       this._selectDate(inst, inst._formatDate(\r
+                               inst._currentDay, inst._currentMonth, inst._currentYear));\r
+               }\r
+               this._stayOpen = false;\r
+               if (this._datepickerShowing) {\r
+                       speed = (speed != null ? speed : inst._get('speed'));\r
+                       var showAnim = inst._get('showAnim');\r
+                       inst._datepickerDiv[(showAnim == 'slideDown' ? 'slideUp' :\r
+                               (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))](speed, function() {\r
+                               $.datepicker._tidyDialog(inst);\r
+                       });\r
+                       if (speed == '')\r
+                               this._tidyDialog(inst);\r
+                       var onClose = inst._get('onClose');\r
+                       if (onClose) {\r
+                               onClose.apply((inst._input ? inst._input[0] : null),\r
+                                       [inst._getDate(), inst]);  // trigger custom callback\r
+                       }\r
+                       this._datepickerShowing = false;\r
+                       this._lastInput = null;\r
+                       inst._settings.prompt = null;\r
+                       if (this._inDialog) {\r
+                               this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });\r
+                               if ($.blockUI) {\r
+                                       $.unblockUI();\r
+                                       $('body').append(this._datepickerDiv);\r
+                               }\r
+                       }\r
+                       this._inDialog = false;\r
+               }\r
+               this._curInst = null;\r
+       },\r
+\r
+       /* Tidy up after a dialog display. */\r
+       _tidyDialog: function(inst) {\r
+               inst._datepickerDiv.removeClass('datepicker_dialog').unbind('.datepicker');\r
+               $('.datepicker_prompt', inst._datepickerDiv).remove();\r
+       },\r
+\r
+       /* Close date picker if clicked elsewhere. */\r
+       _checkExternalClick: function(event) {\r
+               if (!$.datepicker._curInst)\r
+                       return;\r
+               var $target = $(event.target);\r
+               if (($target.parents("#datepicker_div").length == 0) &&\r
+                               !$target.hasClass('hasDatepicker') &&\r
+                               !$target.hasClass('datepicker_trigger') &&\r
+                               $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI)) {\r
+                       $.datepicker._hideDatepicker(null, '');\r
+               }\r
+       },\r
+\r
+       /* Adjust one of the date sub-fields. */\r
+       _adjustDate: function(id, offset, period) {\r
+               var inst = this._getInst(id);\r
+               inst._adjustDate(offset, period);\r
+               this._updateDatepicker(inst);\r
+       },\r
+\r
+       /* Action for current link. */\r
+       _gotoToday: function(id) {\r
+               var date = new Date();\r
+               var inst = this._getInst(id);\r
+               inst._selectedDay = date.getDate();\r
+               inst._drawMonth = inst._selectedMonth = date.getMonth();\r
+               inst._drawYear = inst._selectedYear = date.getFullYear();\r
+               this._adjustDate(inst);\r
+       },\r
+\r
+       /* Action for selecting a new month/year. */\r
+       _selectMonthYear: function(id, select, period) {\r
+               var inst = this._getInst(id);\r
+               inst._selectingMonthYear = false;\r
+               inst[period == 'M' ? '_drawMonth' : '_drawYear'] =\r
+                       select.options[select.selectedIndex].value - 0;\r
+               this._adjustDate(inst);\r
+       },\r
+\r
+       /* Restore input focus after not changing month/year. */\r
+       _clickMonthYear: function(id) {\r
+               var inst = this._getInst(id);\r
+               if (inst._input && inst._selectingMonthYear && !$.browser.msie)\r
+                       inst._input[0].focus();\r
+               inst._selectingMonthYear = !inst._selectingMonthYear;\r
+       },\r
+\r
+       /* Action for changing the first week day. */\r
+       _changeFirstDay: function(id, day) {\r
+               var inst = this._getInst(id);\r
+               inst._settings.firstDay = day;\r
+               this._updateDatepicker(inst);\r
+       },\r
+\r
+       /* Action for selecting a day. */\r
+       _selectDay: function(id, month, year, td) {\r
+               if ($(td).is('.datepicker_unselectable'))\r
+                       return;\r
+               var inst = this._getInst(id);\r
+               var rangeSelect = inst._get('rangeSelect');\r
+               if (rangeSelect) {\r
+                       if (!this._stayOpen) {\r
+                               $('.datepicker td').removeClass('datepicker_currentDay');\r
+                               $(td).addClass('datepicker_currentDay');\r
+                       } \r
+                       this._stayOpen = !this._stayOpen;\r
+               }\r
+               inst._selectedDay = inst._currentDay = $('a', td).html();\r
+               inst._selectedMonth = inst._currentMonth = month;\r
+               inst._selectedYear = inst._currentYear = year;\r
+               this._selectDate(id, inst._formatDate(\r
+                       inst._currentDay, inst._currentMonth, inst._currentYear));\r
+               if (this._stayOpen) {\r
+                       inst._endDay = inst._endMonth = inst._endYear = null;\r
+                       inst._rangeStart = new Date(inst._currentYear, inst._currentMonth, inst._currentDay);\r
+                       this._updateDatepicker(inst);\r
+               }\r
+               else if (rangeSelect) {\r
+                       inst._endDay = inst._currentDay;\r
+                       inst._endMonth = inst._currentMonth;\r
+                       inst._endYear = inst._currentYear;\r
+                       inst._selectedDay = inst._currentDay = inst._rangeStart.getDate();\r
+                       inst._selectedMonth = inst._currentMonth = inst._rangeStart.getMonth();\r
+                       inst._selectedYear = inst._currentYear = inst._rangeStart.getFullYear();\r
+                       inst._rangeStart = null;\r
+                       if (inst._inline)\r
+                               this._updateDatepicker(inst);\r
+               }\r
+       },\r
+\r
+       /* Erase the input field and hide the date picker. */\r
+       _clearDate: function(id) {\r
+               var inst = this._getInst(id);\r
+               if (inst._get('mandatory'))\r
+                       return;\r
+               this._stayOpen = false;\r
+               inst._endDay = inst._endMonth = inst._endYear = inst._rangeStart = null;\r
+               this._selectDate(inst, '');\r
+       },\r
+\r
+       /* Update the input field with the selected date. */\r
+       _selectDate: function(id, dateStr) {\r
+               var inst = this._getInst(id);\r
+               dateStr = (dateStr != null ? dateStr : inst._formatDate());\r
+               if (inst._rangeStart)\r
+                       dateStr = inst._formatDate(inst._rangeStart) + inst._get('rangeSeparator') + dateStr;\r
+               if (inst._input)\r
+                       inst._input.val(dateStr);\r
+               var onSelect = inst._get('onSelect');\r
+               if (onSelect)\r
+                       onSelect.apply((inst._input ? inst._input[0] : null), [dateStr, inst]);  // trigger custom callback\r
+               else if (inst._input)\r
+                       inst._input.trigger('change'); // fire the change event\r
+               if (inst._inline)\r
+                       this._updateDatepicker(inst);\r
+               else if (!this._stayOpen) {\r
+                       this._hideDatepicker(null, inst._get('speed'));\r
+                       this._lastInput = inst._input[0];\r
+                       if (typeof(inst._input[0]) != 'object')\r
+                               inst._input[0].focus(); // restore focus\r
+                       this._lastInput = null;\r
+               }\r
+       },\r
+\r
+       /* Set as beforeShowDay function to prevent selection of weekends.\r
+          @param  date  Date - the date to customise\r
+          @return [boolean, string] - is this date selectable?, what is its CSS class? */\r
+       noWeekends: function(date) {\r
+               var day = date.getDay();\r
+               return [(day > 0 && day < 6), ''];\r
+       },\r
+       \r
+       /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.\r
+          @param  date  Date - the date to get the week for\r
+          @return  number - the number of the week within the year that contains this date */\r
+       iso8601Week: function(date) {\r
+               var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), (date.getTimezoneOffset() / -60));\r
+               var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4); // First week always contains 4 Jan\r
+               var firstDay = firstMon.getDay() || 7; // Day of week: Mon = 1, ..., Sun = 7\r
+               firstMon.setDate(firstMon.getDate() + 1 - firstDay); // Preceding Monday\r
+               if (firstDay < 4 && checkDate < firstMon) { // Adjust first three days in year if necessary\r
+                       checkDate.setDate(checkDate.getDate() - 3); // Generate for previous year\r
+                       return $.datepicker.iso8601Week(checkDate);\r
+               } else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { // Check last three days in year\r
+                       firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7;\r
+                       if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) { // Adjust if necessary\r
+                               checkDate.setDate(checkDate.getDate() + 3); // Generate for next year\r
+                               return $.datepicker.iso8601Week(checkDate);\r
+                       }\r
+               }\r
+               return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date\r
+       },\r
+       \r
+       /* Provide status text for a particular date.\r
+          @param  date  the date to get the status for\r
+          @param  inst  the current datepicker instance\r
+          @return  the status display text for this date */\r
+       dateStatus: function(date, inst) {\r
+               return $.datepicker.formatDate(inst._get('dateStatus'), date, inst._getFormatConfig());\r
+       },\r
+\r
+       /* Parse a string value into a date object.\r
+          The format can be combinations of the following:\r
+          d  - day of month (no leading zero)\r
+          dd - day of month (two digit)\r
+          D  - day name short\r
+          DD - day name long\r
+          m  - month of year (no leading zero)\r
+          mm - month of year (two digit)\r
+          M  - month name short\r
+          MM - month name long\r
+          y  - year (two digit)\r
+          yy - year (four digit)\r
+          '...' - literal text\r
+          '' - single quote\r
+\r
+          @param  format           String - the expected format of the date\r
+          @param  value            String - the date in the above format\r
+          @param  settings  Object - attributes include:\r
+                            shortYearCutoff  Number - the cutoff year for determining the century (optional)\r
+                            dayNamesShort    String[7] - abbreviated names of the days from Sunday (optional)\r
+                            dayNames         String[7] - names of the days from Sunday (optional)\r
+                            monthNamesShort  String[12] - abbreviated names of the months (optional)\r
+                            monthNames       String[12] - names of the months (optional)\r
+          @return  Date - the extracted date value or null if value is blank */\r
+       parseDate: function (format, value, settings) {\r
+               if (format == null || value == null)\r
+                       throw 'Invalid arguments';\r
+               value = (typeof value == 'object' ? value.toString() : value + '');\r
+               if (value == '')\r
+                       return null;\r
+               var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;\r
+               var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;\r
+               var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;\r
+               var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;\r
+               var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;\r
+               var year = -1;\r
+               var month = -1;\r
+               var day = -1;\r
+               var literal = false;\r
+               // Check whether a format character is doubled\r
+               var lookAhead = function(match) {\r
+                       var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);\r
+                       if (matches)\r
+                               iFormat++;\r
+                       return matches; \r
+               };\r
+               // Extract a number from the string value\r
+               var getNumber = function(match) {\r
+                       lookAhead(match);\r
+                       var size = (match == 'y' ? 4 : 2);\r
+                       var num = 0;\r
+                       while (size > 0 && iValue < value.length &&\r
+                                       value.charAt(iValue) >= '0' && value.charAt(iValue) <= '9') {\r
+                               num = num * 10 + (value.charAt(iValue++) - 0);\r
+                               size--;\r
+                       }\r
+                       if (size == (match == 'y' ? 4 : 2))\r
+                               throw 'Missing number at position ' + iValue;\r
+                       return num;\r
+               };\r
+               // Extract a name from the string value and convert to an index\r
+               var getName = function(match, shortNames, longNames) {\r
+                       var names = (lookAhead(match) ? longNames : shortNames);\r
+                       var size = 0;\r
+                       for (var j = 0; j < names.length; j++)\r
+                               size = Math.max(size, names[j].length);\r
+                       var name = '';\r
+                       var iInit = iValue;\r
+                       while (size > 0 && iValue < value.length) {\r
+                               name += value.charAt(iValue++);\r
+                               for (var i = 0; i < names.length; i++)\r
+                                       if (name == names[i])\r
+                                               return i + 1;\r
+                               size--;\r
+                       }\r
+                       throw 'Unknown name at position ' + iInit;\r
+               };\r
+               // Confirm that a literal character matches the string value\r
+               var checkLiteral = function() {\r
+                       if (value.charAt(iValue) != format.charAt(iFormat))\r
+                               throw 'Unexpected literal at position ' + iValue;\r
+                       iValue++;\r
+               };\r
+               var iValue = 0;\r
+               for (var iFormat = 0; iFormat < format.length; iFormat++) {\r
+                       if (literal)\r
+                               if (format.charAt(iFormat) == "'" && !lookAhead("'"))\r
+                                       literal = false;\r
+                               else\r
+                                       checkLiteral();\r
+                       else\r
+                               switch (format.charAt(iFormat)) {\r
+                                       case 'd':\r
+                                               day = getNumber('d');\r
+                                               break;\r
+                                       case 'D': \r
+                                               getName('D', dayNamesShort, dayNames);\r
+                                               break;\r
+                                       case 'm': \r
+                                               month = getNumber('m');\r
+                                               break;\r
+                                       case 'M':\r
+                                               month = getName('M', monthNamesShort, monthNames); \r
+                                               break;\r
+                                       case 'y':\r
+                                               year = getNumber('y');\r
+                                               break;\r
+                                       case "'":\r
+                                               if (lookAhead("'"))\r
+                                                       checkLiteral();\r
+                                               else\r
+                                                       literal = true;\r
+                                               break;\r
+                                       default:\r
+                                               checkLiteral();\r
+                               }\r
+               }\r
+               if (year < 100) {\r
+                       year += new Date().getFullYear() - new Date().getFullYear() % 100 +\r
+                               (year <= shortYearCutoff ? 0 : -100);\r
+               }\r
+               var date = new Date(year, month - 1, day);\r
+               if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) {\r
+                       throw 'Invalid date'; // E.g. 31/02/*\r
+               }\r
+               return date;\r
+       },\r
+\r
+       /* Format a date object into a string value.\r
+          The format can be combinations of the following:\r
+          d  - day of month (no leading zero)\r
+          dd - day of month (two digit)\r
+          D  - day name short\r
+          DD - day name long\r
+          m  - month of year (no leading zero)\r
+          mm - month of year (two digit)\r
+          M  - month name short\r
+          MM - month name long\r
+          y  - year (two digit)\r
+          yy - year (four digit)\r
+          '...' - literal text\r
+          '' - single quote\r
+\r
+          @param  format    String - the desired format of the date\r
+          @param  date      Date - the date value to format\r
+          @param  settings  Object - attributes include:\r
+                            dayNamesShort    String[7] - abbreviated names of the days from Sunday (optional)\r
+                            dayNames         String[7] - names of the days from Sunday (optional)\r
+                            monthNamesShort  String[12] - abbreviated names of the months (optional)\r
+                            monthNames       String[12] - names of the months (optional)\r
+          @return  String - the date in the above format */\r
+       formatDate: function (format, date, settings) {\r
+               if (!date)\r
+                       return '';\r
+               var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;\r
+               var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;\r
+               var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;\r
+               var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;\r
+               // Check whether a format character is doubled\r
+               var lookAhead = function(match) {\r
+                       var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);\r
+                       if (matches)\r
+                               iFormat++;\r
+                       return matches; \r
+               };\r
+               // Format a number, with leading zero if necessary\r
+               var formatNumber = function(match, value) {\r
+                       return (lookAhead(match) && value < 10 ? '0' : '') + value;\r
+               };\r
+               // Format a name, short or long as requested\r
+               var formatName = function(match, value, shortNames, longNames) {\r
+                       return (lookAhead(match) ? longNames[value] : shortNames[value]);\r
+               };\r
+               var output = '';\r
+               var literal = false;\r
+               if (date) {\r
+                       for (var iFormat = 0; iFormat < format.length; iFormat++) {\r
+                               if (literal)\r
+                                       if (format.charAt(iFormat) == "'" && !lookAhead("'"))\r
+                                               literal = false;\r
+                                       else\r
+                                               output += format.charAt(iFormat);\r
+                               else\r
+                                       switch (format.charAt(iFormat)) {\r
+                                               case 'd':\r
+                                                       output += formatNumber('d', date.getDate()); \r
+                                                       break;\r
+                                               case 'D': \r
+                                                       output += formatName('D', date.getDay(), dayNamesShort, dayNames);\r
+                                                       break;\r
+                                               case 'm': \r
+                                                       output += formatNumber('m', date.getMonth() + 1); \r
+                                                       break;\r
+                                               case 'M':\r
+                                                       output += formatName('M', date.getMonth(), monthNamesShort, monthNames); \r
+                                                       break;\r
+                                               case 'y':\r
+                                                       output += (lookAhead('y') ? date.getFullYear() : \r
+                                                               (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);\r
+                                                       break;\r
+                                               case "'":\r
+                                                       if (lookAhead("'"))\r
+                                                               output += "'";\r
+                                                       else\r
+                                                               literal = true;\r
+                                                       break;\r
+                                               default:\r
+                                                       output += format.charAt(iFormat);\r
+                                       }\r
+                       }\r
+               }\r
+               return output;\r
+       },\r
+\r
+       /* Extract all possible characters from the date format. */\r
+       _possibleChars: function (format) {\r
+               var chars = '';\r
+               var literal = false;\r
+               for (var iFormat = 0; iFormat < format.length; iFormat++)\r
+                       if (literal)\r
+                               if (format.charAt(iFormat) == "'" && !lookAhead("'"))\r
+                                       literal = false;\r
+                               else\r
+                                       chars += format.charAt(iFormat);\r
+                       else\r
+                               switch (format.charAt(iFormat)) {\r
+                                       case 'd' || 'm' || 'y':\r
+                                               chars += '0123456789'; \r
+                                               break;\r
+                                       case 'D' || 'M':\r
+                                               return null; // Accept anything\r
+                                       case "'":\r
+                                               if (lookAhead("'"))\r
+                                                       chars += "'";\r
+                                               else\r
+                                                       literal = true;\r
+                                               break;\r
+                                       default:\r
+                                               chars += format.charAt(iFormat);\r
+                               }\r
+               return chars;\r
+       }\r
+});\r
+\r
+/* Individualised settings for date picker functionality applied to one or more related inputs.\r
+   Instances are managed and manipulated through the Datepicker manager. */\r
+function DatepickerInstance(settings, inline) {\r
+       this._id = $.datepicker._register(this);\r
+       this._selectedDay = 0; // Current date for selection\r
+       this._selectedMonth = 0; // 0-11\r
+       this._selectedYear = 0; // 4-digit year\r
+       this._drawMonth = 0; // Current month at start of datepicker\r
+       this._drawYear = 0;\r
+       this._input = null; // The attached input field\r
+       this._inline = inline; // True if showing inline, false if used in a popup\r
+       this._datepickerDiv = (!inline ? $.datepicker._datepickerDiv :\r
+               $('<div id="datepicker_div_' + this._id + '" class="datepicker_inline">'));\r
+       // customise the date picker object - uses manager defaults if not overridden\r
+       this._settings = extendRemove(settings || {}); // clone\r
+       if (inline)\r
+               this._setDate(this._getDefaultDate());\r
+}\r
+\r
+$.extend(DatepickerInstance.prototype, {\r
+       /* Get a setting value, defaulting if necessary. */\r
+       _get: function(name) {\r
+               return this._settings[name] !== undefined ? this._settings[name] : $.datepicker._defaults[name];\r
+       },\r
+\r
+       /* Parse existing date and initialise date picker. */\r
+       _setDateFromField: function(input) {\r
+               this._input = $(input);\r
+               var dateFormat = this._get('dateFormat');\r
+               var dates = this._input ? this._input.val().split(this._get('rangeSeparator')) : null; \r
+               this._endDay = this._endMonth = this._endYear = null;\r
+               var date = defaultDate = this._getDefaultDate();\r
+               if (dates.length > 0) {\r
+                       var settings = this._getFormatConfig();\r
+                       if (dates.length > 1) {\r
+                               date = $.datepicker.parseDate(dateFormat, dates[1], settings) || defaultDate;\r
+                               this._endDay = date.getDate();\r
+                               this._endMonth = date.getMonth();\r
+                               this._endYear = date.getFullYear();\r
+                       }\r
+                       try {\r
+                               date = $.datepicker.parseDate(dateFormat, dates[0], settings) || defaultDate;\r
+                       } catch (e) {\r
+                               $.datepicker.log(e);\r
+                               date = defaultDate;\r
+                       }\r
+               }\r
+               this._selectedDay = date.getDate();\r
+               this._drawMonth = this._selectedMonth = date.getMonth();\r
+               this._drawYear = this._selectedYear = date.getFullYear();\r
+               this._currentDay = (dates[0] ? date.getDate() : 0);\r
+               this._currentMonth = (dates[0] ? date.getMonth() : 0);\r
+               this._currentYear = (dates[0] ? date.getFullYear() : 0);\r
+               this._adjustDate();\r
+       },\r
+       \r
+       /* Retrieve the default date shown on opening. */\r
+       _getDefaultDate: function() {\r
+               var date = this._determineDate('defaultDate', new Date());\r
+               var minDate = this._getMinMaxDate('min', true);\r
+               var maxDate = this._getMinMaxDate('max');\r
+               date = (minDate && date < minDate ? minDate : date);\r
+               date = (maxDate && date > maxDate ? maxDate : date);\r
+               return date;\r
+       },\r
+\r
+       /* A date may be specified as an exact value or a relative one. */\r
+       _determineDate: function(name, defaultDate) {\r
+               var offsetNumeric = function(offset) {\r
+                       var date = new Date();\r
+                       date.setDate(date.getDate() + offset);\r
+                       return date;\r
+               };\r
+               var offsetString = function(offset, getDaysInMonth) {\r
+                       var date = new Date();\r
+                       var matches = /^([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?$/.exec(offset);\r
+                       if (matches) {\r
+                               var year = date.getFullYear();\r
+                               var month = date.getMonth();\r
+                               var day = date.getDate();\r
+                               switch (matches[2] || 'd') {\r
+                                       case 'd' : case 'D' :\r
+                                               day += (matches[1] - 0); break;\r
+                                       case 'w' : case 'W' :\r
+                                               day += (matches[1] * 7); break;\r
+                                       case 'm' : case 'M' :\r
+                                               month += (matches[1] - 0); \r
+                                               day = Math.min(day, getDaysInMonth(year, month));\r
+                                               break;\r
+                                       case 'y': case 'Y' :\r
+                                               year += (matches[1] - 0);\r
+                                               day = Math.min(day, getDaysInMonth(year, month));\r
+                                               break;\r
+                               }\r
+                               date = new Date(year, month, day);\r
+                       }\r
+                       return date;\r
+               };\r
+               var date = this._get(name);\r
+               return (date == null ? defaultDate :\r
+                       (typeof date == 'string' ? offsetString(date, this._getDaysInMonth) :\r
+                       (typeof date == 'number' ? offsetNumeric(date) : date)));\r
+       },\r
+\r
+       /* Set the date(s) directly. */\r
+       _setDate: function(date, endDate) {\r
+               this._selectedDay = this._currentDay = date.getDate();\r
+               this._drawMonth = this._selectedMonth = this._currentMonth = date.getMonth();\r
+               this._drawYear = this._selectedYear = this._currentYear = date.getFullYear();\r
+               if (this._get('rangeSelect')) {\r
+                       if (endDate) {\r
+                               this._endDay = endDate.getDate();\r
+                               this._endMonth = endDate.getMonth();\r
+                               this._endYear = endDate.getFullYear();\r
+                       } else {\r
+                               this._endDay = this._currentDay;\r
+                               this._endMonth = this._currentMonth;\r
+                               this._endYear = this._currentYear;\r
+                       }\r
+               }\r
+               this._adjustDate();\r
+       },\r
+\r
+       /* Retrieve the date(s) directly. */\r
+       _getDate: function() {\r
+               var startDate = (!this._currentYear || (this._input && this._input.val() == '') ? null :\r
+                       new Date(this._currentYear, this._currentMonth, this._currentDay));\r
+               if (this._get('rangeSelect')) {\r
+                       return [startDate, (!this._endYear ? null :\r
+                               new Date(this._endYear, this._endMonth, this._endDay))];\r
+               } else\r
+                       return startDate;\r
+       },\r
+\r
+       /* Generate the HTML for the current state of the date picker. */\r
+       _generateDatepicker: function() {\r
+               var today = new Date();\r
+               today = new Date(today.getFullYear(), today.getMonth(), today.getDate()); // clear time\r
+               var showStatus = this._get('showStatus');\r
+               var isRTL = this._get('isRTL');\r
+               // build the date picker HTML\r
+               var clear = (this._get('mandatory') ? '' :\r
+                       '<div class="datepicker_clear"><a onclick="jQuery.datepicker._clearDate(' + this._id + ');"' + \r
+                       (showStatus ? this._addStatus(this._get('clearStatus') || '&#xa0;') : '') + '>' +\r
+                       this._get('clearText') + '</a></div>');\r
+               var controls = '<div class="datepicker_control">' + (isRTL ? '' : clear) +\r
+                       '<div class="datepicker_close"><a onclick="jQuery.datepicker._hideDatepicker();"' +\r
+                       (showStatus ? this._addStatus(this._get('closeStatus') || '&#xa0;') : '') + '>' +\r
+                       this._get('closeText') + '</a></div>' + (isRTL ? clear : '')  + '</div>';\r
+               var prompt = this._get('prompt');\r
+               var closeAtTop = this._get('closeAtTop');\r
+               var hideIfNoPrevNext = this._get('hideIfNoPrevNext');\r
+               var numMonths = this._getNumberOfMonths();\r
+               var stepMonths = this._get('stepMonths');\r
+               var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);\r
+               var minDate = this._getMinMaxDate('min', true);\r
+               var maxDate = this._getMinMaxDate('max');\r
+               var drawMonth = this._drawMonth;\r
+               var drawYear = this._drawYear;\r
+               if (maxDate) {\r
+                       var maxDraw = new Date(maxDate.getFullYear(),\r
+                               maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate());\r
+                       maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);\r
+                       while (new Date(drawYear, drawMonth, 1) > maxDraw) {\r
+                               drawMonth--;\r
+                               if (drawMonth < 0) {\r
+                                       drawMonth = 11;\r
+                                       drawYear--;\r
+                               }\r
+                       }\r
+               }\r
+               // controls and links\r
+               var prev = '<div class="datepicker_prev">' + (this._canAdjustMonth(-1, drawYear, drawMonth) ? \r
+                       '<a onclick="jQuery.datepicker._adjustDate(' + this._id + ', -' + stepMonths + ', \'M\');"' +\r
+                       (showStatus ? this._addStatus(this._get('prevStatus') || '&#xa0;') : '') + '>' +\r
+                       this._get('prevText') + '</a>' :\r
+                       (hideIfNoPrevNext ? '' : '<label>' + this._get('prevText') + '</label>')) + '</div>';\r
+               var next = '<div class="datepicker_next">' + (this._canAdjustMonth(+1, drawYear, drawMonth) ?\r
+                       '<a onclick="jQuery.datepicker._adjustDate(' + this._id + ', +' + stepMonths + ', \'M\');"' +\r
+                       (showStatus ? this._addStatus(this._get('nextStatus') || '&#xa0;') : '') + '>' +\r
+                       this._get('nextText') + '</a>' :\r
+                       (hideIfNoPrevNext ? '>' : '<label>' + this._get('nextText') + '</label>')) + '</div>';\r
+               var html = (prompt ? '<div class="datepicker_prompt">' + prompt + '</div>' : '') +\r
+                       (closeAtTop && !this._inline ? controls : '') +\r
+                       '<div class="datepicker_links">' + (isRTL ? next : prev) +\r
+                       (this._isInRange(today) ? '<div class="datepicker_current">' +\r
+                       '<a onclick="jQuery.datepicker._gotoToday(' + this._id + ');"' +\r
+                       (showStatus ? this._addStatus(this._get('currentStatus') || '&#xa0;') : '') + '>' +\r
+                       this._get('currentText') + '</a></div>' : '') + (isRTL ? prev : next) + '</div>';\r
+               var showWeeks = this._get('showWeeks');\r
+               for (var row = 0; row < numMonths[0]; row++)\r
+                       for (var col = 0; col < numMonths[1]; col++) {\r
+                               var selectedDate = new Date(drawYear, drawMonth, this._selectedDay);\r
+                               html += '<div class="datepicker_oneMonth' + (col == 0 ? ' datepicker_newRow' : '') + '">' +\r
+                                       this._generateMonthYearHeader(drawMonth, drawYear, minDate, maxDate,\r
+                                       selectedDate, row > 0 || col > 0) + // draw month headers\r
+                                       '<table class="datepicker" cellpadding="0" cellspacing="0"><thead>' + \r
+                                       '<tr class="datepicker_titleRow">' +\r
+                                       (showWeeks ? '<td>' + this._get('weekHeader') + '</td>' : '');\r
+                               var firstDay = this._get('firstDay');\r
+                               var changeFirstDay = this._get('changeFirstDay');\r
+                               var dayNames = this._get('dayNames');\r
+                               var dayNamesShort = this._get('dayNamesShort');\r
+                               var dayNamesMin = this._get('dayNamesMin');\r
+                               for (var dow = 0; dow < 7; dow++) { // days of the week\r
+                                       var day = (dow + firstDay) % 7;\r
+                                       var status = this._get('dayStatus') || '&#xa0;';\r
+                                       status = (status.indexOf('DD') > -1 ? status.replace(/DD/, dayNames[day]) :\r
+                                               status.replace(/D/, dayNamesShort[day]));\r
+                                       html += '<td' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="datepicker_weekEndCell"' : '') + '>' +\r
+                                               (!changeFirstDay ? '<span' :\r
+                                               '<a onclick="jQuery.datepicker._changeFirstDay(' + this._id + ', ' + day + ');"') + \r
+                                               (showStatus ? this._addStatus(status) : '') + ' title="' + dayNames[day] + '">' +\r
+                                               dayNamesMin[day] + (changeFirstDay ? '</a>' : '</span>') + '</td>';\r
+                               }\r
+                               html += '</tr></thead><tbody>';\r
+                               var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);\r
+                               if (drawYear == this._selectedYear && drawMonth == this._selectedMonth) {\r
+                                       this._selectedDay = Math.min(this._selectedDay, daysInMonth);\r
+                               }\r
+                               var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;\r
+                               var currentDate = (!this._currentDay ? new Date(9999, 9, 9) :\r
+                                       new Date(this._currentYear, this._currentMonth, this._currentDay));\r
+                               var endDate = this._endDay ? new Date(this._endYear, this._endMonth, this._endDay) : currentDate;\r
+                               var printDate = new Date(drawYear, drawMonth, 1 - leadDays);\r
+                               var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate\r
+                               var beforeShowDay = this._get('beforeShowDay');\r
+                               var showOtherMonths = this._get('showOtherMonths');\r
+                               var calculateWeek = this._get('calculateWeek') || $.datepicker.iso8601Week;\r
+                               var dateStatus = this._get('statusForDate') || $.datepicker.dateStatus;\r
+                               for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows\r
+                                       html += '<tr class="datepicker_daysRow">' +\r
+                                               (showWeeks ? '<td class="datepicker_weekCol">' + calculateWeek(printDate) + '</td>' : '');\r
+                                       for (var dow = 0; dow < 7; dow++) { // create date picker days\r
+                                               var daySettings = (beforeShowDay ?\r
+                                                       beforeShowDay.apply((this._input ? this._input[0] : null), [printDate]) : [true, '']);\r
+                                               var otherMonth = (printDate.getMonth() != drawMonth);\r
+                                               var unselectable = otherMonth || !daySettings[0] ||\r
+                                                       (minDate && printDate < minDate) || (maxDate && printDate > maxDate);\r
+                                               html += '<td class="datepicker_daysCell' +\r
+                                                       ((dow + firstDay + 6) % 7 >= 5 ? ' datepicker_weekEndCell' : '') + // highlight weekends\r
+                                                       (otherMonth ? ' datepicker_otherMonth' : '') + // highlight days from other months\r
+                                                       (printDate.getTime() == selectedDate.getTime() && drawMonth == this._selectedMonth ?\r
+                                                       ' datepicker_daysCellOver' : '') + // highlight selected day\r
+                                                       (unselectable ? ' datepicker_unselectable' : '') +  // highlight unselectable days\r
+                                                       (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates\r
+                                                       (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ?  // in current range\r
+                                                       ' datepicker_currentDay' : '') + // highlight selected day\r
+                                                       (printDate.getTime() == today.getTime() ? ' datepicker_today' : '')) + '"' + // highlight today (if different)\r
+                                                       (unselectable ? '' : ' onmouseover="jQuery(this).addClass(\'datepicker_daysCellOver\');' +\r
+                                                       (!showStatus || (otherMonth && !showOtherMonths) ? '' : 'jQuery(\'#datepicker_status_' +\r
+                                                       this._id + '\').html(\'' + (dateStatus.apply((this._input ? this._input[0] : null),\r
+                                                       [printDate, this]) || '&#xa0;') +'\');') + '"' +\r
+                                                       ' onmouseout="jQuery(this).removeClass(\'datepicker_daysCellOver\');' +\r
+                                                       (!showStatus || (otherMonth && !showOtherMonths) ? '' : 'jQuery(\'#datepicker_status_' +\r
+                                                       this._id + '\').html(\'&#xa0;\');') + '" onclick="jQuery.datepicker._selectDay(' +\r
+                                                       this._id + ',' + drawMonth + ',' + drawYear + ', this);"') + '>' + // actions\r
+                                                       (otherMonth ? (showOtherMonths ? printDate.getDate() : '&#xa0;') : // display for other months\r
+                                                       (unselectable ? printDate.getDate() : '<a>' + printDate.getDate() + '</a>')) + '</td>'; // display for this month\r
+                                               printDate.setDate(printDate.getDate() + 1);\r
+                                       }\r
+                                       html += '</tr>';\r
+                               }\r
+                               drawMonth++;\r
+                               if (drawMonth > 11) {\r
+                                       drawMonth = 0;\r
+                                       drawYear++;\r
+                               }\r
+                               html += '</tbody></table></div>';\r
+                       }\r
+               html += (showStatus ? '<div style="clear: both;"></div><div id="datepicker_status_' + this._id + \r
+                       '" class="datepicker_status">' + (this._get('initStatus') || '&#xa0;') + '</div>' : '') +\r
+                       (!closeAtTop && !this._inline ? controls : '') +\r
+                       '<div style="clear: both;"></div>' + \r
+                       ($.browser.msie && parseInt($.browser.version) < 7 && !this._inline ? \r
+                       '<iframe src="javascript:false;" class="datepicker_cover"></iframe>' : '');\r
+               return html;\r
+       },\r
+       \r
+       /* Generate the month and year header. */\r
+       _generateMonthYearHeader: function(drawMonth, drawYear, minDate, maxDate, selectedDate, secondary) {\r
+               minDate = (this._rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate);\r
+               var showStatus = this._get('showStatus');\r
+               var html = '<div class="datepicker_header">';\r
+               // month selection\r
+               var monthNames = this._get('monthNames');\r
+               if (secondary || !this._get('changeMonth'))\r
+                       html += monthNames[drawMonth] + '&#xa0;';\r
+                       \r
+               else {\r
+                       var inMinYear = (minDate && minDate.getFullYear() == drawYear);\r
+                       var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);\r
+                       html += '<select class="datepicker_newMonth" ' +\r
+                               'onchange="jQuery.datepicker._selectMonthYear(' + this._id + ', this, \'M\');" ' +\r
+                               'onclick="jQuery.datepicker._clickMonthYear(' + this._id + ');"' +\r
+                               (showStatus ? this._addStatus(this._get('monthStatus') || '&#xa0;') : '') + '>';\r
+                       for (var month = 0; month < 12; month++) {\r
+                               if ((!inMinYear || month >= minDate.getMonth()) &&\r
+                                               (!inMaxYear || month <= maxDate.getMonth())) {\r
+                                       html += '<option value="' + month + '"' +\r
+                                               (month == drawMonth ? ' selected="selected"' : '') +\r
+                                               '>' + monthNames[month] + '</option>';\r
+                               }\r
+                       }\r
+                       html += '</select>';\r
+               }\r
+               // year selection\r
+               if (secondary || !this._get('changeYear'))\r
+                       html += drawYear;\r
+               else {\r
+                       // determine range of years to display\r
+                       var years = this._get('yearRange').split(':');\r
+                       var year = 0;\r
+                       var endYear = 0;\r
+                       if (years.length != 2) {\r
+                               year = drawYear - 10;\r
+                               endYear = drawYear + 10;\r
+                       } else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') {\r
+                               year = drawYear + parseInt(years[0], 10);\r
+                               endYear = drawYear + parseInt(years[1], 10);\r
+                       } else {\r
+                               year = parseInt(years[0], 10);\r
+                               endYear = parseInt(years[1], 10);\r
+                       }\r
+                       year = (minDate ? Math.max(year, minDate.getFullYear()) : year);\r
+                       endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);\r
+                       html += '<select class="datepicker_newYear" ' +\r
+                               'onchange="jQuery.datepicker._selectMonthYear(' + this._id + ', this, \'Y\');" ' +\r
+                               'onclick="jQuery.datepicker._clickMonthYear(' + this._id + ');"' +\r
+                               (showStatus ? this._addStatus(this._get('yearStatus') || '&#xa0;') : '') + '>';\r
+                       for (; year <= endYear; year++) {\r
+                               html += '<option value="' + year + '"' +\r
+                                       (year == drawYear ? ' selected="selected"' : '') +\r
+                                       '>' + year + '</option>';\r
+                       }\r
+                       html += '</select>';\r
+               }\r
+               html += '</div>'; // Close datepicker_header\r
+               return html;\r
+       },\r
+\r
+       /* Provide code to set and clear the status panel. */\r
+       _addStatus: function(text) {\r
+               return ' onmouseover="jQuery(\'#datepicker_status_' + this._id + '\').html(\'' + text + '\');" ' +\r
+                       'onmouseout="jQuery(\'#datepicker_status_' + this._id + '\').html(\'&#xa0;\');"';\r
+       },\r
+\r
+       /* Adjust one of the date sub-fields. */\r
+       _adjustDate: function(offset, period) {\r
+               var year = this._drawYear + (period == 'Y' ? offset : 0);\r
+               var month = this._drawMonth + (period == 'M' ? offset : 0);\r
+               var day = Math.min(this._selectedDay, this._getDaysInMonth(year, month)) +\r
+                       (period == 'D' ? offset : 0);\r
+               var date = new Date(year, month, day);\r
+               // ensure it is within the bounds set\r
+               var minDate = this._getMinMaxDate('min', true);\r
+               var maxDate = this._getMinMaxDate('max');\r
+               date = (minDate && date < minDate ? minDate : date);\r
+               date = (maxDate && date > maxDate ? maxDate : date);\r
+               this._selectedDay = date.getDate();\r
+               this._drawMonth = this._selectedMonth = date.getMonth();\r
+               this._drawYear = this._selectedYear = date.getFullYear();\r
+       },\r
+       \r
+       /* Determine the number of months to show. */\r
+       _getNumberOfMonths: function() {\r
+               var numMonths = this._get('numberOfMonths');\r
+               return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));\r
+       },\r
+\r
+       /* Determine the current maximum date - ensure no time components are set - may be overridden for a range. */\r
+       _getMinMaxDate: function(minMax, checkRange) {\r
+               var date = this._determineDate(minMax + 'Date', null);\r
+               if (date) {\r
+                       date.setHours(0);\r
+                       date.setMinutes(0);\r
+                       date.setSeconds(0);\r
+                       date.setMilliseconds(0);\r
+               }\r
+               return date || (checkRange ? this._rangeStart : null);\r
+       },\r
+\r
+       /* Find the number of days in a given month. */\r
+       _getDaysInMonth: function(year, month) {\r
+               return 32 - new Date(year, month, 32).getDate();\r
+       },\r
+\r
+       /* Find the day of the week of the first of a month. */\r
+       _getFirstDayOfMonth: function(year, month) {\r
+               return new Date(year, month, 1).getDay();\r
+       },\r
+\r
+       /* Determines if we should allow a "next/prev" month display change. */\r
+       _canAdjustMonth: function(offset, curYear, curMonth) {\r
+               var numMonths = this._getNumberOfMonths();\r
+               var date = new Date(curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1);\r
+               if (offset < 0)\r
+                       date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));\r
+               return this._isInRange(date);\r
+       },\r
+\r
+       /* Is the given date in the accepted range? */\r
+       _isInRange: function(date) {\r
+               // during range selection, use minimum of selected date and range start\r
+               var newMinDate = (!this._rangeStart ? null :\r
+                       new Date(this._selectedYear, this._selectedMonth, this._selectedDay));\r
+               newMinDate = (newMinDate && this._rangeStart < newMinDate ? this._rangeStart : newMinDate);\r
+               var minDate = newMinDate || this._getMinMaxDate('min');\r
+               var maxDate = this._getMinMaxDate('max');\r
+               return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));\r
+       },\r
+       \r
+       /* Provide the configuration settings for formatting/parsing. */\r
+       _getFormatConfig: function() {\r
+               var shortYearCutoff = this._get('shortYearCutoff');\r
+               shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :\r
+                       new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));\r
+               return {shortYearCutoff: shortYearCutoff,\r
+                       dayNamesShort: this._get('dayNamesShort'), dayNames: this._get('dayNames'),\r
+                       monthNamesShort: this._get('monthNamesShort'), monthNames: this._get('monthNames')};\r
+       },\r
+\r
+       /* Format the given date for display. */\r
+       _formatDate: function(day, month, year) {\r
+               if (!day) {\r
+                       this._currentDay = this._selectedDay;\r
+                       this._currentMonth = this._selectedMonth;\r
+                       this._currentYear = this._selectedYear;\r
+               }\r
+               var date = (day ? (typeof day == 'object' ? day : new Date(year, month, day)) :\r
+                       new Date(this._currentYear, this._currentMonth, this._currentDay));\r
+               return $.datepicker.formatDate(this._get('dateFormat'), date, this._getFormatConfig());\r
+       }\r
+});\r
+\r
+/* jQuery extend now ignores nulls! */\r
+function extendRemove(target, props) {\r
+       $.extend(target, props);\r
+       for (var name in props)\r
+               if (props[name] == null)\r
+                       target[name] = null;\r
+       return target;\r
+};\r
+\r
+/* Invoke the datepicker functionality.\r
+   @param  options  String - a command, optionally followed by additional parameters or\r
+                    Object - settings for attaching new datepicker functionality\r
+   @return  jQuery object */\r
+$.fn.datepicker = function(options){\r
+       var otherArgs = Array.prototype.slice.call(arguments, 1);\r
+       if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate')) {\r
+               return $.datepicker['_' + options + 'Datepicker'].apply($.datepicker, [this[0]].concat(otherArgs));\r
+       }\r
+       return this.each(function() {\r
+               typeof options == 'string' ?\r
+                       $.datepicker['_' + options + 'Datepicker'].apply($.datepicker, [this].concat(otherArgs)) :\r
+                       $.datepicker._attachDatepicker(this, options);\r
+       });\r
+};\r
+\r
+$.datepicker = new Datepicker(); // singleton instance\r
+       \r
+/* Initialise the date picker. */\r
+$(document).ready(function() {\r
+       $(document.body).append($.datepicker._datepickerDiv)\r
+               .mousedown($.datepicker._checkExternalClick);\r
+});\r
+\r
+})(jQuery);
\ No newline at end of file
diff --git a/ui/source/ui.dialog.js b/ui/source/ui.dialog.js
new file mode 100644 (file)
index 0000000..1d37bea
--- /dev/null
@@ -0,0 +1,448 @@
+/*\r
+ * jQuery UI Dialog\r
+ *\r
+ * Copyright (c) 2008 Richard D. Worth (rdworth.org)\r
+ * Dual licensed under the MIT (MIT-LICENSE.txt)\r
+ * and GPL (GPL-LICENSE.txt) licenses.\r
+ * \r
+ * http://docs.jquery.com/UI/Dialog\r
+ *\r
+ * Depends:\r
+ *     ui.core.js\r
+ *     ui.draggable.js\r
+ *     ui.resizable.js\r
+ *\r
+ * Revision: $Id: ui.dialog.js 5608 2008-05-15 14:41:12Z scott.gonzalez $\r
+ */\r
+;(function($) {\r
+       \r
+       var setDataSwitch = {\r
+               dragStart: "start.draggable",\r
+               drag: "drag.draggable",\r
+               dragStop: "stop.draggable",\r
+               maxHeight: "maxHeight.resizable",\r
+               minHeight: "minHeight.resizable",\r
+               maxWidth: "maxWidth.resizable",\r
+               minWidth: "minWidth.resizable",\r
+               resizeStart: "start.resizable",\r
+               resize: "drag.resizable",\r
+               resizeStop: "stop.resizable"\r
+       };\r
+       \r
+       $.widget("ui.dialog", {\r
+               init: function() {\r
+                       var self = this;\r
+                       var options = this.options;\r
+                       \r
+                       var uiDialogContent = this.element.addClass('ui-dialog-content');\r
+                       \r
+                       if (!uiDialogContent.parent().length) {\r
+                               uiDialogContent.appendTo('body');\r
+                       }\r
+                       uiDialogContent\r
+                               .wrap(document.createElement('div'))\r
+                               .wrap(document.createElement('div'));\r
+                       var uiDialogContainer = uiDialogContent.parent().addClass('ui-dialog-container').css({position: 'relative'});\r
+                       var uiDialog = (this.uiDialog = uiDialogContainer.parent()).hide()\r
+                               .addClass('ui-dialog')\r
+                               .css({position: 'absolute', width: options.width, height: options.height, overflow: 'hidden'}); \r
+       \r
+                       var classNames = uiDialogContent.attr('className').split(' ');\r
+       \r
+                       // Add content classes to dialog, to inherit theme at top level of element\r
+                       $.each(classNames, function(i, className) {\r
+                               ((className != 'ui-dialog-content')\r
+                                       && uiDialog.addClass(className));\r
+                       });\r
+       \r
+                       if ($.fn.resizable) {\r
+                               uiDialog.append('<div class="ui-resizable-n ui-resizable-handle"></div>')\r
+                                       .append('<div class="ui-resizable-s ui-resizable-handle"></div>')\r
+                                       .append('<div class="ui-resizable-e ui-resizable-handle"></div>')\r
+                                       .append('<div class="ui-resizable-w ui-resizable-handle"></div>')\r
+                                       .append('<div class="ui-resizable-ne ui-resizable-handle"></div>')\r
+                                       .append('<div class="ui-resizable-se ui-resizable-handle"></div>')\r
+                                       .append('<div class="ui-resizable-sw ui-resizable-handle"></div>')\r
+                                       .append('<div class="ui-resizable-nw ui-resizable-handle"></div>');\r
+                               uiDialog.resizable({\r
+                                       maxWidth: options.maxWidth,\r
+                                       maxHeight: options.maxHeight,\r
+                                       minWidth: options.minWidth,\r
+                                       minHeight: options.minHeight,\r
+                                       start: options.resizeStart,\r
+                                       resize: options.resize,\r
+                                       stop: function(e, ui) {\r
+                                               (options.resizeStop && options.resizeStop.apply(this, arguments));\r
+                                               $.ui.dialog.overlay.resize();\r
+                                       }\r
+                               });\r
+                               (!options.resizable && uiDialog.resizable('disable'));\r
+                       }\r
+       \r
+                       uiDialogContainer.prepend('<div class="ui-dialog-titlebar"></div>');\r
+                       var uiDialogTitlebar = $('.ui-dialog-titlebar', uiDialogContainer);\r
+                       this.uiDialogTitlebar = uiDialogTitlebar;\r
+                       var title = (options.title) ? options.title : (uiDialogContent.attr('title')) ? uiDialogContent.attr('title') : '';\r
+                       uiDialogTitlebar.append('<span class="ui-dialog-title">' + title + '</span>');\r
+                       uiDialogTitlebar.append('<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>');\r
+                       this.uiDialogTitlebarClose = $('.ui-dialog-titlebar-close', uiDialogTitlebar)\r
+                               .hover(function() { $(this).addClass('ui-dialog-titlebar-close-hover'); }, \r
+                                       function() { $(this).removeClass('ui-dialog-titlebar-close-hover'); }\r
+                               )\r
+                               .mousedown(function(ev) {\r
+                                       ev.stopPropagation();\r
+                               })\r
+                               .click(function() {\r
+                                       self.close();\r
+                                       return false;\r
+                               });\r
+                       \r
+                       // setting tabindex makes the div focusable\r
+                       // setting outline to 0 prevents a border on focus in Mozilla\r
+                       uiDialog.attr('tabindex', -1).css('outline', 0).keydown(function(ev) {\r
+                               if (options.closeOnEscape) {\r
+                                       var ESC = 27;\r
+                                       (ev.keyCode && ev.keyCode == ESC && self.close());\r
+                               }\r
+                       });\r
+                       \r
+                       var hasButtons = false;\r
+                       $.each(options.buttons, function() { return !(hasButtons = true); });\r
+                       if (hasButtons) {\r
+                               var uiDialogButtonPane = $('<div class="ui-dialog-buttonpane"/>')\r
+                                       .appendTo(uiDialog);\r
+                               $.each(options.buttons, function(name, fn) {\r
+                                       $(document.createElement('button'))\r
+                                               .text(name)\r
+                                               .click(function() { fn.apply(self.element, arguments); })\r
+                                               .appendTo(uiDialogButtonPane);\r
+                               });\r
+                       }\r
+                       \r
+                       if ($.fn.draggable) {\r
+                               uiDialog.draggable({\r
+                                       handle: '.ui-dialog-titlebar',\r
+                                       start: function(e, ui) {\r
+                                               self.activate();\r
+                                               (options.dragStart && options.dragStart.apply(this, arguments));\r
+                                       },\r
+                                       drag: options.drag,\r
+                                       stop: function(e, ui) {\r
+                                               (options.dragStop && options.dragStop.apply(this, arguments));\r
+                                               $.ui.dialog.overlay.resize();\r
+                                       }\r
+                               });\r
+                               (!options.draggable && uiDialog.draggable('disable'));\r
+                       }\r
+               \r
+                       uiDialog.mousedown(function() {\r
+                               self.activate();\r
+                       });\r
+                       uiDialogTitlebar.click(function() {\r
+                               self.activate();\r
+                       });\r
+                       \r
+                       (options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe());\r
+                       \r
+                       (options.autoOpen && this.open());\r
+               },\r
+               \r
+               setData: function(key, value){\r
+                       (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));\r
+                       switch (key) {\r
+                               case "draggable":\r
+                                       this.uiDialog.draggable(value ? 'enable' : 'disable');\r
+                                       break;\r
+                               case "height":\r
+                                       this.uiDialog.height(value);\r
+                                       break;\r
+                               case "position":\r
+                                       this.position(value);\r
+                                       break;\r
+                               case "resizable":\r
+                                       this.uiDialog.resizable(value ? 'enable' : 'disable');\r
+                                       break;\r
+                               case "title":\r
+                                       $(".ui-dialog-title", this.uiDialogTitlebar).text(value);\r
+                                       break;\r
+                               case "width":\r
+                                       this.uiDialog.width(value);\r
+                                       break;\r
+                       }\r
+                       this.options[key] = value;\r
+               },\r
+               \r
+               position: function(pos) {\r
+                       var wnd = $(window), doc = $(document),\r
+                               pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),\r
+                               minTop = pTop;\r
+                       \r
+                       if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) {\r
+                               pos = [\r
+                                       pos == 'right' || pos == 'left' ? pos : 'center',\r
+                                       pos == 'top' || pos == 'bottom' ? pos : 'middle'\r
+                               ];\r
+                       }\r
+                       if (pos.constructor != Array) {\r
+                               pos = ['center', 'middle'];\r
+                       }\r
+                       if (pos[0].constructor == Number) {\r
+                               pLeft += pos[0];\r
+                       } else {\r
+                               switch (pos[0]) {\r
+                                       case 'left':\r
+                                               pLeft += 0;\r
+                                               break;\r
+                                       case 'right':\r
+                                               pLeft += (wnd.width()) - (this.uiDialog.width());\r
+                                               break;\r
+                                       default:\r
+                                       case 'center':\r
+                                               pLeft += (wnd.width() / 2) - (this.uiDialog.width() / 2);\r
+                               }\r
+                       }\r
+                       if (pos[1].constructor == Number) {\r
+                               pTop += pos[1];\r
+                       } else {\r
+                               switch (pos[1]) {\r
+                                       case 'top':\r
+                                               pTop += 0;\r
+                                               break;\r
+                                       case 'bottom':\r
+                                               pTop += (wnd.height()) - (this.uiDialog.height());\r
+                                               break;\r
+                                       default:\r
+                                       case 'middle':\r
+                                               pTop += (wnd.height() / 2) - (this.uiDialog.height() / 2);\r
+                               }\r
+                       }\r
+                       \r
+                       // prevent the dialog from being too high (make sure the titlebar\r
+                       // is accessible)\r
+                       pTop = Math.max(pTop, minTop);\r
+                       this.uiDialog.css({top: pTop, left: pLeft});\r
+               },\r
+               \r
+               open: function() {\r
+                       this.overlay = this.options.modal ? new $.ui.dialog.overlay(this) : null;\r
+                       this.uiDialog.appendTo('body');\r
+                       this.position(this.options.position);\r
+                       this.uiDialog.show();\r
+                       this.moveToTop();\r
+                       this.activate();\r
+                       \r
+                       // CALLBACK: open\r
+                       var openEV = null;\r
+                       var openUI = {\r
+                               options: this.options\r
+                       };\r
+                       this.uiDialogTitlebarClose.focus();\r
+                       this.element.triggerHandler("dialogopen", [openEV, openUI], this.options.open);\r
+               },\r
+       \r
+               activate: function() {\r
+                       // Move modeless dialogs to the top when they're activated. Even\r
+                       // if there is a modal dialog in the window, the modeless dialog\r
+                       // should be on top because it must have been opened after the modal\r
+                       // dialog. Modal dialogs don't get moved to the top because that\r
+                       // would make any modeless dialogs that it spawned unusable until\r
+                       // the modal dialog is closed.\r
+                       (!this.options.modal && this.moveToTop());\r
+               },\r
+                       \r
+               moveToTop: function() {\r
+                       var maxZ = this.options.zIndex, options = this.options;\r
+                       $('.ui-dialog:visible').each(function() {\r
+                               maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex);\r
+                       });\r
+                       (this.overlay && this.overlay.$el.css('z-index', ++maxZ));\r
+                       this.uiDialog.css('z-index', ++maxZ);\r
+               },\r
+                       \r
+               close: function() {\r
+                       (this.overlay && this.overlay.destroy());\r
+                       this.uiDialog.hide();\r
+\r
+                       // CALLBACK: close\r
+                       var closeEV = null;\r
+                       var closeUI = {\r
+                               options: this.options\r
+                       };\r
+                       this.element.triggerHandler("dialogclose", [closeEV, closeUI], this.options.close);\r
+                       $.ui.dialog.overlay.resize();\r
+               },\r
+               \r
+               destroy: function() {\r
+                       (this.overlay && this.overlay.destroy());\r
+                       this.uiDialog.hide();\r
+                       this.element\r
+                               .unbind('.dialog')\r
+                               .removeData('dialog')\r
+                               .removeClass('ui-dialog-content')\r
+                               .hide().appendTo('body');\r
+                       this.uiDialog.remove();\r
+               }\r
+       });\r
+       \r
+       $.extend($.ui.dialog, {\r
+               defaults: {\r
+                       autoOpen: true,\r
+                       bgiframe: false,\r
+                       buttons: {},\r
+                       closeOnEscape: true,\r
+                       draggable: true,\r
+                       height: 200,\r
+                       minHeight: 100,\r
+                       minWidth: 150,\r
+                       modal: false,\r
+                       overlay: {},\r
+                       position: 'center',\r
+                       resizable: true,\r
+                       width: 300,\r
+                       zIndex: 1000\r
+               },\r
+               \r
+               overlay: function(dialog) {\r
+                       this.$el = $.ui.dialog.overlay.create(dialog);\r
+               }\r
+       });\r
+       \r
+       $.extend($.ui.dialog.overlay, {\r
+               instances: [],\r
+               events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),\r
+                       function(e) { return e + '.dialog-overlay'; }).join(' '),\r
+               create: function(dialog) {\r
+                       if (this.instances.length === 0) {\r
+                               // prevent use of anchors and inputs\r
+                               // we use a setTimeout in case the overlay is created from an\r
+                               // event that we're going to be cancelling (see #2804)\r
+                               setTimeout(function() {\r
+                                       $('a, :input').bind($.ui.dialog.overlay.events, function() {\r
+                                               // allow use of the element if inside a dialog and\r
+                                               // - there are no modal dialogs\r
+                                               // - there are modal dialogs, but we are in front of the topmost modal\r
+                                               var allow = false;\r
+                                               var $dialog = $(this).parents('.ui-dialog');\r
+                                               if ($dialog.length) {\r
+                                                       var $overlays = $('.ui-dialog-overlay');\r
+                                                       if ($overlays.length) {\r
+                                                               var maxZ = parseInt($overlays.css('z-index'), 10);\r
+                                                               $overlays.each(function() {\r
+                                                                       maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10));\r
+                                                               });\r
+                                                               allow = parseInt($dialog.css('z-index'), 10) > maxZ;\r
+                                                       } else {\r
+                                                               allow = true;\r
+                                                       }\r
+                                               }\r
+                                               return allow;\r
+                                       });\r
+                               }, 1);\r
+                               \r
+                               // allow closing by pressing the escape key\r
+                               $(document).bind('keydown.dialog-overlay', function(e) {\r
+                                       var ESC = 27;\r
+                                       (e.keyCode && e.keyCode == ESC && dialog.close()); \r
+                               });\r
+                               \r
+                               // handle window resize\r
+                               $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);\r
+                       }\r
+                       \r
+                       var $el = $('<div/>').appendTo(document.body)\r
+                               .addClass('ui-dialog-overlay').css($.extend({\r
+                                       borderWidth: 0, margin: 0, padding: 0,\r
+                                       position: 'absolute', top: 0, left: 0,\r
+                                       width: this.width(),\r
+                                       height: this.height()\r
+                               }, dialog.options.overlay));\r
+                       \r
+                       (dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe());\r
+                       \r
+                       this.instances.push($el);\r
+                       return $el;\r
+               },\r
+               \r
+               destroy: function($el) {\r
+                       this.instances.splice($.inArray(this.instances, $el), 1);\r
+                       \r
+                       if (this.instances.length === 0) {\r
+                               $('a, :input').add([document, window]).unbind('.dialog-overlay');\r
+                       }\r
+                       \r
+                       $el.remove();\r
+               },\r
+               \r
+               height: function() {\r
+                       if ($.browser.msie && $.browser.version < 7) {\r
+                               var scrollHeight = Math.max(\r
+                                       document.documentElement.scrollHeight,\r
+                                       document.body.scrollHeight\r
+                               );\r
+                               var offsetHeight = Math.max(\r
+                                       document.documentElement.offsetHeight,\r
+                                       document.body.offsetHeight\r
+                               );\r
+                               \r
+                               if (scrollHeight < offsetHeight) {\r
+                                       return $(window).height() + 'px';\r
+                               } else {\r
+                                       return scrollHeight + 'px';\r
+                               }\r
+                       } else {\r
+                               return $(document).height() + 'px';\r
+                       }\r
+               },\r
+               \r
+               width: function() {\r
+                       if ($.browser.msie && $.browser.version < 7) {\r
+                               var scrollWidth = Math.max(\r
+                                       document.documentElement.scrollWidth,\r
+                                       document.body.scrollWidth\r
+                               );\r
+                               var offsetWidth = Math.max(\r
+                                       document.documentElement.offsetWidth,\r
+                                       document.body.offsetWidth\r
+                               );\r
+                               \r
+                               if (scrollWidth < offsetWidth) {\r
+                                       return $(window).width() + 'px';\r
+                               } else {\r
+                                       return scrollWidth + 'px';\r
+                               }\r
+                       } else {\r
+                               return $(document).width() + 'px';\r
+                       }\r
+               },\r
+               \r
+               resize: function() {\r
+                       /* If the dialog is draggable and the user drags it past the\r
+                        * right edge of the window, the document becomes wider so we\r
+                        * need to stretch the overlay. If the user then drags the\r
+                        * dialog back to the left, the document will become narrower,\r
+                        * so we need to shrink the overlay to the appropriate size.\r
+                        * This is handled by shrinking the overlay before setting it\r
+                        * to the full document size.\r
+                        */\r
+                       var $overlays = $([]);\r
+                       $.each($.ui.dialog.overlay.instances, function() {\r
+                               $overlays = $overlays.add(this);\r
+                       });\r
+                       \r
+                       $overlays.css({\r
+                               width: 0,\r
+                               height: 0\r
+                       }).css({\r
+                               width: $.ui.dialog.overlay.width(),\r
+                               height: $.ui.dialog.overlay.height()\r
+                       });\r
+               }\r
+       });\r
+       \r
+       $.extend($.ui.dialog.overlay.prototype, {\r
+               destroy: function() {\r
+                       $.ui.dialog.overlay.destroy(this.$el);\r
+               }\r
+       });\r
+\r
+})(jQuery);\r
diff --git a/ui/source/ui.draggable.js b/ui/source/ui.draggable.js
new file mode 100644 (file)
index 0000000..b90cea5
--- /dev/null
@@ -0,0 +1,527 @@
+/*\r
+ * jQuery UI Draggable\r
+ *\r
+ * Copyright (c) 2008 Paul Bakaus\r
+ * Dual licensed under the MIT (MIT-LICENSE.txt)\r
+ * and GPL (GPL-LICENSE.txt) licenses.\r
+ * \r
+ * http://docs.jquery.com/UI/Draggables\r
+ *\r
+ * Depends:\r
+ *     ui.core.js\r
+ *\r
+ * Revision: $Id: ui.draggable.js 5618 2008-05-16 16:28:05Z scott.gonzalez $\r
+ */\r
+\r
+;(function($) {\r
+       \r
+       $.widget("ui.draggable", {\r
+               init: function() {\r
+                       \r
+                       //Initialize needed constants\r
+                       var o = this.options;\r
+\r
+                       //Initialize mouse events for interaction\r
+                       this.element.mouse({\r
+                               executor: this,\r
+                               delay: o.delay,\r
+                               distance: o.distance,\r
+                               dragPrevention: o.cancel,\r
+                               start: this.start,\r
+                               stop: this.stop,\r
+                               drag: this.drag,\r
+                               condition: function(e) {\r
+                                       var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;\r
+                                       if(!handle) $(this.options.handle, this.element).each(function() { if(this == e.target) handle = true; });\r
+                                       return !(e.target.className.indexOf("ui-resizable-handle") != -1 || this.options.disabled) && handle;\r
+                               }\r
+                       });\r
+                       \r
+                       //Position the node\r
+                       if(o.helper == 'original' && !(/(relative|absolute|fixed)/).test(this.element.css('position')))\r
+                               this.element.css('position', 'relative');\r
+                       \r
+               },\r
+               start: function(e) {\r
+\r
+                       var o = this.options;\r
+                       if($.ui.ddmanager) $.ui.ddmanager.current = this;\r
+                       \r
+                       //Create and append the visible helper\r
+                       this.helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [e])) : (o.helper == 'clone' ? this.element.clone() : this.element);\r
+                       if(!this.helper.parents('body').length) this.helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));\r
+                       if(this.helper[0] != this.element[0] && !(/(fixed|absolute)/).test(this.helper.css("position"))) this.helper.css("position", "absolute");\r
+\r
+                       /*\r
+                        * - Position generation -\r
+                        * This block generates everything position related - it's the core of draggables.\r
+                        */\r
+                       \r
+                       this.margins = {                                                                                                                                                                //Cache the margins\r
+                               left: (parseInt(this.element.css("marginLeft"),10) || 0),\r
+                               top: (parseInt(this.element.css("marginTop"),10) || 0)\r
+                       };              \r
+\r
+                       this.cssPosition = this.helper.css("position");                                                                                                 //Store the helper's css position\r
+                       this.offset = this.element.offset();                                                                                                                    //The element's absolute position on the page\r
+                       this.offset = {                                                                                                                                                                 //Substract the margins from the element's absolute offset\r
+                               top: this.offset.top - this.margins.top,\r
+                               left: this.offset.left - this.margins.left\r
+                       };\r
+\r
+                       this.offset.click = {                                                                                                                                                   //Where the click happened, relative to the element\r
+                               left: e.pageX - this.offset.left,\r
+                               top: e.pageY - this.offset.top\r
+                       };\r
+       \r
+                       this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset();                    //Get the offsetParent and cache its position\r
+                       this.offset.parent = {                                                                                                                                                  //Store its position plus border\r
+                               top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),\r
+                               left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)\r
+                       };\r
+       \r
+                       var p = this.element.position();                                                                                                                                //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helpers\r
+                       this.offset.relative = this.cssPosition == "relative" ? {\r
+                               top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.offsetParent[0].scrollTop,\r
+                               left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.offsetParent[0].scrollLeft\r
+                       } : { top: 0, left: 0 };\r
+               \r
+                       this.originalPosition = this.generatePosition(e);                                                                                               //Generate the original position\r
+                       this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Cache the helper size\r
+\r
+                       if(o.cursorAt) {\r
+                               if(o.cursorAt.left != undefined) this.offset.click.left = o.cursorAt.left;\r
+                               if(o.cursorAt.right != undefined) this.offset.click.left = this.helperProportions.width - o.cursorAt.right;\r
+                               if(o.cursorAt.top != undefined) this.offset.click.top = o.cursorAt.top;\r
+                               if(o.cursorAt.bottom != undefined) this.offset.click.top = this.helperProportions.height - o.cursorAt.bottom;\r
+                       }\r
+\r
+\r
+                       /*\r
+                        * - Position constraining -\r
+                        * Here we prepare position constraining like grid and containment.\r
+                        */     \r
+                       \r
+                       if(o.containment) {\r
+                               if(o.containment == 'parent') o.containment = this.helper[0].parentNode;\r
+                               if(o.containment == 'document') this.containment = [0,0,$(document).width(), ($(document).height() || document.body.parentNode.scrollHeight)];\r
+                               if(!(/^(document|window|parent)$/).test(o.containment)) {\r
+                                       var ce = $(o.containment)[0];\r
+                                       var co = $(o.containment).offset();\r
+\r
+                                       this.containment = [\r
+                                               co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left,\r
+                                               co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top,\r
+                                               co.left+Math.max(ce.scrollWidth,ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),\r
+                                               co.top+Math.max(ce.scrollHeight,ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)\r
+                                       ];\r
+                               }\r
+                       }\r
+\r
+\r
+                       //Call plugins and callbacks\r
+                       this.propagate("start", e);\r
+\r
+                       this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size\r
+                       if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);\r
+\r
+                       return false;\r
+\r
+               },\r
+               convertPositionTo: function(d, pos) {\r
+                       if(!pos) pos = this.position;\r
+                       var mod = d == "absolute" ? 1 : -1;\r
+                       return {\r
+                               top: (\r
+                                       pos.top                                                                                                                                 // the calculated relative position\r
+                                       + this.offset.relative.top      * mod                                                                           // Only for relative positioned nodes: Relative offset from element to offset parent\r
+                                       + this.offset.parent.top * mod                                                                                  // The offsetParent's offset without borders (offset + border)\r
+                                       - (this.cssPosition == "fixed" ? 0 : this.offsetParent[0].scrollTop) * mod      // The offsetParent's scroll position, not if the element is fixed\r
+                                       + this.margins.top * mod                                                                                                //Add the margin (you don't want the margin counting in intersection methods)\r
+                               ),\r
+                               left: (\r
+                                       pos.left                                                                                                                                // the calculated relative position\r
+                                       + this.offset.relative.left     * mod                                                                           // Only for relative positioned nodes: Relative offset from element to offset parent\r
+                                       + this.offset.parent.left * mod                                                                                 // The offsetParent's offset without borders (offset + border)\r
+                                       - (this.cssPosition == "fixed" ? 0 : this.offsetParent[0].scrollLeft) * mod     // The offsetParent's scroll position, not if the element is fixed\r
+                                       + this.margins.left * mod                                                                                               //Add the margin (you don't want the margin counting in intersection methods)\r
+                               )\r
+                       };\r
+               },\r
+               generatePosition: function(e) {\r
+                       \r
+                       var o = this.options;\r
+                       var position = {\r
+                               top: (\r
+                                       e.pageY                                                                                                                                 // The absolute mouse position\r
+                                       - this.offset.click.top                                                                                                 // Click offset (relative to the element)\r
+                                       - this.offset.relative.top                                                                                              // Only for relative positioned nodes: Relative offset from element to offset parent\r
+                                       - this.offset.parent.top                                                                                                // The offsetParent's offset without borders (offset + border)\r
+                                       + (this.cssPosition == "fixed" ? 0 : this.offsetParent[0].scrollTop)    // The offsetParent's scroll position, not if the element is fixed\r
+                               ),\r
+                               left: (\r
+                                       e.pageX                                                                                                                                 // The absolute mouse position\r
+                                       - this.offset.click.left                                                                                                // Click offset (relative to the element)\r
+                                       - this.offset.relative.left                                                                                             // Only for relative positioned nodes: Relative offset from element to offset parent\r
+                                       - this.offset.parent.left                                                                                               // The offsetParent's offset without borders (offset + border)\r
+                                       + (this.cssPosition == "fixed" ? 0 : this.offsetParent[0].scrollLeft)   // The offsetParent's scroll position, not if the element is fixed\r
+                               )\r
+                       };\r
+\r
+                       if(!this.originalPosition) return position;                                                                             //If we are not dragging yet, we won't check for options\r
+                       \r
+                       \r
+                       /*\r
+                        * - Position constraining -\r
+                        * Constrain the position to a mix of grid, containment.\r
+                        */\r
+                       if(this.containment) {\r
+                               if(position.left < this.containment[0]) position.left = this.containment[0];\r
+                               if(position.top < this.containment[1]) position.top = this.containment[1];\r
+                               if(position.left > this.containment[2]) position.left = this.containment[2];\r
+                               if(position.top > this.containment[3]) position.top = this.containment[3];\r
+                       }\r
+                       \r
+                       if(o.grid) {\r
+                               var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1];\r
+                               position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;\r
+\r
+                               var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0];\r
+                               position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;\r
+                       }\r
+                       \r
+                       return position;\r
+               },\r
+               drag: function(e) {\r
+\r
+                       //Compute the helpers position\r
+                       this.position = this.generatePosition(e);\r
+                       this.positionAbs = this.convertPositionTo("absolute");\r
+\r
+                       //Call plugins and callbacks and use the resulting position if something is returned            \r
+                       this.position = this.propagate("drag", e) || this.position;\r
+                       \r
+                       if(!this.options.axis || this.options.axis == "x") this.helper[0].style.left = this.position.left+'px';\r
+                       if(!this.options.axis || this.options.axis == "y") this.helper[0].style.top = this.position.top+'px';\r
+                       if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);\r
+                       return false;\r
+\r
+               },\r
+               stop: function(e) {\r
+               \r
+                       //If we are using droppables, inform the manager about the drop\r
+                       if ($.ui.ddmanager && !this.options.dropBehaviour)\r
+                               $.ui.ddmanager.drop(this, e);\r
+                               \r
+                       if(this.options.revert) {\r
+                               var self = this;\r
+                               $(this.helper).animate(this.originalPosition, parseInt(this.options.revert, 10) || 500, function() {\r
+                                       self.propagate("stop", e);\r
+                                       self.clear();\r
+                               });\r
+                       } else {\r
+                               this.propagate("stop", e);\r
+                               this.clear();\r
+                       }\r
+\r
+                       return false;\r
+                       \r
+               },\r
+               clear: function() {\r
+                       if(this.options.helper != 'original' && !this.cancelHelperRemoval) this.helper.remove();\r
+                       if($.ui.ddmanager) $.ui.ddmanager.current = null;\r
+                       this.helper = null;\r
+                       this.cancelHelperRemoval = false;\r
+               },\r
+               \r
+               // From now on bulk stuff - mainly helpers\r
+               plugins: {},\r
+               ui: function(e) {\r
+                       return {\r
+                               helper: this.helper,\r
+                               position: this.position,\r
+                               absolutePosition: this.positionAbs,\r
+                               options: this.options                   \r
+                       };\r
+               },\r
+               propagate: function(n,e) {\r
+                       $.ui.plugin.call(this, n, [e, this.ui()]);\r
+                       return this.element.triggerHandler(n == "drag" ? n : "drag"+n, [e, this.ui()], this.options[n]);\r
+               },\r
+               destroy: function() {\r
+                       if(!this.element.data('draggable')) return;\r
+                       this.element.removeData("draggable").unbind(".draggable").mouse("destroy");\r
+               }\r
+       });\r
+       \r
+       $.ui.draggable.defaults = {\r
+               helper: "original",\r
+               appendTo: "parent",\r
+               cancel: ['input','textarea','button','select','option'],\r
+               distance: 1,\r
+               delay: 0\r
+       };\r
+       \r
+       \r
+       $.ui.plugin.add("draggable", "cursor", {\r
+               start: function(e, ui) {\r
+                       var t = $('body');\r
+                       if (t.css("cursor")) ui.options._cursor = t.css("cursor");\r
+                       t.css("cursor", ui.options.cursor);\r
+               },\r
+               stop: function(e, ui) {\r
+                       if (ui.options._cursor) $('body').css("cursor", ui.options._cursor);\r
+               }\r
+       });\r
+\r
+       $.ui.plugin.add("draggable", "zIndex", {\r
+               start: function(e, ui) {\r
+                       var t = $(ui.helper);\r
+                       if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex");\r
+                       t.css('zIndex', ui.options.zIndex);\r
+               },\r
+               stop: function(e, ui) {\r
+                       if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex);\r
+               }\r
+       });\r
+\r
+       $.ui.plugin.add("draggable", "opacity", {\r
+               start: function(e, ui) {\r
+                       var t = $(ui.helper);\r
+                       if(t.css("opacity")) ui.options._opacity = t.css("opacity");\r
+                       t.css('opacity', ui.options.opacity);\r
+               },\r
+               stop: function(e, ui) {\r
+                       if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity);\r
+               }\r
+       });\r
+       \r
+       $.ui.plugin.add("draggable", "iframeFix", {\r
+               start: function(e, ui) {\r
+                       $(ui.options.iframeFix === true ? "iframe" : ui.options.iframeFix).each(function() {                                    \r
+                               $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')\r
+                               .css({\r
+                                       width: this.offsetWidth+"px", height: this.offsetHeight+"px",\r
+                                       position: "absolute", opacity: "0.001", zIndex: 1000\r
+                               })\r
+                               .css($(this).offset())\r
+                               .appendTo("body");\r
+                       });\r
+               },\r
+               stop: function(e, ui) {\r
+                       $("div.DragDropIframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers      \r
+               }\r
+       });\r
+       \r
+       $.ui.plugin.add("draggable", "scroll", {\r
+               start: function(e, ui) {\r
+                       var o = ui.options;\r
+                       var i = $(this).data("draggable");\r
+                       o.scrollSensitivity     = o.scrollSensitivity || 20;\r
+                       o.scrollSpeed           = o.scrollSpeed || 20;\r
+\r
+                       i.overflowY = function(el) {\r
+                               do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode);\r
+                               return $(document);\r
+                       }(this);\r
+                       i.overflowX = function(el) {\r
+                               do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);\r
+                               return $(document);\r
+                       }(this);\r
+                       \r
+                       if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset();\r
+                       if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset();\r
+                       \r
+               },\r
+               drag: function(e, ui) {\r
+                       \r
+                       var o = ui.options;\r
+                       var i = $(this).data("draggable");\r
+\r
+                       if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {\r
+                               if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity)\r
+                                       i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed;\r
+                               if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity)\r
+                                       i.overflowY[0].scrollTop = i.overflowY[0].scrollTop - o.scrollSpeed;\r
+                                                               \r
+                       } else {\r
+                               if(e.pageY - $(document).scrollTop() < o.scrollSensitivity)\r
+                                       $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);\r
+                               if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity)\r
+                                       $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);\r
+                       }\r
+                       \r
+                       if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {\r
+                               if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity)\r
+                                       i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed;\r
+                               if(e.pageX - i.overflowXOffset.left < o.scrollSensitivity)\r
+                                       i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft - o.scrollSpeed;\r
+                       } else {\r
+                               if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity)\r
+                                       $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);\r
+                               if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity)\r
+                                       $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);\r
+                       }\r
+\r
+               }\r
+       });\r
+       \r
+       $.ui.plugin.add("draggable", "snap", {\r
+               start: function(e, ui) {\r
+                       \r
+                       var inst = $(this).data("draggable");\r
+                       inst.snapElements = [];\r
+                       $(ui.options.snap === true ? '.ui-draggable' : ui.options.snap).each(function() {\r
+                               var $t = $(this); var $o = $t.offset();\r
+                               if(this != inst.element[0]) inst.snapElements.push({\r
+                                       item: this,\r
+                                       width: $t.outerWidth(), height: $t.outerHeight(),\r
+                                       top: $o.top, left: $o.left\r
+                               });\r
+                       });\r
+                       \r
+               },\r
+               drag: function(e, ui) {\r
+\r
+                       var inst = $(this).data("draggable");\r
+                       var d = ui.options.snapTolerance || 20;\r
+                       var x1 = ui.absolutePosition.left, x2 = x1 + inst.helperProportions.width,\r
+                               y1 = ui.absolutePosition.top, y2 = y1 + inst.helperProportions.height;\r
+\r
+                       for (var i = inst.snapElements.length - 1; i >= 0; i--){\r
+\r
+                               var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, \r
+                                       t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;\r
+\r
+                               //Yes, I know, this is insane ;)\r
+                               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))) continue;\r
+\r
+                               if(ui.options.snapMode != 'inner') {\r
+                                       var ts = Math.abs(t - y2) <= 20;\r
+                                       var bs = Math.abs(b - y1) <= 20;\r
+                                       var ls = Math.abs(l - x2) <= 20;\r
+                                       var rs = Math.abs(r - x1) <= 20;\r
+                                       if(ts) ui.position.top = inst.convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;\r
+                                       if(bs) ui.position.top = inst.convertPositionTo("relative", { top: b, left: 0 }).top;\r
+                                       if(ls) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;\r
+                                       if(rs) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: r }).left;\r
+                               }\r
+                               \r
+                               if(ui.options.snapMode != 'outer') {\r
+                                       var ts = Math.abs(t - y1) <= 20;\r
+                                       var bs = Math.abs(b - y2) <= 20;\r
+                                       var ls = Math.abs(l - x1) <= 20;\r
+                                       var rs = Math.abs(r - x2) <= 20;\r
+                                       if(ts) ui.position.top = inst.convertPositionTo("relative", { top: t, left: 0 }).top;\r
+                                       if(bs) ui.position.top = inst.convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;\r
+                                       if(ls) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: l }).left;\r
+                                       if(rs) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;\r
+                               }\r
+\r
+                       };\r
+               }\r
+       });\r
+       \r
+       $.ui.plugin.add("draggable", "connectToSortable", {\r
+               start: function(e,ui) {\r
+                       var inst = $(this).data("draggable");\r
+                       inst.sortable = $.data($(ui.options.connectToSortable)[0], 'sortable');\r
+                       inst.sortableOffset = inst.sortable.element.offset();\r
+                       inst.sortableOuterWidth = inst.sortable.element.outerWidth();\r
+                       inst.sortableOuterHeight = inst.sortable.element.outerHeight();\r
+                       if(inst.sortable.options.revert) inst.sortable.shouldRevert = true;\r
+               },\r
+               stop: function(e,ui) {\r
+                       //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper\r
+                       var instDraggable = $(this).data("draggable");\r
+                       var inst = instDraggable.sortable;\r
+                       \r
+                       if(inst.isOver) {\r
+                               inst.isOver = 0;\r
+                               instDraggable.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance\r
+                               inst.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)\r
+                               if(inst.shouldRevert) inst.options.revert = true; //revert here\r
+                               inst.stop(e);\r
+                               inst.options.helper = "original";\r
+                       }\r
+               },\r
+               drag: function(e,ui) {\r
+                       //This is handy: We reuse the intersectsWith method for checking if the current draggable helper\r
+                       //intersects with the sortable container\r
+                       var instDraggable = $(this).data("draggable");\r
+                       var inst = instDraggable.sortable;\r
+                       instDraggable.position.absolute = ui.absolutePosition; //Sorry, this is an ugly API fix\r
+                       \r
+                       if(inst.intersectsWith.call(instDraggable, {\r
+                               left: instDraggable.sortableOffset.left, top: instDraggable.sortableOffset.top,\r
+                               width: instDraggable.sortableOuterWidth, height: instDraggable.sortableOuterHeight\r
+                       })) {\r
+                               //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once\r
+                               if(!inst.isOver) {\r
+                                       inst.isOver = 1;\r
+                                       \r
+                                       //Cache the width/height of the new helper\r
+                                       var height = inst.options.placeholderElement ? $(inst.options.placeholderElement, $(inst.options.items, inst.element)).innerHeight() : $(inst.options.items, inst.element).innerHeight();\r
+                                       var width = inst.options.placeholderElement ? $(inst.options.placeholderElement, $(inst.options.items, inst.element)).innerWidth() : $(inst.options.items, inst.element).innerWidth();\r
+\r
+                                       //Now we fake the start of dragging for the sortable instance,\r
+                                       //by cloning the list group item, appending it to the sortable and using it as inst.currentItem\r
+                                       //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)\r
+                                       inst.currentItem = $(this).clone().appendTo(inst.element);\r
+                                       inst.options.helper = function() { return ui.helper[0]; };\r
+                                       inst.start(e);\r
+                                       \r
+                                       //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes\r
+                                       inst.clickOffset.top = instDraggable.offset.click.top;\r
+                                       inst.clickOffset.left = instDraggable.offset.click.left;\r
+                                       inst.offset.left -= ui.absolutePosition.left - inst.position.absolute.left;\r
+                                       inst.offset.top -= ui.absolutePosition.top - inst.position.absolute.top;\r
+                                       \r
+                                       //Do a nifty little helper animation: Animate it to the portlet's size (just takes the first 'li' element in the sortable now)\r
+                                       inst.helperProportions = {width: width, height: height}; //We have to reset the helper proportions, because we are doing our animation there\r
+                                       ui.helper.animate({height: height, width: width}, 500);\r
+                                       instDraggable.propagate("toSortable", e);\r
+                               \r
+                               }\r
+\r
+                               //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\r
+                               if(inst.currentItem) inst.drag(e);\r
+                               \r
+                       } else {\r
+                               \r
+                               //If it doesn't intersect with the sortable, and it intersected before,\r
+                               //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval\r
+                               if(inst.isOver) {\r
+                                       inst.isOver = 0;\r
+                                       inst.cancelHelperRemoval = true;\r
+                                       inst.options.revert = false; //No revert here\r
+                                       inst.stop(e);\r
+                                       inst.options.helper = "original";\r
+                                       \r
+                                       //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size\r
+                                       inst.currentItem.remove();\r
+                                       inst.placeholder.remove();\r
+                                       \r
+                                       ui.helper.animate({ height: this.innerHeight(), width: this.innerWidth() }, 500);\r
+                                       instDraggable.propagate("fromSortable", e);\r
+                               }\r
+                               \r
+                       };\r
+               }\r
+       });\r
+       \r
+       $.ui.plugin.add("draggable", "stack", {\r
+               start: function(e,ui) {\r
+                       var group = $.makeArray($(ui.options.stack.group)).sort(function(a,b) {\r
+                               return (parseInt($(a).css("zIndex"),10) || ui.options.stack.min) - (parseInt($(b).css("zIndex"),10) || ui.options.stack.min);\r
+                       });\r
+                       \r
+                       $(group).each(function(i) {\r
+                               this.style.zIndex = ui.options.stack.min + i;\r
+                       });\r
+                       \r
+                       this[0].style.zIndex = ui.options.stack.min + group.length;\r
+               }\r
+       });\r
+       \r
+})(jQuery);
\ No newline at end of file
diff --git a/ui/source/ui.droppable.js b/ui/source/ui.droppable.js
new file mode 100644 (file)
index 0000000..7dcd86b
--- /dev/null
@@ -0,0 +1,292 @@
+/*\r
+ * jQuery UI Droppable\r
+ *\r
+ * Copyright (c) 2008 Paul Bakaus\r
+ * Dual licensed under the MIT (MIT-LICENSE.txt)\r
+ * and GPL (GPL-LICENSE.txt) licenses.\r
+ * \r
+ * http://docs.jquery.com/UI/Droppables\r
+ *\r
+ * Depends:\r
+ *     ui.core.js\r
+ *     ui.draggable.js\r
+ *\r
+ * Revision: $Id: ui.droppable.js 5568 2008-05-12 15:07:16Z paul.bakaus $\r
+ */\r
+\r
+;(function($) {\r
+\r
+       $.widget("ui.droppable", {\r
+               init: function() {\r
+       \r
+                       this.element.addClass("ui-droppable");\r
+                       this.isover = 0; this.isout = 1;\r
+                       \r
+                       //Prepare the passed options\r
+                       var o = this.options, accept = o.accept;\r
+                       o = $.extend(o, {\r
+                               accept: o.accept && o.accept.constructor == Function ? o.accept : function(d) {\r
+                                       return $(d).is(accept);\r
+                               }\r
+                       });\r
+                       \r
+                       //Store the droppable's proportions\r
+                       this.proportions = { width: this.element.outerWidth(), height: this.element.outerHeight() };\r
+                       \r
+                       // Add the reference and positions to the manager\r
+                       $.ui.ddmanager.droppables.push(this);\r
+                       \r
+               },\r
+               plugins: {},\r
+               ui: function(c) {\r
+                       return {\r
+                               instance: this,\r
+                               draggable: (c.currentItem || c.element),\r
+                               helper: c.helper,\r
+                               position: c.position,\r
+                               absolutePosition: c.positionAbs,\r
+                               options: this.options,\r
+                               element: this.element\r
+                       };\r
+               },\r
+               destroy: function() {\r
+                       var drop = $.ui.ddmanager.droppables;\r
+                       for ( var i = 0; i < drop.length; i++ )\r
+                               if ( drop[i] == this )\r
+                                       drop.splice(i, 1);\r
+                       \r
+                       this.element\r
+                               .removeClass("ui-droppable ui-droppable-disabled")\r
+                               .removeData("droppable")\r
+                               .unbind(".droppable");\r
+               },\r
+               enable: function() {\r
+                       this.element.removeClass("ui-droppable-disabled");\r
+                       this.options.disabled = false;\r
+               },\r
+               disable: function() {\r
+                       this.element.addClass("ui-droppable-disabled");\r
+                       this.options.disabled = true;\r
+               },\r
+               over: function(e) {\r
+                       \r
+                       var draggable = $.ui.ddmanager.current;\r
+                       if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element\r
+                       \r
+                       if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {\r
+                               $.ui.plugin.call(this, 'over', [e, this.ui(draggable)]);\r
+                               this.element.triggerHandler("dropover", [e, this.ui(draggable)], this.options.over);\r
+                       }\r
+                       \r
+               },\r
+               out: function(e) {\r
+                       \r
+                       var draggable = $.ui.ddmanager.current;\r
+                       if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element\r
+                       \r
+                       if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {\r
+                               $.ui.plugin.call(this, 'out', [e, this.ui(draggable)]);\r
+                               this.element.triggerHandler("dropout", [e, this.ui(draggable)], this.options.out);\r
+                       }\r
+                       \r
+               },\r
+               drop: function(e,custom) {\r
+                       \r
+                       var draggable = custom || $.ui.ddmanager.current;\r
+                       if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element\r
+                       \r
+                       var childrenIntersection = false;\r
+                       this.element.find(".ui-droppable").each(function() {\r
+                               var inst = $.data(this, 'droppable');\r
+                               if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) {\r
+                                       childrenIntersection = true; return false;\r
+                               }\r
+                       });\r
+                       if(childrenIntersection) return false;\r
+                       \r
+                       if(this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {\r
+                               $.ui.plugin.call(this, 'drop', [e, this.ui(draggable)]);\r
+                               this.element.triggerHandler("drop", [e, this.ui(draggable)], this.options.drop);\r
+                               return true;\r
+                       }\r
+                       \r
+                       return false;\r
+                       \r
+               },\r
+               activate: function(e) {\r
+                       \r
+                       var draggable = $.ui.ddmanager.current;\r
+                       $.ui.plugin.call(this, 'activate', [e, this.ui(draggable)]);\r
+                       if(draggable) this.element.triggerHandler("dropactivate", [e, this.ui(draggable)], this.options.activate);\r
+                       \r
+               },\r
+               deactivate: function(e) {\r
+                       \r
+                       var draggable = $.ui.ddmanager.current;\r
+                       $.ui.plugin.call(this, 'deactivate', [e, this.ui(draggable)]);\r
+                       if(draggable) this.element.triggerHandler("dropdeactivate", [e, this.ui(draggable)], this.options.deactivate);\r
+                       \r
+               }\r
+       });\r
+       \r
+       $.extend($.ui.droppable, {\r
+               defaults: {\r
+                       disabled: false,\r
+                       tolerance: 'intersect'\r
+               }\r
+       });\r
+       \r
+       $.ui.intersect = function(draggable, droppable, toleranceMode) {\r
+               \r
+               if (!droppable.offset) return false;\r
+               \r
+               var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,\r
+                       y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;\r
+               var l = droppable.offset.left, r = l + droppable.proportions.width,\r
+                       t = droppable.offset.top, b = t + droppable.proportions.height;\r
+               \r
+               switch (toleranceMode) {\r
+                       case 'fit':\r
+                               return (l < x1 && x2 < r\r
+                                       && t < y1 && y2 < b);\r
+                               break;\r
+                       case 'intersect':\r
+                               return (l < x1 + (draggable.helperProportions.width / 2) // Right Half\r
+                                       && x2 - (draggable.helperProportions.width / 2) < r // Left Half\r
+                                       && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half\r
+                                       && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half\r
+                               break;\r
+                       case 'pointer':\r
+                               return (l < ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left) && ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left) < r\r
+                                       && t < ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top) && ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top) < b);\r
+                               break;\r
+                       case 'touch':\r
+                               return (\r
+                                               (y1 >= t && y1 <= b) || // Top edge touching\r
+                                               (y2 >= t && y2 <= b) || // Bottom edge touching\r
+                                               (y1 < t && y2 > b)              // Surrounded vertically\r
+                                       ) && (\r
+                                               (x1 >= l && x1 <= r) || // Left edge touching\r
+                                               (x2 >= l && x2 <= r) || // Right edge touching\r
+                                               (x1 < l && x2 > r)              // Surrounded horizontally\r
+                                       );\r
+                               break;\r
+                       default:\r
+                               return false;\r
+                               break;\r
+                       }\r
+               \r
+       };\r
+       \r
+       /*\r
+               This manager tracks offsets of draggables and droppables\r
+       */\r
+       $.ui.ddmanager = {\r
+               current: null,\r
+               droppables: [],\r
+               prepareOffsets: function(t, e) {\r
+                       \r
+                       var m = $.ui.ddmanager.droppables;\r
+                       var type = e ? e.type : null; // workaround for #2317\r
+                       for (var i = 0; i < m.length; i++) {\r
+                               \r
+                               if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element,(t.currentItem || t.element)))) continue;\r
+                               m[i].visible = m[i].element.is(":visible"); if(!m[i].visible) continue; //If the element is not visible, continue\r
+                               m[i].offset = m[i].element.offset();\r
+                               m[i].proportions = { width: m[i].element.outerWidth(), height: m[i].element.outerHeight() };\r
+                               \r
+                               if(type == "dragstart" || type == "sortactivate") m[i].activate.call(m[i], e); //Activate the droppable if used directly from draggables\r
+                       }\r
+                       \r
+               },\r
+               drop: function(draggable, e) {\r
+                       \r
+                       var dropped = false;\r
+                       $.each($.ui.ddmanager.droppables, function() {\r
+                               \r
+                               if(!this.options) return;\r
+                               if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))\r
+                                       dropped = this.drop.call(this, e);\r
+                               \r
+                               if (!this.options.disabled && this.visible && this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {\r
+                                       this.isout = 1; this.isover = 0;\r
+                                       this.deactivate.call(this, e);\r
+                               }\r
+                               \r
+                       });\r
+                       return dropped;\r
+                       \r
+               },\r
+               drag: function(draggable, e) {\r
+                       \r
+                       //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.\r
+                       if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, e);\r
+                       \r
+                       //Run through all droppables and check their positions based on specific tolerance options\r
+                       $.each($.ui.ddmanager.droppables, function() {\r
+                               \r
+                               if(this.disabled || this.greedyChild || !this.visible) return;\r
+                               var intersects = $.ui.intersect(draggable, this, this.options.tolerance);\r
+                               \r
+                               var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);\r
+                               if(!c) return;\r
+                               \r
+                               var parentInstance;\r
+                               if (this.options.greedy) {\r
+                                       var parent = this.element.parents('.ui-droppable:eq(0)');\r
+                                       if (parent.length) {\r
+                                               parentInstance = $.data(parent[0], 'droppable');\r
+                                               parentInstance.greedyChild = (c == 'isover' ? 1 : 0);\r
+                                       }\r
+                               }\r
+                               \r
+                               // we just moved into a greedy child\r
+                               if (parentInstance && c == 'isover') {\r
+                                       parentInstance['isover'] = 0;\r
+                                       parentInstance['isout'] = 1;\r
+                                       parentInstance.out.call(parentInstance, e);\r
+                               }\r
+                               \r
+                               this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;\r
+                               this[c == "isover" ? "over" : "out"].call(this, e);\r
+                               \r
+                               // we just moved out of a greedy child\r
+                               if (parentInstance && c == 'isout') {\r
+                                       parentInstance['isout'] = 0;\r
+                                       parentInstance['isover'] = 1;\r
+                                       parentInstance.over.call(parentInstance, e);\r
+                               }\r
+                       });\r
+                       \r
+               }\r
+       };\r
+       \r
+/*\r
+ * Droppable Extensions\r
+ */\r
+       \r
+       $.ui.plugin.add("droppable", "activeClass", {\r
+               activate: function(e, ui) {\r
+                       $(this).addClass(ui.options.activeClass);\r
+               },\r
+               deactivate: function(e, ui) {\r
+                       $(this).removeClass(ui.options.activeClass);\r
+               },\r
+               drop: function(e, ui) {\r
+                       $(this).removeClass(ui.options.activeClass);\r
+               }\r
+       });\r
+       \r
+       $.ui.plugin.add("droppable", "hoverClass", {\r
+               over: function(e, ui) {\r
+                       $(this).addClass(ui.options.hoverClass);\r
+               },\r
+               out: function(e, ui) {\r
+                       $(this).removeClass(ui.options.hoverClass);\r
+               },\r
+               drop: function(e, ui) {\r
+                       $(this).removeClass(ui.options.hoverClass);\r
+               }\r
+       });\r
\r
+})(jQuery);\r
diff --git a/ui/source/ui.resizable.js b/ui/source/ui.resizable.js
new file mode 100644 (file)
index 0000000..0dba71f
--- /dev/null
@@ -0,0 +1,736 @@
+/*\r
+ * jQuery UI Resizable\r
+ *\r
+ * Copyright (c) 2008 Paul Bakaus\r
+ * Dual licensed under the MIT (MIT-LICENSE.txt)\r
+ * and GPL (GPL-LICENSE.txt) licenses.\r
+ * \r
+ * http://docs.jquery.com/UI/Resizables\r
+ *\r
+ * Depends:\r
+ *     ui.core.js\r
+ *\r
+ * Revision: $Id: ui.resizable.js 5653 2008-05-21 04:09:48Z braeker $\r
+ */\r
+;(function($) {\r
+       \r
+       $.widget("ui.resizable", {\r
+               init: function() {\r
+\r
+                       var self = this, o = this.options;\r
+                       \r
+                       var elpos = this.element.css('position');\r
+                       \r
+                       // simulate .ui-resizable { position: relative; }\r
+                       this.element.addClass("ui-resizable").css({ position: /static/.test(elpos) ? 'relative' : elpos });\r
+                       \r
+                       $.extend(o, {\r
+                               _aspectRatio: !!(o.aspectRatio),\r
+                               proxy: o.proxy || o.ghost || o.animate ? o.proxy || 'proxy' : null,\r
+                               knobHandles: o.knobHandles === true ? 'ui-resizable-knob-handle' : o.knobHandles\r
+                       });\r
+\r
+                       //Default Theme\r
+                       var aBorder = '1px solid #DEDEDE';\r
+       \r
+                       o.defaultTheme = {\r
+                               'ui-resizable': { display: 'block' },\r
+                               'ui-resizable-handle': { position: 'absolute', background: '#F2F2F2', fontSize: '0.1px' },\r
+                               'ui-resizable-n': { cursor: 'n-resize', height: '4px', left: '0px', right: '0px', borderTop: aBorder },\r
+                               'ui-resizable-s': { cursor: 's-resize', height: '4px', left: '0px', right: '0px', borderBottom: aBorder },\r
+                               'ui-resizable-e': { cursor: 'e-resize', width: '4px', top: '0px', bottom: '0px', borderRight: aBorder },\r
+                               'ui-resizable-w': { cursor: 'w-resize', width: '4px', top: '0px', bottom: '0px', borderLeft: aBorder },\r
+                               'ui-resizable-se': { cursor: 'se-resize', width: '4px', height: '4px', borderRight: aBorder, borderBottom: aBorder },\r
+                               'ui-resizable-sw': { cursor: 'sw-resize', width: '4px', height: '4px', borderBottom: aBorder, borderLeft: aBorder },\r
+                               'ui-resizable-ne': { cursor: 'ne-resize', width: '4px', height: '4px', borderRight: aBorder, borderTop: aBorder },\r
+                               'ui-resizable-nw': { cursor: 'nw-resize', width: '4px', height: '4px', borderLeft: aBorder, borderTop: aBorder }\r
+                       };\r
+                       \r
+                       o.knobTheme = {\r
+                               'ui-resizable-handle': { background: '#F2F2F2', border: '1px solid #808080', height: '8px', width: '8px' },\r
+                               'ui-resizable-n': { cursor: 'n-resize', top: '0px', left: '45%' },\r
+                               'ui-resizable-s': { cursor: 's-resize', bottom: '0px', left: '45%' },\r
+                               'ui-resizable-e': { cursor: 'e-resize', right: '0px', top: '45%' },\r
+                               'ui-resizable-w': { cursor: 'w-resize', left: '0px', top: '45%' },\r
+                               'ui-resizable-se': { cursor: 'se-resize', right: '0px', bottom: '0px' },\r
+                               'ui-resizable-sw': { cursor: 'sw-resize', left: '0px', bottom: '0px' },\r
+                               'ui-resizable-nw': { cursor: 'nw-resize', left: '0px', top: '0px' },\r
+                               'ui-resizable-ne': { cursor: 'ne-resize', right: '0px', top: '0px' }\r
+                       };\r
+                       \r
+                       o._nodeName = this.element[0].nodeName;\r
+                       \r
+                       //Wrap the element if it cannot hold child nodes\r
+                       if(o._nodeName.match(/canvas|textarea|input|select|button|img/i)) {\r
+                               var el = this.element;\r
+                               \r
+                               //Opera fixing relative position\r
+                               if (/relative/.test(el.css('position')) && $.browser.opera)\r
+                                       el.css({ position: 'relative', top: 'auto', left: 'auto' });\r
+                               \r
+                               //Create a wrapper element and set the wrapper to the new current internal element\r
+                               el.wrap(\r
+                                       $('<div class="ui-wrapper"      style="overflow: hidden;"></div>').css( {\r
+                                               position: el.css('position'),\r
+                                               width: el.outerWidth(),\r
+                                               height: el.outerHeight(),\r
+                                               top: el.css('top'),\r
+                                               left: el.css('left')\r
+                                       })\r
+                               );\r
+                               \r
+                               var oel = this.element; this.element = this.element.parent();\r
+               \r
+                               //Move margins to the wrapper\r
+                               this.element.css({ marginLeft: oel.css("marginLeft"), marginTop: oel.css("marginTop"),\r
+                                       marginRight: oel.css("marginRight"), marginBottom: oel.css("marginBottom")\r
+                               });\r
+               \r
+                               oel.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});\r
+               \r
+                               //Prevent Safari textarea resize\r
+                               if ($.browser.safari && o.preventDefault) oel.css('resize', 'none');\r
+               \r
+                               o.proportionallyResize = oel.css({ position: 'static', zoom: 1, display: 'block' });\r
+                               \r
+                               // avoid IE jump\r
+                               this.element.css({ margin: oel.css('margin') });\r
+                               \r
+                               // fix handlers offset\r
+                               this._proportionallyResize();\r
+                       }\r
+                       \r
+                       if(!o.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' };\r
+                       if(o.handles.constructor == String) {\r
+               \r
+                               o.zIndex = o.zIndex || 1000;\r
+                               \r
+                               if(o.handles == 'all') o.handles = 'n,e,s,w,se,sw,ne,nw';\r
+               \r
+                               var n = o.handles.split(","); o.handles = {};\r
+                               \r
+                               // insertions are applied when don't have theme loaded\r
+                               var insertionsDefault = {\r
+                                       handle: 'position: absolute; display: none; overflow:hidden;',\r
+                                       n: 'top: 0pt; width:100%;',\r
+                                       e: 'right: 0pt; height:100%;',\r
+                                       s: 'bottom: 0pt; width:100%;',\r
+                                       w: 'left: 0pt; height:100%;',\r
+                                       se: 'bottom: 0pt; right: 0px;',\r
+                                       sw: 'bottom: 0pt; left: 0px;',\r
+                                       ne: 'top: 0pt; right: 0px;',\r
+                                       nw: 'top: 0pt; left: 0px;'\r
+                               };\r
+               \r
+                               for(var i = 0; i < n.length; i++) {\r
+                                       var handle = $.trim(n[i]), dt = o.defaultTheme, hname = 'ui-resizable-'+handle, loadDefault = !$.ui.css(hname) && !o.knobHandles, userKnobClass = $.ui.css('ui-resizable-knob-handle'), \r
+                                                               allDefTheme = $.extend(dt[hname], dt['ui-resizable-handle']), allKnobTheme = $.extend(o.knobTheme[hname], !userKnobClass ? o.knobTheme['ui-resizable-handle'] : {});\r
+                                       \r
+                                       // increase zIndex of sw, se, ne, nw axis\r
+                                       var applyZIndex = /sw|se|ne|nw/.test(handle) ? { zIndex: ++o.zIndex } : {};\r
+                                       \r
+                                       var defCss = (loadDefault ? insertionsDefault[handle] : ''), \r
+                                               axis = $(['<div class="ui-resizable-handle ', hname, '" style="', defCss, insertionsDefault.handle, '"></div>'].join('')).css( applyZIndex );\r
+                                       o.handles[handle] = '.ui-resizable-'+handle;\r
+                                       \r
+                                       this.element.append(\r
+                                               //Theme detection, if not loaded, load o.defaultTheme\r
+                                               axis.css( loadDefault ? allDefTheme : {} )\r
+                                                       // Load the knobHandle css, fix width, height, top, left...\r
+                                                       .css( o.knobHandles ? allKnobTheme : {} ).addClass(o.knobHandles ? 'ui-resizable-knob-handle' : '').addClass(o.knobHandles)\r
+                                       );\r
+                               }\r
+                               \r
+                               if (o.knobHandles) this.element.addClass('ui-resizable-knob').css( !$.ui.css('ui-resizable-knob') ? { /*border: '1px #fff dashed'*/ } : {} );\r
+                       }\r
+\r
+                       this._renderAxis = function(target) {\r
+                               target = target || this.element;\r
+               \r
+                               for(var i in o.handles) {\r
+                                       if(o.handles[i].constructor == String) \r
+                                               o.handles[i] = $(o.handles[i], this.element).show();\r
+               \r
+                                       if (o.transparent)\r
+                                               o.handles[i].css({opacity:0});\r
+               \r
+                                       //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)\r
+                                       if (this.element.is('.ui-wrapper') && \r
+                                               o._nodeName.match(/textarea|input|select|button/i)) {\r
+               \r
+                                               var axis = $(o.handles[i], this.element), padWrapper = 0;\r
+               \r
+                                               //Checking the correct pad and border\r
+                                               padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();\r
+               \r
+                                               //The padding type i have to apply...\r
+                                               var padPos = [ 'padding', \r
+                                                       /ne|nw|n/.test(i) ? 'Top' :\r
+                                                       /se|sw|s/.test(i) ? 'Bottom' : \r
+                                                       /^e$/.test(i) ? 'Right' : 'Left' ].join(""); \r
+               \r
+                                               if (!o.transparent)\r
+                                                       target.css(padPos, padWrapper);\r
+               \r
+                                               this._proportionallyResize();\r
+                                       }\r
+                                       if(!$(o.handles[i]).length) continue;\r
+                               }\r
+                       };\r
+                       \r
+                       this._renderAxis(this.element);\r
+                       o._handles = $('.ui-resizable-handle', self.element);\r
+                       \r
+                       if (o.disableSelection)\r
+                               o._handles.each(function(i, e) { $.ui.disableSelection(e); });\r
+                       \r
+                       //Matching axis name\r
+                       o._handles.mouseover(function() {\r
+                               if (!o.resizing) {\r
+                                       if (this.className) \r
+                                               var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);\r
+                                       //Axis, default = se\r
+                                       self.axis = o.axis = axis && axis[1] ? axis[1] : 'se';\r
+                               }\r
+                       });\r
+                                       \r
+                       //If we want to auto hide the elements\r
+                       if (o.autohide) {\r
+                               o._handles.hide();\r
+                               $(self.element).addClass("ui-resizable-autohide").hover(function() {\r
+                                       $(this).removeClass("ui-resizable-autohide");\r
+                                       o._handles.show();\r
+                               },\r
+                               function(){\r
+                                       if (!o.resizing) {\r
+                                               $(this).addClass("ui-resizable-autohide");\r
+                                               o._handles.hide();\r
+                                       }\r
+                               });\r
+                       }\r
+               \r
+                       //Initialize mouse events for interaction\r
+                       this.element.mouse({\r
+                               executor: this,\r
+                               delay: 0,\r
+                               distance: 0,\r
+                               dragPrevention: ['input','textarea','button','select','option'],\r
+                               start: this.start,\r
+                               stop: this.stop,\r
+                               drag: this.drag,\r
+                               condition: function(e) {\r
+                                       if(this.disabled) return false;\r
+                                       for(var i in this.options.handles) {\r
+                                               if($(this.options.handles[i])[0] == e.target) return true;\r
+                                       }\r
+                                       return false;\r
+                               }\r
+                       });\r
+                       \r
+               },\r
+               plugins: {},\r
+               ui: function() {\r
+                       return {\r
+                               instance: this,\r
+                               axis: this.options.axis,\r
+                               options: this.options\r
+                       };\r
+               },\r
+               propagate: function(n,e) {\r
+                       $.ui.plugin.call(this, n, [e, this.ui()]);\r
+                       this.element.triggerHandler(n == "resize" ? n : ["resize", n].join(""), [e, this.ui()], this.options[n]);\r
+               },\r
+               destroy: function() {\r
+                       var el = this.element, wrapped = el.children(".ui-resizable").get(0),\r
+                       \r
+                       _destroy = function(exp) {\r
+                               $(exp).removeClass("ui-resizable ui-resizable-disabled")\r
+                                       .mouse("destroy").removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();\r
+                       };\r
+                       \r
+                       _destroy(el);\r
+                       \r
+                       if (el.is('.ui-wrapper') && wrapped) {\r
+                               el.parent().append(\r
+                                       $(wrapped).css({\r
+                                               position: el.css('position'),\r
+                                               width: el.outerWidth(),\r
+                                               height: el.outerHeight(),\r
+                                               top: el.css('top'),\r
+                                               left: el.css('left')\r
+                                       })\r
+                               ).end().remove();\r
+                               \r
+                               _destroy(wrapped);\r
+                       }\r
+               },\r
+               enable: function() {\r
+                       this.element.removeClass("ui-resizable-disabled");\r
+                       this.disabled = false;\r
+               },\r
+               disable: function() {\r
+                       this.element.addClass("ui-resizable-disabled");\r
+                       this.disabled = true;\r
+               },\r
+               start: function(e) {\r
+                       var o = this.options, iniPos = this.element.position(), el = this.element, \r
+                               num = function(v) { return parseInt(v, 10) || 0; }, ie6 = $.browser.msie && $.browser.version < 7;\r
+                       o.resizing = true;\r
+                       o.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };\r
+       \r
+                       // bugfix #1749\r
+                       if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {\r
+                               \r
+                               // sOffset decides if document scrollOffset will be added to the top/left of the resizable element\r
+                               var sOffset = $.browser.msie && !o.containment && (/absolute/).test(el.css('position')) && !(/relative/).test(el.parent().css('position'));\r
+                               var dscrollt = sOffset ? o.documentScroll.top : 0, dscrolll = sOffset ? o.documentScroll.left : 0;\r
+                               \r
+                               el.css({ position: 'absolute', top: (iniPos.top + dscrollt), left: (iniPos.left + dscrolll) });\r
+                       }\r
+                       \r
+                       //Opera fixing relative position\r
+                       if (/relative/.test(el.css('position')) && $.browser.opera)\r
+                               el.css({ position: 'relative', top: 'auto', left: 'auto' });\r
+       \r
+                       this._renderProxy();\r
+       \r
+                       var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));\r
+                       \r
+                       //Store needed variables\r
+                       this.offset = this.helper.offset();\r
+                       this.position = { left: curleft, top: curtop };\r
+                       this.size = o.proxy || ie6 ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };\r
+                       this.originalSize = o.proxy || ie6 ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };\r
+                       this.originalPosition = { left: curleft, top: curtop };\r
+                       this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };\r
+                       this.originalMousePosition = { left: e.pageX, top: e.pageY };\r
+                       \r
+                       //Aspect Ratio\r
+                       o.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.height / this.originalSize.width)||1);\r
+       \r
+                       if (o.preserveCursor)\r
+                               $('body').css('cursor', this.axis + '-resize');\r
+                               \r
+                       this.propagate("start", e);\r
+                       return false;\r
+               },\r
+               stop: function(e) {\r
+                       this.options.resizing = false;\r
+                       var o = this.options, num = function(v) { return parseInt(v, 10) || 0; }, self = this;\r
+       \r
+                       if(o.proxy) {\r
+                               var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName), \r
+                                                       soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,\r
+                                                               soffsetw = ista ? 0 : self.sizeDiff.width;\r
+                       \r
+                               var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },\r
+                                       left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, \r
+                                       top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;\r
+                               \r
+                               if (!o.animate)\r
+                                       this.element.css($.extend(s, { top: top, left: left }));\r
+                               \r
+                               if (o.proxy && !o.animate) this._proportionallyResize();\r
+                               this.helper.remove();\r
+                       }\r
+\r
+                       if (o.preserveCursor)\r
+                       $('body').css('cursor', 'auto');\r
+       \r
+                       this.propagate("stop", e);      \r
+                       return false;\r
+               },\r
+               drag: function(e) {\r
+                       //Increase performance, avoid regex\r
+                       var el = this.helper, o = this.options, props = {},\r
+                               self = this, smp = this.originalMousePosition, a = this.axis;\r
+\r
+                       var dx = (e.pageX-smp.left)||0, dy = (e.pageY-smp.top)||0;\r
+                       var trigger = this._change[a];\r
+                       if (!trigger) return false;\r
+                       \r
+                       // Calculate the attrs that will be change\r
+                       var data = trigger.apply(this, [e, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;\r
+                       \r
+                       if (o._aspectRatio || e.shiftKey)\r
+                               data = this._updateRatio(data, e);\r
+                       \r
+                       data = this._respectSize(data, e);\r
+                       \r
+                       this.propagate("resize", e);\r
+                       \r
+                       el.css({\r
+                               top: this.position.top + "px", left: this.position.left + "px", \r
+                               width: this.size.width + "px", height: this.size.height + "px"\r
+                       });\r
+                       \r
+                       if (!o.proxy && o.proportionallyResize)\r
+                               this._proportionallyResize();\r
+                       \r
+                       this._updateCache(data);\r
+                       \r
+                       return false;\r
+               },\r
+               _updateCache: function(data) {\r
+                       var o = this.options;\r
+                       this.offset = this.helper.offset();\r
+                       if (data.left) this.position.left = data.left;\r
+                       if (data.top) this.position.top = data.top;\r
+                       if (data.height) this.size.height = data.height;\r
+                       if (data.width) this.size.width = data.width;\r
+               },\r
+               _updateRatio: function(data, e) {\r
+                       var o = this.options, cpos = this.position, csize = this.size, a = this.axis;\r
+                       \r
+                       if (data.height) data.width = (csize.height / o.aspectRatio);\r
+                       else if (data.width) data.height = (csize.width * o.aspectRatio);\r
+                       \r
+                       if (a == 'sw') {\r
+                               data.left = cpos.left + (csize.width - data.width);\r
+                               data.top = null;\r
+                       }\r
+                       if (a == 'nw') { \r
+                               data.top = cpos.top + (csize.height - data.height);\r
+                               data.left = cpos.left + (csize.width - data.width);\r
+                       }\r
+                       \r
+                       return data;\r
+               },\r
+               _respectSize: function(data, e) {\r
+                       \r
+                       var el = this.helper, o = this.options, pRatio = o._aspectRatio || e.shiftKey, a = this.axis, \r
+                                       ismaxw = data.width && o.maxWidth && o.maxWidth < data.width, ismaxh = data.height && o.maxHeight && o.maxHeight < data.height,\r
+                                               isminw = data.width && o.minWidth && o.minWidth > data.width, isminh = data.height && o.minHeight && o.minHeight > data.height;\r
+                       \r
+                       if (isminw) data.width = o.minWidth;\r
+                       if (isminh) data.height = o.minHeight;\r
+                       if (ismaxw) data.width = o.maxWidth;\r
+                       if (ismaxh) data.height = o.maxHeight;\r
+                       \r
+                       var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;\r
+                       var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);\r
+                       \r
+                       if (isminw && cw) data.left = dw - o.minWidth;\r
+                       if (ismaxw && cw) data.left = dw - o.maxWidth;\r
+                       if (isminh && ch)       data.top = dh - o.minHeight;\r
+                       if (ismaxh && ch)       data.top = dh - o.maxHeight;\r
+                       \r
+                       // fixing jump error on top/left - bug #2330\r
+                       var isNotwh = !data.width && !data.height;\r
+                       if (isNotwh && !data.left && data.top) data.top = null;\r
+                       else if (isNotwh && !data.top && data.left) data.left = null;\r
+                       \r
+                       return data;\r
+               },\r
+               _proportionallyResize: function() {\r
+                       var o = this.options;\r
+                       if (!o.proportionallyResize) return;\r
+                       var prel = o.proportionallyResize, el = this.helper || this.element;\r
+                       \r
+                       if (!o.borderDif) {\r
+                               var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],\r
+                                       p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];\r
+                               \r
+                               o.borderDif = $.map(b, function(v, i) {\r
+                                       var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;\r
+                                       return border + padding; \r
+                               });\r
+                       }\r
+                       prel.css({\r
+                               height: (el.height() - o.borderDif[0] - o.borderDif[2]) + "px",\r
+                               width: (el.width() - o.borderDif[1] - o.borderDif[3]) + "px"\r
+                       });\r
+               },\r
+               _renderProxy: function() {\r
+                       var el = this.element, o = this.options;\r
+                       this.elementOffset = el.offset();\r
+       \r
+                       if(o.proxy) {\r
+                               this.helper = this.helper || $('<div style="overflow:hidden;"></div>');\r
+       \r
+                               // fix ie6 offset\r
+                               var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),\r
+                               pxyoffset = ( ie6 ? 2 : -1 );\r
+       \r
+                               this.helper.addClass(o.proxy).css({\r
+                                       width: el.outerWidth() + pxyoffset,\r
+                                       height: el.outerHeight() + pxyoffset,\r
+                                       position: 'absolute',\r
+                                       left: this.elementOffset.left - ie6offset +'px',\r
+                                       top: this.elementOffset.top - ie6offset +'px',\r
+                                       zIndex: ++o.zIndex\r
+                               });\r
+                               \r
+                               this.helper.appendTo("body");\r
+       \r
+                               if (o.disableSelection)\r
+                                       $.ui.disableSelection(this.helper.get(0));\r
+       \r
+                       } else {\r
+                               this.helper = el; \r
+                       }\r
+               },\r
+               _change: {\r
+                       e: function(e, dx, dy) {\r
+                               return { width: this.originalSize.width + dx };\r
+                       },\r
+                       w: function(e, dx, dy) {\r
+                               var o = this.options, cs = this.originalSize, sp = this.originalPosition;\r
+                               return { left: sp.left + dx, width: cs.width - dx };\r
+                       },\r
+                       n: function(e, dx, dy) {\r
+                               var o = this.options, cs = this.originalSize, sp = this.originalPosition;\r
+                               return { top: sp.top + dy, height: cs.height - dy };\r
+                       },\r
+                       s: function(e, dx, dy) {\r
+                               return { height: this.originalSize.height + dy };\r
+                       },\r
+                       se: function(e, dx, dy) {\r
+                               return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [e, dx, dy]));\r
+                       },\r
+                       sw: function(e, dx, dy) {\r
+                               return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [e, dx, dy]));\r
+                       },\r
+                       ne: function(e, dx, dy) {\r
+                               return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [e, dx, dy]));\r
+                       },\r
+                       nw: function(e, dx, dy) {\r
+                               return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [e, dx, dy]));\r
+                       }\r
+               }\r
+       });\r
+       \r
+       $.extend($.ui.resizable, {\r
+               defaults: {\r
+                       preventDefault: true,\r
+                       transparent: false,\r
+                       minWidth: 10,\r
+                       minHeight: 10,\r
+                       aspectRatio: false,\r
+                       disableSelection: true,\r
+                       preserveCursor: true,\r
+                       autohide: false,\r
+                       knobHandles: false\r
+               }\r
+       });\r
+\r
+/*\r
+ * Resizable Extensions\r
+ */\r
+\r
+       $.ui.plugin.add("resizable", "containment", {\r
+               \r
+               start: function(e, ui) {\r
+                       var o = ui.options, self = ui.instance, el = self.element;\r
+                       var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;\r
+                       if (!ce) return;\r
+                       \r
+                       if (/document/.test(oc) || oc == document) {\r
+                               self.containerOffset = { left: 0, top: 0 };\r
+\r
+                               self.parentData = { \r
+                                       element: $(document), left: 0, top: 0, width: $(document).width(),\r
+                                       height: $(document).height() || document.body.parentNode.scrollHeight\r
+                               };\r
+                       }\r
+                       \r
+                       // i'm a node, so compute top, left, right, bottom\r
+                       else{\r
+                               self.containerOffset = $(ce).offset();\r
+                               self.containerSize = { height: $(ce).innerHeight(), width: $(ce).innerWidth() };\r
+                       \r
+                               var co = self.containerOffset, ch = self.containerSize.height,  cw = self.containerSize.width, \r
+                                                       width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);\r
+                       \r
+                               self.parentData = { \r
+                                       element: ce, left: co.left, top: co.top, width: width, height: height\r
+                               };\r
+                       }\r
+               },\r
+               \r
+               resize: function(e, ui) {\r
+                       var o = ui.options, self = ui.instance, ps = self.containerSize, \r
+                                               co = self.containerOffset, cs = self.size, cp = self.position,\r
+                                                       pRatio = o._aspectRatio || e.shiftKey;\r
+                       \r
+                       if (cp.left < (o.proxy ? co.left : 0)) {\r
+                               self.size.width = self.size.width + (o.proxy ? (self.position.left - co.left) : self.position.left);\r
+                               if (pRatio) self.size.height = self.size.width * o.aspectRatio;\r
+                               self.position.left = o.proxy ? co.left : 0;\r
+                       }\r
+                       \r
+                       if (cp.top < (o.proxy ? co.top : 0)) {\r
+                               self.size.height = self.size.height + (o.proxy ? (self.position.top - co.top) : self.position.top);\r
+                               if (pRatio) self.size.width = self.size.height / o.aspectRatio;\r
+                               self.position.top = o.proxy ? co.top : 0;\r
+                       }\r
+                       \r
+                       var woset = (o.proxy ? self.offset.left - co.left : self.position.left) + self.sizeDiff.width, \r
+                                               hoset = (o.proxy ? self.offset.top - co.top : self.position.top) + self.sizeDiff.height;\r
+                       \r
+                       if (woset + self.size.width >= self.parentData.width) {\r
+                               self.size.width = self.parentData.width - woset;\r
+                               if (pRatio) self.size.height = self.size.width * o.aspectRatio;\r
+                       }\r
+                       \r
+                       if (hoset + self.size.height >= self.parentData.height) {\r
+                               self.size.height = self.parentData.height - hoset;\r
+                               if (pRatio) self.size.width = self.size.height / o.aspectRatio;\r
+                       }\r
+               }\r
+       });\r
+       \r
+       $.ui.plugin.add("resizable", "grid", {\r
+               \r
+               resize: function(e, ui) {\r
+                       var o = ui.options, self = ui.instance, cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || e.shiftKey;\r
+                       o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;\r
+                       var ox = Math.round((cs.width - os.width) / o.grid[0]) * o.grid[0], oy = Math.round((cs.height - os.height) / o.grid[1]) * o.grid[1];\r
+                       \r
+                       if (/^(se|s|e)$/.test(a)) {\r
+                               self.size.width = os.width + ox;\r
+                               self.size.height = os.height + oy;\r
+                       }\r
+                       else if (/^(ne)$/.test(a)) {\r
+                               self.size.width = os.width + ox;\r
+                               self.size.height = os.height + oy;\r
+                               self.position.top = op.top - oy;\r
+                       }\r
+                       else if (/^(sw)$/.test(a)) {\r
+                               self.size.width = os.width + ox;\r
+                               self.size.height = os.height + oy;\r
+                               self.position.left = op.left - ox;\r
+                       }\r
+                       else {\r
+                               self.size.width = os.width + ox;\r
+                               self.size.height = os.height + oy;\r
+                               self.position.top = op.top - oy;\r
+                               self.position.left = op.left - ox;\r
+                       }\r
+               }\r
+               \r
+       });\r
+       \r
+       $.ui.plugin.add("resizable", "animate", {\r
+               \r
+               stop: function(e, ui) {\r
+                       var o = ui.options, self = ui.instance;\r
+\r
+                       var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName), \r
+                                                       soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,\r
+                                                               soffsetw = ista ? 0 : self.sizeDiff.width;\r
+                       \r
+                       var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },\r
+                                               left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, \r
+                                                       top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; \r
+                       \r
+                       self.element.animate(\r
+                               $.extend(style, top && left ? { top: top, left: left } : {}), { \r
+                                       duration: o.animateDuration || "slow", easing: o.animateEasing || "swing", \r
+                                       step: function() {\r
+                                               \r
+                                               var data = {\r
+                                                       width: parseInt(self.element.css('width'), 10),\r
+                                                       height: parseInt(self.element.css('height'), 10),\r
+                                                       top: parseInt(self.element.css('top'), 10),\r
+                                                       left: parseInt(self.element.css('left'), 10)\r
+                                               };\r
+                                               \r
+                                               if (pr) pr.css({ width: data.width, height: data.height });\r
+                                               \r
+                                               // propagating resize, and updating values for each animation step\r
+                                               self._updateCache(data);\r
+                                               self.propagate("animate", e);\r
+                                               \r
+                                       }\r
+                               }\r
+                       );\r
+               }\r
+               \r
+       });\r
+       \r
+       $.ui.plugin.add("resizable", "ghost", {\r
+               \r
+               start: function(e, ui) {\r
+                       var o = ui.options, self = ui.instance, pr = o.proportionallyResize, cs = self.size;\r
+                       \r
+                       if (!pr) self.ghost = self.element.clone();\r
+                       else self.ghost = pr.clone();\r
+                       \r
+                       self.ghost.css(\r
+                               { opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }\r
+                       )\r
+                       .addClass('ui-resizable-ghost').addClass(typeof o.ghost == 'string' ? o.ghost : '');\r
+                       \r
+                       self.ghost.appendTo(self.helper);\r
+                       \r
+               },\r
+               \r
+               resize: function(e, ui){\r
+                       var o = ui.options, self = ui.instance, pr = o.proportionallyResize;\r
+                       \r
+                       if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });\r
+                       \r
+               },\r
+               \r
+               stop: function(e, ui){\r
+                       var o = ui.options, self = ui.instance, pr = o.proportionallyResize;\r
+                       if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));\r
+               }\r
+               \r
+       });\r
+       \r
+       $.ui.plugin.add("resizable", "alsoResize", {\r
+               \r
+               start: function(e, ui) {\r
+                       var o = ui.options, self = ui.instance, \r
+                       \r
+                       _store = function(exp) {\r
+                               $(exp).each(function() {\r
+                                       $(this).data("resizable-alsoresize-start", {\r
+                                               width: parseInt($(this).css('width'), 10), height: parseInt($(this).css('height'), 10),\r
+                                               left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10)\r
+                                       });\r
+                               });\r
+                       };\r
+                       \r
+                       if (typeof(o.alsoResize) == 'object') {\r
+                               $.each(o.alsoResize, function(exp, c) { _store(exp); });\r
+                       }else{\r
+                               _store(o.alsoResize);\r
+                       } \r
+               },\r
+               \r
+               resize: function(e, ui){\r
+                       var o = ui.options, self = ui.instance, os = self.originalSize, op = self.originalPosition;\r
+                       \r
+                       var delta = { \r
+                               height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,\r
+                               top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0\r
+                       },\r
+                       \r
+                       _alsoResize = function(exp, c) {\r
+                               $(exp).each(function() {\r
+                                       var start = $(this).data("resizable-alsoresize-start"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left'];\r
+                                       \r
+                                       $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) {\r
+                                               style[prop] = (start[prop] + delta[prop]) || null\r
+                                       });\r
+                                       \r
+                                       $(this).css(style);\r
+                               });\r
+                       };\r
+                       \r
+                       if (typeof(o.alsoResize) == 'object') {\r
+                               $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); });\r
+                       }else{\r
+                               _alsoResize(o.alsoResize);\r
+                       }\r
+               },\r
+               \r
+               stop: function(e, ui){\r
+                       $(this).removeData("resizable-alsoresize-start");\r
+               }\r
+       });\r
+\r
+})(jQuery);\r
diff --git a/ui/source/ui.selectable.js b/ui/source/ui.selectable.js
new file mode 100644 (file)
index 0000000..1e4aa84
--- /dev/null
@@ -0,0 +1,272 @@
+/*\r
+ * jQuery UI Selectable\r
+ *\r
+ * Copyright (c) 2008 Richard D. Worth (rdworth.org)\r
+ * Dual licensed under the MIT (MIT-LICENSE.txt)\r
+ * and GPL (GPL-LICENSE.txt) licenses.\r
+ * \r
+ * http://docs.jquery.com/UI/Selectables\r
+ *\r
+ * Depends:\r
+ *     ui.core.js\r
+ *\r
+ * Revision: $Id: ui.selectable.js 5581 2008-05-13 16:58:03Z scott.gonzalez $\r
+ */\r
+;(function($) {\r
+\r
+       $.widget("ui.selectable", {\r
+               init: function() {\r
+                       var instance = this;\r
+                       \r
+                       this.element.addClass("ui-selectable");\r
+                       \r
+                       this.dragged = false;\r
+       \r
+                       // cache selectee children based on filter\r
+                       var selectees;\r
+                       this.refresh = function() {\r
+                               selectees = $(instance.options.filter, instance.element[0]);\r
+                               selectees.each(function() {\r
+                                       var $this = $(this);\r
+                                       var pos = $this.offset();\r
+                                       $.data(this, "selectable-item", {\r
+                                               element: this,\r
+                                               $element: $this,\r
+                                               left: pos.left,\r
+                                               top: pos.top,\r
+                                               right: pos.left + $this.width(),\r
+                                               bottom: pos.top + $this.height(),\r
+                                               startselected: false,\r
+                                               selected: $this.hasClass('ui-selected'),\r
+                                               selecting: $this.hasClass('ui-selecting'),\r
+                                               unselecting: $this.hasClass('ui-unselecting')\r
+                                       });\r
+                               });\r
+                       };\r
+                       this.refresh();\r
+       \r
+                       this.selectees = selectees.addClass("ui-selectee");\r
+       \r
+                       //Initialize mouse interaction\r
+                       this.element.mouse({\r
+                               executor: this,\r
+                               appendTo: 'body',\r
+                               delay: 0,\r
+                               distance: 0,\r
+                               dragPrevention: ['input','textarea','button','select','option'],\r
+                               start: this.start,\r
+                               stop: this.stop,\r
+                               drag: this.drag,\r
+                               condition: function(e) {\r
+                                       var isSelectee = false;\r
+                                       $(e.target).parents().andSelf().each(function() {\r
+                                               if($.data(this, "selectable-item")) isSelectee = true;\r
+                                       });\r
+                                       return this.options.keyboard ? !isSelectee : true;\r
+                               }\r
+                       });\r
+                       \r
+                       this.helper = $(document.createElement('div')).css({border:'1px dotted black'});\r
+               },\r
+               toggle: function() {\r
+                       if(this.disabled){\r
+                               this.enable();\r
+                       } else {\r
+                               this.disable();\r
+                       }\r
+               },\r
+               destroy: function() {\r
+                       this.element\r
+                               .removeClass("ui-selectable ui-selectable-disabled")\r
+                               .removeData("selectable")\r
+                               .unbind(".selectable")\r
+                               .mouse("destroy");\r
+               },\r
+               enable: function() {\r
+                       this.element.removeClass("ui-selectable-disabled");\r
+                       this.disabled = false;\r
+               },\r
+               disable: function() {\r
+                       this.element.addClass("ui-selectable-disabled");\r
+                       this.disabled = true;\r
+               },\r
+               start: function(ev, element) {\r
+                       \r
+                       this.opos = [ev.pageX, ev.pageY];\r
+                       \r
+                       if (this.disabled)\r
+                               return;\r
+\r
+                       var options = this.options;\r
+\r
+                       this.selectees = $(options.filter, element);\r
+\r
+                       // selectable START callback\r
+                       this.element.triggerHandler("selectablestart", [ev, {\r
+                               "selectable": element,\r
+                               "options": options\r
+                       }], options.start);\r
+\r
+                       $('body').append(this.helper);\r
+                       // position helper (lasso)\r
+                       this.helper.css({\r
+                               "z-index": 100,\r
+                               "position": "absolute",\r
+                               "left": ev.clientX,\r
+                               "top": ev.clientY,\r
+                               "width": 0,\r
+                               "height": 0\r
+                       });\r
+\r
+                       if (options.autoRefresh) {\r
+                               this.refresh();\r
+                       }\r
+\r
+                       this.selectees.filter('.ui-selected').each(function() {\r
+                               var selectee = $.data(this, "selectable-item");\r
+                               selectee.startselected = true;\r
+                               if (!ev.ctrlKey) {\r
+                                       selectee.$element.removeClass('ui-selected');\r
+                                       selectee.selected = false;\r
+                                       selectee.$element.addClass('ui-unselecting');\r
+                                       selectee.unselecting = true;\r
+                                       // selectable UNSELECTING callback\r
+                                       $(this.element).triggerHandler("selectableunselecting", [ev, {\r
+                                               selectable: element,\r
+                                               unselecting: selectee.element,\r
+                                               options: options\r
+                                       }], options.unselecting);\r
+                               }\r
+                       });\r
+               },\r
+               drag: function(ev, element) {\r
+                       this.dragged = true;\r
+                       \r
+                       if (this.disabled)\r
+                               return;\r
+\r
+                       var options = this.options;\r
+\r
+                       var x1 = this.opos[0], y1 = this.opos[1], x2 = ev.pageX, y2 = ev.pageY;\r
+                       if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }\r
+                       if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }\r
+                       this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});\r
+\r
+                       this.selectees.each(function() {\r
+                               var selectee = $.data(this, "selectable-item");\r
+                               //prevent helper from being selected if appendTo: selectable\r
+                               if (!selectee || selectee.element == element)\r
+                                       return;\r
+                               var hit = false;\r
+                               if (options.tolerance == 'touch') {\r
+                                       hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );\r
+                               } else if (options.tolerance == 'fit') {\r
+                                       hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);\r
+                               }\r
+\r
+                               if (hit) {\r
+                                       // SELECT\r
+                                       if (selectee.selected) {\r
+                                               selectee.$element.removeClass('ui-selected');\r
+                                               selectee.selected = false;\r
+                                       }\r
+                                       if (selectee.unselecting) {\r
+                                               selectee.$element.removeClass('ui-unselecting');\r
+                                               selectee.unselecting = false;\r
+                                       }\r
+                                       if (!selectee.selecting) {\r
+                                               selectee.$element.addClass('ui-selecting');\r
+                                               selectee.selecting = true;\r
+                                               // selectable SELECTING callback\r
+                                               $(this.element).triggerHandler("selectableselecting", [ev, {\r
+                                                       selectable: element,\r
+                                                       selecting: selectee.element,\r
+                                                       options: options\r
+                                               }], options.selecting);\r
+                                       }\r
+                               } else {\r
+                                       // UNSELECT\r
+                                       if (selectee.selecting) {\r
+                                               if (ev.ctrlKey && selectee.startselected) {\r
+                                                       selectee.$element.removeClass('ui-selecting');\r
+                                                       selectee.selecting = false;\r
+                                                       selectee.$element.addClass('ui-selected');\r
+                                                       selectee.selected = true;\r
+                                               } else {\r
+                                                       selectee.$element.removeClass('ui-selecting');\r
+                                                       selectee.selecting = false;\r
+                                                       if (selectee.startselected) {\r
+                                                               selectee.$element.addClass('ui-unselecting');\r
+                                                               selectee.unselecting = true;\r
+                                                       }\r
+                                                       // selectable UNSELECTING callback\r
+                                                       $(this.element).triggerHandler("selectableunselecting", [ev, {\r
+                                                               selectable: element,\r
+                                                               unselecting: selectee.element,\r
+                                                               options: options\r
+                                                       }], options.unselecting);\r
+                                               }\r
+                                       }\r
+                                       if (selectee.selected) {\r
+                                               if (!ev.ctrlKey && !selectee.startselected) {\r
+                                                       selectee.$element.removeClass('ui-selected');\r
+                                                       selectee.selected = false;\r
+\r
+                                                       selectee.$element.addClass('ui-unselecting');\r
+                                                       selectee.unselecting = true;\r
+                                                       // selectable UNSELECTING callback\r
+                                                       $(this.element).triggerHandler("selectableunselecting", [ev, {\r
+                                                               selectable: element,\r
+                                                               unselecting: selectee.element,\r
+                                                               options: options\r
+                                                       }], options.unselecting);\r
+                                               }\r
+                                       }\r
+                               }\r
+                       });\r
+               },\r
+               stop: function(ev, element) {\r
+                       this.dragged = false;\r
+                       \r
+                       var options = this.options;\r
+\r
+                       $('.ui-unselecting', this.element).each(function() {\r
+                               var selectee = $.data(this, "selectable-item");\r
+                               selectee.$element.removeClass('ui-unselecting');\r
+                               selectee.unselecting = false;\r
+                               selectee.startselected = false;\r
+                               $(this.element).triggerHandler("selectableunselected", [ev, {\r
+                                       selectable: element,\r
+                                       unselected: selectee.element,\r
+                                       options: options\r
+                               }], options.unselected);\r
+                       });\r
+                       $('.ui-selecting', this.element).each(function() {\r
+                               var selectee = $.data(this, "selectable-item");\r
+                               selectee.$element.removeClass('ui-selecting').addClass('ui-selected');\r
+                               selectee.selecting = false;\r
+                               selectee.selected = true;\r
+                               selectee.startselected = true;\r
+                               $(this.element).triggerHandler("selectableselected", [ev, {\r
+                                       selectable: element,\r
+                                       selected: selectee.element,\r
+                                       options: options\r
+                               }], options.selected);\r
+                       });\r
+                       $(this.element).triggerHandler("selectablestop", [ev, {\r
+                               selectable: element,\r
+                               options: this.options\r
+                       }], this.options.stop);\r
+                       \r
+                       this.helper.remove();\r
+               }\r
+       });\r
+       \r
+       $.ui.selectable.defaults = {\r
+               appendTo: 'body',\r
+               autoRefresh: true,\r
+               filter: '*',\r
+               tolerance: 'touch'\r
+       };\r
+       \r
+})(jQuery);\r
diff --git a/ui/source/ui.slider.js b/ui/source/ui.slider.js
new file mode 100644 (file)
index 0000000..15cba68
--- /dev/null
@@ -0,0 +1,417 @@
+/*\r
+ * jQuery UI Slider\r
+ *\r
+ * Copyright (c) 2008 Paul Bakaus\r
+ * Dual licensed under the MIT (MIT-LICENSE.txt)\r
+ * and GPL (GPL-LICENSE.txt) licenses.\r
+ * \r
+ * http://docs.jquery.com/UI/Slider\r
+ *\r
+ * Depends:\r
+ *     ui.core.js\r
+ *\r
+ * Revision: $Id: ui.slider.js 5539 2008-05-09 16:48:33Z paul.bakaus $\r
+ */\r
+;(function($) {\r
+\r
+       $.fn.unwrap = $.fn.unwrap || function(expr) {\r
+         return this.each(function(){\r
+            $(this).parents(expr).eq(0).after(this).remove();\r
+         });\r
+       };\r
+\r
+       $.widget("ui.slider", {\r
+               plugins: {},\r
+               ui: function(e) {\r
+                       return {\r
+                               instance: this,\r
+                               options: this.options,\r
+                               handle: this.currentHandle,\r
+                               value: this.options.axis != "both" || !this.options.axis ? Math.round(this.value(null,this.options.axis == "vertical" ? "y" : "x")) : {\r
+                                       x: Math.round(this.value(null,"x")),\r
+                                       y: Math.round(this.value(null,"y"))\r
+                               },\r
+                               range: this.getRange()\r
+                       };\r
+               },\r
+               propagate: function(n,e) {\r
+                       $.ui.plugin.call(this, n, [e, this.ui()]);\r
+                       this.element.triggerHandler(n == "slide" ? n : "slide"+n, [e, this.ui()], this.options[n]);\r
+               },\r
+               destroy: function() {\r
+                       this.element\r
+                               .removeClass("ui-slider ui-slider-disabled")\r
+                               .removeData("slider")\r
+                               .unbind(".slider");\r
+                       this.handle\r
+                               .unwrap("a")\r
+                               .mouse("destroy");\r
+                       this.generated && this.generated.remove();\r
+               },\r
+               enable: function() {\r
+                       this.element.removeClass("ui-slider-disabled");\r
+                       this.disabled = false;\r
+               },\r
+               disable: function() {\r
+                       this.element.addClass("ui-slider-disabled");\r
+                       this.disabled = true;\r
+               },\r
+               setData: function(key, value) {\r
+                       this.options[key] = value;\r
+                       if (/min|max|steps/.test(key)) {\r
+                               this.initBoundaries();\r
+                       }\r
+               },\r
+\r
+               init: function() {\r
+                       \r
+                       var self = this;\r
+                       this.element.addClass("ui-slider");\r
+                       this.initBoundaries();\r
+                       \r
+                       // Initialize mouse and key events for interaction\r
+                       this.handle = $(this.options.handle, this.element);\r
+                       if (!this.handle.length) {\r
+                               self.handle = self.generated = $(self.options.handles || [0]).map(function() {\r
+                                       var handle = $("<div/>").addClass("ui-slider-handle").appendTo(self.element);\r
+                                       if (this.id)\r
+                                               handle.attr("id", this.id);\r
+                                       return handle[0];\r
+                               });\r
+                       }\r
+                       \r
+                       $(this.handle)\r
+                               .mouse({\r
+                                       executor: this,\r
+                                       delay: this.options.delay,\r
+                                       distance: this.options.distance,\r
+                                       dragPrevention: this.options.prevention ? this.options.prevention.toLowerCase().split(',') : ['input','textarea','button','select','option'],\r
+                                       start: this.start,\r
+                                       stop: this.stop,\r
+                                       drag: this.drag,\r
+                                       condition: function(e, handle) {\r
+                                               if(!this.disabled) {\r
+                                                       if(this.currentHandle) this.blur(this.currentHandle);\r
+                                                       this.focus(handle,1);\r
+                                                       return !this.disabled;\r
+                                               }\r
+                                       }\r
+                               })\r
+                               .wrap('<a href="javascript:void(0)" style="cursor:default;"></a>')\r
+                               .parent()\r
+                                       .bind('focus', function(e) { self.focus(this.firstChild); })\r
+                                       .bind('blur', function(e) { self.blur(this.firstChild); })\r
+                                       .bind('keydown', function(e) { self.keydown(e.keyCode, this.firstChild); })\r
+                       ;\r
+                       \r
+                       // Bind the click to the slider itself\r
+                       this.element.bind('mousedown.slider', function(e) {\r
+                               self.click.apply(self, [e]);\r
+                               self.currentHandle.data("mouse").trigger(e);\r
+                               self.firstValue = self.firstValue + 1; //This is for always triggering the change event\r
+                       });\r
+                       \r
+                       // Move the first handle to the startValue\r
+                       $.each(this.options.handles || [], function(index, handle) {\r
+                               self.moveTo(handle.start, index, true);\r
+                       });\r
+                       if (!isNaN(this.options.startValue))\r
+                               this.moveTo(this.options.startValue, 0, true);\r
+\r
+                       this.previousHandle = $(this.handle[0]); //set the previous handle to the first to allow clicking before selecting the handle\r
+                       if(this.handle.length == 2 && this.options.range) this.createRange();\r
+               },\r
+               initBoundaries: function() {\r
+                       \r
+                       var element = this.element[0], o = this.options;\r
+                       this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };                    \r
+                       \r
+                       $.extend(o, {\r
+                               axis: o.axis || (element.offsetWidth < element.offsetHeight ? 'vertical' : 'horizontal'),\r
+                               max: !isNaN(parseInt(o.max,10)) ? { x: parseInt(o.max, 10), y: parseInt(o.max, 10) } : ({ x: o.max && o.max.x || 100, y: o.max && o.max.y || 100 }),\r
+                               min: !isNaN(parseInt(o.min,10)) ? { x: parseInt(o.min, 10), y: parseInt(o.min, 10) } : ({ x: o.min && o.min.x || 0, y: o.min && o.min.y || 0 })\r
+                       });\r
+                       //Prepare the real maxValue\r
+                       o.realMax = {\r
+                               x: o.max.x - o.min.x,\r
+                               y: o.max.y - o.min.y\r
+                       };\r
+                       //Calculate stepping based on steps\r
+                       o.stepping = {\r
+                               x: o.stepping && o.stepping.x || parseInt(o.stepping, 10) || (o.steps ? o.realMax.x/(o.steps.x || parseInt(o.steps, 10) || o.realMax.x) : 0),\r
+                               y: o.stepping && o.stepping.y || parseInt(o.stepping, 10) || (o.steps ? o.realMax.y/(o.steps.y || parseInt(o.steps, 10) || o.realMax.y) : 0)\r
+                       };\r
+               },\r
+\r
+               \r
+               keydown: function(keyCode, handle) {\r
+                       if(/(37|38|39|40)/.test(keyCode)) {\r
+                               this.moveTo({\r
+                                       x: /(37|39)/.test(keyCode) ? (keyCode == 37 ? '-' : '+') + '=' + this.oneStep("x") : 0,\r
+                                       y: /(38|40)/.test(keyCode) ? (keyCode == 38 ? '-' : '+') + '=' + this.oneStep("y") : 0\r
+                               }, handle);\r
+                       }\r
+               },\r
+               focus: function(handle,hard) {\r
+                       this.currentHandle = $(handle).addClass('ui-slider-handle-active');\r
+                       if (hard)\r
+                               this.currentHandle.parent()[0].focus();\r
+               },\r
+               blur: function(handle) {\r
+                       $(handle).removeClass('ui-slider-handle-active');\r
+                       if(this.currentHandle && this.currentHandle[0] == handle) { this.previousHandle = this.currentHandle; this.currentHandle = null; };\r
+               },\r
+               click: function(e) {\r
+                       // This method is only used if:\r
+                       // - The user didn't click a handle\r
+                       // - The Slider is not disabled\r
+                       // - There is a current, or previous selected handle (otherwise we wouldn't know which one to move)\r
+                       \r
+                       var pointer = [e.pageX,e.pageY];\r
+                       \r
+                       var clickedHandle = false;\r
+                       this.handle.each(function() {\r
+                               if(this == e.target)\r
+                                       clickedHandle = true;\r
+                       });\r
+                       if (clickedHandle || this.disabled || !(this.currentHandle || this.previousHandle))\r
+                               return;\r
+\r
+                       // If a previous handle was focussed, focus it again\r
+                       if (!this.currentHandle && this.previousHandle)\r
+                               this.focus(this.previousHandle, true);\r
+                       \r
+                       // propagate only for distance > 0, otherwise propagation is done my drag\r
+                       this.offset = this.element.offset();\r
+\r
+                       this.moveTo({\r
+                               y: this.convertValue(e.pageY - this.offset.top - this.currentHandle[0].offsetHeight/2, "y"),\r
+                               x: this.convertValue(e.pageX - this.offset.left - this.currentHandle[0].offsetWidth/2, "x")\r
+                       }, null, !this.options.distance);\r
+               },\r
+               \r
+\r
+       \r
+               createRange: function() {\r
+                       this.rangeElement = $('<div></div>')\r
+                               .addClass('ui-slider-range')\r
+                               .css({ position: 'absolute' })\r
+                               .appendTo(this.element);\r
+                       this.updateRange();\r
+               },\r
+               updateRange: function() {\r
+                               var prop = this.options.axis == "vertical" ? "top" : "left";\r
+                               var size = this.options.axis == "vertical" ? "height" : "width";\r
+                               this.rangeElement.css(prop, parseInt($(this.handle[0]).css(prop),10) + this.handleSize(0, this.options.axis == "vertical" ? "y" : "x")/2);\r
+                               this.rangeElement.css(size, parseInt($(this.handle[1]).css(prop),10) - parseInt($(this.handle[0]).css(prop),10));\r
+               },\r
+               getRange: function() {\r
+                       return this.rangeElement ? this.convertValue(parseInt(this.rangeElement.css(this.options.axis == "vertical" ? "height" : "width"),10), this.options.axis == "vertical" ? "y" : "x") : null;\r
+               },\r
+\r
+               handleIndex: function() {\r
+                       return this.handle.index(this.currentHandle[0]);\r
+               },\r
+               value: function(handle, axis) {\r
+                       if(this.handle.length == 1) this.currentHandle = this.handle;\r
+                       if(!axis) axis = this.options.axis == "vertical" ? "y" : "x";\r
+\r
+                       var curHandle = $(handle != undefined && handle !== null ? this.handle[handle] || handle : this.currentHandle);\r
+                       \r
+                       if(curHandle.data("mouse").sliderValue) {\r
+                               return parseInt(curHandle.data("mouse").sliderValue[axis],10);\r
+                       } else {\r
+                               return parseInt(((parseInt(curHandle.css(axis == "x" ? "left" : "top"),10) / (this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(handle,axis))) * this.options.realMax[axis]) + this.options.min[axis],10);\r
+                       }\r
+\r
+               },\r
+               convertValue: function(value,axis) {\r
+                       return this.options.min[axis] + (value / (this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis))) * this.options.realMax[axis];\r
+               },\r
+               \r
+               translateValue: function(value,axis) {\r
+                       return ((value - this.options.min[axis]) / this.options.realMax[axis]) * (this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis));\r
+               },\r
+               translateRange: function(value,axis) {\r
+                       if (this.rangeElement) {\r
+                               if (this.currentHandle[0] == this.handle[0] && value >= this.translateValue(this.value(1),axis))\r
+                                       value = this.translateValue(this.value(1,axis) - this.oneStep(axis), axis);\r
+                               if (this.currentHandle[0] == this.handle[1] && value <= this.translateValue(this.value(0),axis))\r
+                                       value = this.translateValue(this.value(0,axis) + this.oneStep(axis));\r
+                       }\r
+                       if (this.options.handles) {\r
+                               var handle = this.options.handles[this.handleIndex()];\r
+                               if (value < this.translateValue(handle.min,axis)) {\r
+                                       value = this.translateValue(handle.min,axis);\r
+                               } else if (value > this.translateValue(handle.max,axis)) {\r
+                                       value = this.translateValue(handle.max,axis);\r
+                               }\r
+                       }\r
+                       return value;\r
+               },\r
+               translateLimits: function(value,axis) {\r
+                       if (value >= this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis))\r
+                               value = this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis);\r
+                       if (value <= 0)\r
+                               value = 0;\r
+                       return value;\r
+               },\r
+               handleSize: function(handle,axis) {\r
+                       return $(handle != undefined && handle !== null ? this.handle[handle] : this.currentHandle)[0]["offset"+(axis == "x" ? "Width" : "Height")];    \r
+               },\r
+               oneStep: function(axis) {\r
+                       return this.options.stepping[axis] || 1;\r
+               },\r
+\r
+\r
+               start: function(e, handle) {\r
+               \r
+                       var o = this.options;\r
+\r
+                       // Prepare the outer size\r
+                       this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };\r
+               \r
+                       // This is a especially ugly fix for strange blur events happening on mousemove events\r
+                       if (!this.currentHandle)\r
+                               this.focus(this.previousHandle, true); \r
+\r
+                       this.offset = this.element.offset();\r
+                       this.handleOffset = this.currentHandle.offset();\r
+                       this.clickOffset = { top: e.pageY - this.handleOffset.top, left: e.pageX - this.handleOffset.left };\r
+                       this.firstValue = this.value();\r
+                       \r
+                       this.propagate('start', e);\r
+                       return false;\r
+                                               \r
+               },\r
+               stop: function(e) {\r
+                       this.propagate('stop', e);\r
+                       if (this.firstValue != this.value())\r
+                               this.propagate('change', e);\r
+                       // This is a especially ugly fix for strange blur events happening on mousemove events\r
+                       this.focus(this.currentHandle, true);\r
+                       return false;\r
+               },\r
+               drag: function(e, handle) {\r
+\r
+                       var o = this.options;\r
+                       var position = { top: e.pageY - this.offset.top - this.clickOffset.top, left: e.pageX - this.offset.left - this.clickOffset.left};\r
+                       if(!this.currentHandle) this.focus(this.previousHandle, true); //This is a especially ugly fix for strange blur events happening on mousemove events\r
+\r
+                       position.left = this.translateLimits(position.left, "x");\r
+                       position.top = this.translateLimits(position.top, "y");\r
+                       \r
+                       if (o.stepping.x) {\r
+                               var value = this.convertValue(position.left, "x");\r
+                               value = Math.round(value / o.stepping.x) * o.stepping.x;\r
+                               position.left = this.translateValue(value, "x");        \r
+                       }\r
+                       if (o.stepping.y) {\r
+                               var value = this.convertValue(position.top, "y");\r
+                               value = Math.round(value / o.stepping.y) * o.stepping.y;\r
+                               position.top = this.translateValue(value, "y"); \r
+                       }\r
+                       \r
+                       position.left = this.translateRange(position.left, "x");\r
+                       position.top = this.translateRange(position.top, "y");\r
+\r
+                       if(o.axis != "vertical") this.currentHandle.css({ left: position.left });\r
+                       if(o.axis != "horizontal") this.currentHandle.css({ top: position.top });\r
+                       \r
+                       //Store the slider's value\r
+                       this.currentHandle.data("mouse").sliderValue = {\r
+                               x: this.convertValue(position.left, "x"),\r
+                               y: this.convertValue(position.top, "y")\r
+                       };\r
+                       \r
+                       if (this.rangeElement)\r
+                               this.updateRange();\r
+                       this.propagate('slide', e);\r
+                       return false;\r
+               },\r
+               \r
+               moveTo: function(value, handle, noPropagation) {\r
+\r
+                       var o = this.options;\r
+\r
+                       // Prepare the outer size\r
+                       this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };\r
+\r
+                       //If no handle has been passed, no current handle is available and we have multiple handles, return false\r
+                       if (handle == undefined && !this.currentHandle && this.handle.length != 1)\r
+                               return false; \r
+                       \r
+                       //If only one handle is available, use it\r
+                       if (handle == undefined && !this.currentHandle)\r
+                               handle = 0;\r
+                       \r
+                       if (handle != undefined)\r
+                               this.currentHandle = this.previousHandle = $(this.handle[handle] || handle);\r
+\r
+\r
+                       if(value.x !== undefined && value.y !== undefined) {\r
+                               var x = value.x, y = value.y;\r
+                       } else {\r
+                               var x = value, y = value;\r
+                       }\r
+\r
+                       if(x !== undefined && x.constructor != Number) {\r
+                               var me = /^\-\=/.test(x), pe = /^\+\=/.test(x);\r
+                               if(me || pe) {\r
+                                       x = this.value(null, "x") + parseInt(x.replace(me ? '=' : '+=', ''), 10);\r
+                               } else {\r
+                                       x = isNaN(parseInt(x, 10)) ? undefined : parseInt(x, 10);\r
+                               }\r
+                       }\r
+                       \r
+                       if(y !== undefined && y.constructor != Number) {\r
+                               var me = /^\-\=/.test(y), pe = /^\+\=/.test(y);\r
+                               if(me || pe) {\r
+                                       y = this.value(null, "y") + parseInt(y.replace(me ? '=' : '+=', ''), 10);\r
+                               } else {\r
+                                       y = isNaN(parseInt(y, 10)) ? undefined : parseInt(y, 10);\r
+                               }\r
+                       }\r
+\r
+                       if(o.axis != "vertical" && x !== undefined) {\r
+                               if(o.stepping.x) x = Math.round(x / o.stepping.x) * o.stepping.x;\r
+                               x = this.translateValue(x, "x");\r
+                               x = this.translateLimits(x, "x");\r
+                               x = this.translateRange(x, "x");\r
+                               this.currentHandle.css({ left: x });\r
+                       }\r
+\r
+                       if(o.axis != "horizontal" && y !== undefined) {\r
+                               if(o.stepping.y) y = Math.round(y / o.stepping.y) * o.stepping.y;\r
+                               y = this.translateValue(y, "y");\r
+                               y = this.translateLimits(y, "y");\r
+                               y = this.translateRange(y, "y");\r
+                               this.currentHandle.css({ top: y });\r
+                       }\r
+                       \r
+                       if (this.rangeElement)\r
+                               this.updateRange();\r
+                               \r
+                       //Store the slider's value\r
+                       this.currentHandle.data("mouse").sliderValue = {\r
+                               x: this.convertValue(x, "x"),\r
+                               y: this.convertValue(y, "y")\r
+                       };\r
+                       \r
+                       if (!noPropagation) {\r
+                               this.propagate('start', null);\r
+                               this.propagate('stop', null);\r
+                               this.propagate('change', null);\r
+                               this.propagate("slide", null);\r
+                       }\r
+               }\r
+       });\r
+\r
+       $.ui.slider.getter = "value";\r
+       \r
+       $.ui.slider.defaults = {\r
+               handle: ".ui-slider-handle",\r
+               distance: 1\r
+       };\r
+\r
+})(jQuery);\r
diff --git a/ui/source/ui.sortable.js b/ui/source/ui.sortable.js
new file mode 100644 (file)
index 0000000..a70e80f
--- /dev/null
@@ -0,0 +1,671 @@
+/*\r
+ * jQuery UI Sortable\r
+ *\r
+ * Copyright (c) 2008 Paul Bakaus\r
+ * Dual licensed under the MIT (MIT-LICENSE.txt)\r
+ * and GPL (GPL-LICENSE.txt) licenses.\r
+ * \r
+ * http://docs.jquery.com/UI/Sortables\r
+ *\r
+ * Depends:\r
+ *     ui.core.js\r
+ *\r
+ * Revision: $Id: ui.sortable.js 5433 2008-05-04 20:07:17Z joern.zaefferer $\r
+ */\r
+;(function($) {\r
+       \r
+       function contains(a, b) { \r
+           var safari2 = $.browser.safari && $.browser.version < 522; \r
+           if (a.contains && !safari2) { \r
+               return a.contains(b); \r
+           } \r
+           if (a.compareDocumentPosition) \r
+               return !!(a.compareDocumentPosition(b) & 16); \r
+           while (b = b.parentNode) \r
+                 if (b == a) return true; \r
+           return false; \r
+       };\r
+       \r
+       $.widget("ui.sortable", {\r
+               init: function() {\r
+\r
+                       var o = this.options;\r
+                       this.containerCache = {};\r
+                       this.element.addClass("ui-sortable");\r
+               \r
+                       //Get the items\r
+                       this.refresh();\r
+       \r
+                       //Let's determine if the items are floating\r
+                       this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;\r
+                       \r
+                       //Let's determine the parent's offset\r
+                       if(!(/(relative|absolute|fixed)/).test(this.element.css('position'))) this.element.css('position', 'relative');\r
+                       this.offset = this.element.offset();\r
+       \r
+                       //Initialize mouse events for interaction\r
+                       this.element.mouse({\r
+                               executor: this,\r
+                               delay: o.delay,\r
+                               distance: o.distance || 1,\r
+                               dragPrevention: o.prevention ? o.prevention.toLowerCase().split(',') : ['input','textarea','button','select','option'],\r
+                               start: this.start,\r
+                               stop: this.stop,\r
+                               drag: this.drag,\r
+                               condition: function(e) {\r
+       \r
+                                       if(this.options.disabled || this.options.type == 'static') return false;\r
+       \r
+                                       //Find out if the clicked node (or one of its parents) is a actual item in this.items\r
+                                       var currentItem = null, nodes = $(e.target).parents().each(function() { \r
+                                               if($.data(this, 'sortable-item')) {\r
+                                                       currentItem = $(this);\r
+                                                       return false;\r
+                                               }\r
+                                       });\r
+                                       if($.data(e.target, 'sortable-item')) currentItem = $(e.target);\r
+                                       \r
+                                       if(!currentItem) return false;  \r
+                                       if(this.options.handle) {\r
+                                               var validHandle = false;\r
+                                               $(this.options.handle, currentItem).each(function() { if(this == e.target) validHandle = true; });\r
+                                               if(!validHandle) return false;\r
+                                       }\r
+                                               \r
+                                       this.currentItem = currentItem;\r
+                                       return true;\r
+       \r
+                               }\r
+                       });\r
+                       \r
+               },\r
+               plugins: {},\r
+               ui: function(inst) {\r
+                       return {\r
+                               helper: (inst || this)["helper"],\r
+                               placeholder: (inst || this)["placeholder"] || $([]),\r
+                               position: (inst || this)["position"].current,\r
+                               absolutePosition: (inst || this)["position"].absolute,\r
+                               instance: this,\r
+                               options: this.options,\r
+                               element: this.element,\r
+                               item: (inst || this)["currentItem"],\r
+                               sender: inst ? inst.element : null\r
+                       };              \r
+               },\r
+               propagate: function(n,e,inst) {\r
+                       $.ui.plugin.call(this, n, [e, this.ui(inst)]);\r
+                       this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui(inst)], this.options[n]);\r
+               },\r
+               serialize: function(o) {\r
+                       \r
+                       var items = $(this.options.items, this.element).not('.ui-sortable-helper'); //Only the items of the sortable itself\r
+                       var str = []; o = o || {};\r
+                       \r
+                       items.each(function() {\r
+                               var res = ($(this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));\r
+                               if(res) str.push((o.key || res[1])+'[]='+(o.key ? res[1] : res[2]));\r
+                       });\r
+                       \r
+                       return str.join('&');\r
+                       \r
+               },\r
+               toArray: function(attr) {\r
+                       var items = $(this.options.items, this.element).not('.ui-sortable-helper'); //Only the items of the sortable itself\r
+                       var ret = [];\r
+\r
+                       items.each(function() { ret.push($(this).attr(attr || 'id')); });\r
+                       return ret;\r
+               },\r
+               enable: function() {\r
+                       this.element.removeClass("ui-sortable-disabled");\r
+                       this.options.disabled = false;\r
+               },\r
+               disable: function() {\r
+                       this.element.addClass("ui-sortable-disabled");\r
+                       this.options.disabled = true;\r
+               },\r
+               /* Be careful with the following core functions */\r
+               intersectsWith: function(item) {\r
+                       \r
+                       var x1 = this.position.absolute.left, x2 = x1 + this.helperProportions.width,\r
+                       y1 = this.position.absolute.top, y2 = y1 + this.helperProportions.height;\r
+                       var l = item.left, r = l + item.width, \r
+                       t = item.top, b = t + item.height;\r
+\r
+                       if(this.options.tolerance == "pointer") {\r
+                               return (y1 + this.clickOffset.top > t && y1 + this.clickOffset.top < b && x1 + this.clickOffset.left > l && x1 + this.clickOffset.left < r);\r
+                       } else {\r
+                       \r
+                               return (l < x1 + (this.helperProportions.width / 2) // Right Half\r
+                                       && x2 - (this.helperProportions.width / 2) < r // Left Half\r
+                                       && t < y1 + (this.helperProportions.height / 2) // Bottom Half\r
+                                       && y2 - (this.helperProportions.height / 2) < b ); // Top Half\r
+                       \r
+                       }\r
+                       \r
+               },\r
+               intersectsWithEdge: function(item) {    \r
+                       var x1 = this.position.absolute.left, x2 = x1 + this.helperProportions.width,\r
+                               y1 = this.position.absolute.top, y2 = y1 + this.helperProportions.height;\r
+                       var l = item.left, r = l + item.width, \r
+                               t = item.top, b = t + item.height;\r
+\r
+                       if(this.options.tolerance == "pointer") {\r
+\r
+                               if(!(y1 + this.clickOffset.top > t && y1 + this.clickOffset.top < b && x1 + this.clickOffset.left > l && x1 + this.clickOffset.left < r)) return false;\r
+                               \r
+                               if(this.floating) {\r
+                                       if(x1 + this.clickOffset.left > l && x1 + this.clickOffset.left < l + item.width/2) return 2;\r
+                                       if(x1 + this.clickOffset.left > l+item.width/2 && x1 + this.clickOffset.left < r) return 1;\r
+                               } else {\r
+                                       if(y1 + this.clickOffset.top > t && y1 + this.clickOffset.top < t + item.height/2) return 2;\r
+                                       if(y1 + this.clickOffset.top > t+item.height/2 && y1 + this.clickOffset.top < b) return 1;\r
+                               }\r
+\r
+                       } else {\r
+                       \r
+                               if (!(l < x1 + (this.helperProportions.width / 2) // Right Half\r
+                                       && x2 - (this.helperProportions.width / 2) < r // Left Half\r
+                                       && t < y1 + (this.helperProportions.height / 2) // Bottom Half\r
+                                       && y2 - (this.helperProportions.height / 2) < b )) return false; // Top Half\r
+                               \r
+                               if(this.floating) {\r
+                                       if(x2 > l && x1 < l) return 2; //Crosses left edge\r
+                                       if(x1 < r && x2 > r) return 1; //Crosses right edge\r
+                               } else {\r
+                                       if(y2 > t && y1 < t) return 1; //Crosses top edge\r
+                                       if(y1 < b && y2 > b) return 2; //Crosses bottom edge\r
+                               }\r
+                       \r
+                       }\r
+                       \r
+                       return false;\r
+                       \r
+               },\r
+               //This method checks approximately if the item is dragged in a container, but doesn't touch any items\r
+               inEmptyZone: function(container) {\r
+\r
+                       if(!$(container.options.items, container.element).length) {\r
+                               return container.options.dropOnEmpty ? true : false;\r
+                       };\r
+\r
+                       var last = $(container.options.items, container.element).not('.ui-sortable-helper'); last = $(last[last.length-1]);\r
+                       var top = last.offset()[this.floating ? 'left' : 'top'] + last[0][this.floating ? 'offsetWidth' : 'offsetHeight'];\r
+                       return (this.position.absolute[this.floating ? 'left' : 'top'] > top);\r
+               },\r
+               refresh: function() {\r
+                       this.refreshItems();\r
+                       this.refreshPositions();\r
+               },\r
+               refreshItems: function() {\r
+                       \r
+                       this.items = [];\r
+                       this.containers = [this];\r
+                       var items = this.items;\r
+                       var queries = [$(this.options.items, this.element)];\r
+                       \r
+                       if(this.options.connectWith) {\r
+                               for (var i = this.options.connectWith.length - 1; i >= 0; i--){\r
+                                       var cur = $(this.options.connectWith[i]);\r
+                                       for (var j = cur.length - 1; j >= 0; j--){\r
+                                               var inst = $.data(cur[j], 'sortable');\r
+                                               if(inst && !inst.options.disabled) {\r
+                                                       queries.push($(inst.options.items, inst.element));\r
+                                                       this.containers.push(inst);\r
+                                               }\r
+                                       };\r
+                               };\r
+                       }\r
+\r
+                       for (var i = queries.length - 1; i >= 0; i--){\r
+                               queries[i].each(function() {\r
+                                       $.data(this, 'sortable-item', true); // Data for target checking (mouse manager)\r
+                                       items.push({\r
+                                               item: $(this),\r
+                                               width: 0, height: 0,\r
+                                               left: 0, top: 0\r
+                                       });\r
+                               });\r
+                       };\r
+\r
+               },\r
+               refreshPositions: function(fast) {\r
+                       for (var i = this.items.length - 1; i >= 0; i--){\r
+                               var t = this.items[i].item;\r
+                               if(!fast) this.items[i].width = (this.options.toleranceElement ? $(this.options.toleranceElement, t) : t).outerWidth();\r
+                               if(!fast) this.items[i].height = (this.options.toleranceElement ? $(this.options.toleranceElement, t) : t).outerHeight();\r
+                               var p = (this.options.toleranceElement ? $(this.options.toleranceElement, t) : t).offset();\r
+                               this.items[i].left = p.left;\r
+                               this.items[i].top = p.top;\r
+                       };\r
+                       for (var i = this.containers.length - 1; i >= 0; i--){\r
+                               var p =this.containers[i].element.offset();\r
+                               this.containers[i].containerCache.left = p.left;\r
+                               this.containers[i].containerCache.top = p.top;\r
+                               this.containers[i].containerCache.width = this.containers[i].element.outerWidth();\r
+                               this.containers[i].containerCache.height = this.containers[i].element.outerHeight();\r
+                       };\r
+               },\r
+               destroy: function() {\r
+                       this.element\r
+                               .removeClass("ui-sortable ui-sortable-disabled")\r
+                               .removeData("sortable")\r
+                               .unbind(".sortable")\r
+                               .mouse("destroy");\r
+                       \r
+                       for ( var i = this.items.length - 1; i >= 0; i-- )\r
+                               this.items[i].item.removeData("sortable-item");\r
+               },\r
+               createPlaceholder: function(that) {\r
+                       (that || this).placeholderElement = this.options.placeholderElement ? $(this.options.placeholderElement, (that || this).currentItem) : (that || this).currentItem;\r
+                       (that || this).placeholder = $('<div></div>')\r
+                               .addClass(this.options.placeholder)\r
+                               .appendTo('body')\r
+                               .css({ position: 'absolute' })\r
+                               .css((that || this).placeholderElement.offset())\r
+                               .css({ width: (that || this).placeholderElement.outerWidth(), height: (that || this).placeholderElement.outerHeight() })\r
+                               ;\r
+               },\r
+               contactContainers: function(e) {\r
+                       for (var i = this.containers.length - 1; i >= 0; i--){\r
+\r
+                               if(this.intersectsWith(this.containers[i].containerCache)) {\r
+                                       if(!this.containers[i].containerCache.over) {\r
+                                               \r
+\r
+                                               if(this.currentContainer != this.containers[i]) {\r
+                                                       \r
+                                                       //When entering a new container, we will find the item with the least distance and append our item near it\r
+                                                       var dist = 10000; var itemWithLeastDistance = null; var base = this.position.absolute[this.containers[i].floating ? 'left' : 'top'];\r
+                                                       for (var j = this.items.length - 1; j >= 0; j--) {\r
+                                                               if(!contains(this.containers[i].element[0], this.items[j].item[0])) continue;\r
+                                                               var cur = this.items[j][this.containers[i].floating ? 'left' : 'top'];\r
+                                                               if(Math.abs(cur - base) < dist) {\r
+                                                                       dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];\r
+                                                               }\r
+                                                       }\r
+                                                       \r
+                                                       //We also need to exchange the placeholder\r
+                                                       if(this.placeholder) this.placeholder.remove();\r
+                                                       if(this.containers[i].options.placeholder) {\r
+                                                               this.containers[i].createPlaceholder(this);\r
+                                                       } else {\r
+                                                               this.placeholder = null; this.placeholderElement = null;\r
+                                                       }\r
+                                                       \r
+                                                       \r
+                                                       itemWithLeastDistance ? this.rearrange(e, itemWithLeastDistance) : this.rearrange(e, null, this.containers[i].element);\r
+                                                       this.propagate("change", e); //Call plugins and callbacks\r
+                                                       this.containers[i].propagate("change", e, this); //Call plugins and callbacks\r
+                                                       this.currentContainer = this.containers[i];\r
+\r
+                                               }\r
+                                               \r
+                                               this.containers[i].propagate("over", e, this);\r
+                                               this.containers[i].containerCache.over = 1;\r
+                                       }\r
+                               } else {\r
+                                       if(this.containers[i].containerCache.over) {\r
+                                               this.containers[i].propagate("out", e, this);\r
+                                               this.containers[i].containerCache.over = 0;\r
+                                       }\r
+                               }\r
+                               \r
+                       };                      \r
+               },\r
+               start: function(e,el) {\r
+               \r
+                       var o = this.options;\r
+                       this.currentContainer = this;\r
+                       this.refresh();\r
+\r
+                       //Create and append the visible helper\r
+                       this.helper = typeof o.helper == 'function' ? $(o.helper.apply(this.element[0], [e, this.currentItem])) : this.currentItem.clone();\r
+                       if(!this.helper.parents('body').length) this.helper.appendTo(o.appendTo || this.currentItem[0].parentNode); //Add the helper to the DOM if that didn't happen already\r
+                       this.helper.css({ position: 'absolute', clear: 'both' }).addClass('ui-sortable-helper'); //Position it absolutely and add a helper class\r
+                       \r
+                       //Prepare variables for position generation\r
+                       $.extend(this, {\r
+                               offsetParent: this.helper.offsetParent(),\r
+                               offsets: {\r
+                                       absolute: this.currentItem.offset()\r
+                               },\r
+                               mouse: {\r
+                                       start: { top: e.pageY, left: e.pageX }\r
+                               },\r
+                               margins: {\r
+                                       top: parseInt(this.currentItem.css("marginTop")) || 0,\r
+                                       left: parseInt(this.currentItem.css("marginLeft")) || 0\r
+                               }\r
+                       });\r
+                       \r
+                       //The relative click offset\r
+                       this.offsets.parent = this.offsetParent.offset();\r
+                       this.clickOffset = { left: e.pageX - this.offsets.absolute.left, top: e.pageY - this.offsets.absolute.top };\r
+                       \r
+                       this.originalPosition = {\r
+                               left: this.offsets.absolute.left - this.offsets.parent.left - this.margins.left,\r
+                               top: this.offsets.absolute.top - this.offsets.parent.top - this.margins.top\r
+                       }\r
+                       \r
+                       //Generate a flexible offset that will later be subtracted from e.pageX/Y\r
+                       //I hate margins - they need to be removed before positioning the element absolutely..\r
+                       this.offset = {\r
+                               left: e.pageX - this.originalPosition.left,\r
+                               top: e.pageY - this.originalPosition.top\r
+                       };\r
+\r
+                       //Save the first time position\r
+                       $.extend(this, {\r
+                               position: {\r
+                                       current: { top: e.pageY - this.offset.top, left: e.pageX - this.offset.left },\r
+                                       absolute: { left: e.pageX - this.clickOffset.left, top: e.pageY - this.clickOffset.top },\r
+                                       dom: this.currentItem.prev()[0]\r
+                               }\r
+                       });\r
+\r
+                       //If o.placeholder is used, create a new element at the given position with the class\r
+                       if(o.placeholder) this.createPlaceholder();\r
+\r
+                       this.propagate("start", e); //Call plugins and callbacks\r
+                       this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() }; //Save and store the helper proportions\r
+\r
+                       //If we have something in cursorAt, we'll use it\r
+                       if(o.cursorAt) {\r
+                               if(o.cursorAt.top != undefined || o.cursorAt.bottom != undefined) {\r
+                                       this.offset.top -= this.clickOffset.top - (o.cursorAt.top != undefined ? o.cursorAt.top : (this.helperProportions.height - o.cursorAt.bottom));\r
+                                       this.clickOffset.top = (o.cursorAt.top != undefined ? o.cursorAt.top : (this.helperProportions.height - o.cursorAt.bottom));\r
+                               }\r
+                               if(o.cursorAt.left != undefined || o.cursorAt.right != undefined) {\r
+                                       this.offset.left -= this.clickOffset.left - (o.cursorAt.left != undefined ? o.cursorAt.left : (this.helperProportions.width - o.cursorAt.right));\r
+                                       this.clickOffset.left = (o.cursorAt.left != undefined ? o.cursorAt.left : (this.helperProportions.width - o.cursorAt.right));\r
+                               }\r
+                       }\r
+\r
+                       if(this.options.placeholder != 'clone') $(this.currentItem).css('visibility', 'hidden'); //Set the original element visibility to hidden to still fill out the white space\r
+                       for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i].propagate("activate", e, this); } //Post 'activate' events to possible containers\r
+                       \r
+                       //Prepare possible droppables\r
+                       if($.ui.ddmanager) $.ui.ddmanager.current = this;\r
+                       if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);\r
+\r
+                       this.dragging = true;\r
+                       return false;\r
+                       \r
+               },\r
+               stop: function(e) {\r
+\r
+                       this.propagate("stop", e); //Call plugins and trigger callbacks\r
+                       if(this.position.dom != this.currentItem.prev()[0]) this.propagate("update", e); //Trigger update callback if the DOM position has changed\r
+                       if(!contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element\r
+                               this.propagate("remove", e);\r
+                               for (var i = this.containers.length - 1; i >= 0; i--){\r
+                                       if(contains(this.containers[i].element[0], this.currentItem[0])) {\r
+                                               this.containers[i].propagate("update", e, this);\r
+                                               this.containers[i].propagate("receive", e, this);\r
+                                       }\r
+                               };\r
+                       };\r
+                       \r
+                       //Post events to containers\r
+                       for (var i = this.containers.length - 1; i >= 0; i--){\r
+                               this.containers[i].propagate("deactivate", e, this);\r
+                               if(this.containers[i].containerCache.over) {\r
+                                       this.containers[i].propagate("out", e, this);\r
+                                       this.containers[i].containerCache.over = 0;\r
+                               }\r
+                       }\r
+                       \r
+                       //If we are using droppables, inform the manager about the drop\r
+                       if ($.ui.ddmanager && !this.options.dropBehaviour) $.ui.ddmanager.drop(this, e);\r
+                       \r
+                       this.dragging = false;\r
+                       if(this.cancelHelperRemoval) return false;\r
+                       $(this.currentItem).css('visibility', '');\r
+                       if(this.placeholder) this.placeholder.remove();\r
+                       this.helper.remove();\r
+\r
+                       return false;\r
+                       \r
+               },\r
+               drag: function(e) {\r
+\r
+                       //Compute the helpers position\r
+                       this.position.current = { top: e.pageY - this.offset.top, left: e.pageX - this.offset.left };\r
+                       this.position.absolute = { left: e.pageX - this.clickOffset.left, top: e.pageY - this.clickOffset.top };\r
+\r
+                       //Rearrange\r
+                       for (var i = this.items.length - 1; i >= 0; i--) {\r
+                               var intersection = this.intersectsWithEdge(this.items[i]);\r
+                               if(!intersection) continue;\r
+                               \r
+                               if(this.items[i].item[0] != this.currentItem[0] //cannot intersect with itself\r
+                                       &&      this.currentItem[intersection == 1 ? "next" : "prev"]()[0] != this.items[i].item[0] //no useless actions that have been done before\r
+                                       &&      !contains(this.currentItem[0], this.items[i].item[0]) //no action if the item moved is the parent of the item checked\r
+                                       && (this.options.type == 'semi-dynamic' ? !contains(this.element[0], this.items[i].item[0]) : true)\r
+                               ) {\r
+                                       \r
+                                       this.direction = intersection == 1 ? "down" : "up";\r
+                                       this.rearrange(e, this.items[i]);\r
+                                       this.propagate("change", e); //Call plugins and callbacks\r
+                                       break;\r
+                               }\r
+                       }\r
+                       \r
+                       //Post events to containers\r
+                       this.contactContainers(e);\r
+                       \r
+                       //Interconnect with droppables\r
+                       if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);\r
+\r
+                       this.propagate("sort", e); //Call plugins and callbacks\r
+                       this.helper.css({ left: this.position.current.left+'px', top: this.position.current.top+'px' }); // Stick the helper to the cursor\r
+                       return false;\r
+                       \r
+               },\r
+               rearrange: function(e, i, a) {\r
+                       a ? a.append(this.currentItem) : i.item[this.direction == 'down' ? 'before' : 'after'](this.currentItem);\r
+                       this.refreshPositions(true); //Precompute after each DOM insertion, NOT on mousemove\r
+                       if(this.placeholderElement) this.placeholder.css(this.placeholderElement.offset());\r
+                       if(this.placeholderElement && this.placeholderElement.is(":visible")) this.placeholder.css({ width: this.placeholderElement.outerWidth(), height: this.placeholderElement.outerHeight() });\r
+               }\r
+       });\r
+       \r
+       $.extend($.ui.sortable, {\r
+               getter: "serialize toArray",\r
+               defaults: {\r
+                       items: '> *',\r
+                       zIndex: 1000\r
+               }\r
+       });\r
+\r
+       \r
+/*\r
+ * Sortable Extensions\r
+ */\r
+\r
+       $.ui.plugin.add("sortable", "cursor", {\r
+               start: function(e, ui) {\r
+                       var t = $('body');\r
+                       if (t.css("cursor")) ui.options._cursor = t.css("cursor");\r
+                       t.css("cursor", ui.options.cursor);\r
+               },\r
+               stop: function(e, ui) {\r
+                       if (ui.options._cursor) $('body').css("cursor", ui.options._cursor);\r
+               }\r
+       });\r
+\r
+       $.ui.plugin.add("sortable", "zIndex", {\r
+               start: function(e, ui) {\r
+                       var t = ui.helper;\r
+                       if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex");\r
+                       t.css('zIndex', ui.options.zIndex);\r
+               },\r
+               stop: function(e, ui) {\r
+                       if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex);\r
+               }\r
+       });\r
+\r
+       $.ui.plugin.add("sortable", "opacity", {\r
+               start: function(e, ui) {\r
+                       var t = ui.helper;\r
+                       if(t.css("opacity")) ui.options._opacity = t.css("opacity");\r
+                       t.css('opacity', ui.options.opacity);\r
+               },\r
+               stop: function(e, ui) {\r
+                       if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity);\r
+               }\r
+       });\r
+\r
+\r
+       $.ui.plugin.add("sortable", "revert", {\r
+               stop: function(e, ui) {\r
+                       var self = ui.instance;\r
+                       self.cancelHelperRemoval = true;\r
+                       var cur = self.currentItem.offset();\r
+                       var op = self.helper.offsetParent().offset();\r
+                       if(ui.instance.options.zIndex) ui.helper.css('zIndex', ui.instance.options.zIndex); //Do the zIndex again because it already was resetted by the plugin above on stop\r
+\r
+                       //Also animate the placeholder if we have one\r
+                       if(ui.instance.placeholder) ui.instance.placeholder.animate({ opacity: 'hide' }, parseInt(ui.options.revert, 10) || 500);\r
+                       \r
+                       \r
+                       ui.helper.animate({\r
+                               left: cur.left - op.left - self.margins.left,\r
+                               top: cur.top - op.top - self.margins.top\r
+                       }, parseInt(ui.options.revert, 10) || 500, function() {\r
+                               self.currentItem.css('visibility', 'visible');\r
+                               window.setTimeout(function() {\r
+                                       if(self.placeholder) self.placeholder.remove();\r
+                                       self.helper.remove();\r
+                                       if(ui.options._zIndex) ui.helper.css('zIndex', ui.options._zIndex);\r
+                               }, 50);\r
+                       });\r
+               }\r
+       });\r
+\r
+       \r
+       $.ui.plugin.add("sortable", "containment", {\r
+               start: function(e, ui) {\r
+\r
+                       var o = ui.options;\r
+                       if((o.containment.left != undefined || o.containment.constructor == Array) && !o._containment) return;\r
+                       if(!o._containment) o._containment = o.containment;\r
+\r
+                       if(o._containment == 'parent') o._containment = this[0].parentNode;\r
+                       if(o._containment == 'sortable') o._containment = this[0];\r
+                       if(o._containment == 'document') {\r
+                               o.containment = [\r
+                                       0,\r
+                                       0,\r
+                                       $(document).width(),\r
+                                       ($(document).height() || document.body.parentNode.scrollHeight)\r
+                               ];\r
+                       } else { //I'm a node, so compute top/left/right/bottom\r
+\r
+                               var ce = $(o._containment);\r
+                               var co = ce.offset();\r
+\r
+                               o.containment = [\r
+                                       co.left,\r
+                                       co.top,\r
+                                       co.left+(ce.outerWidth() || ce[0].scrollWidth),\r
+                                       co.top+(ce.outerHeight() || ce[0].scrollHeight)\r
+                               ];\r
+                       }\r
+\r
+               },\r
+               sort: function(e, ui) {\r
+\r
+                       var o = ui.options;\r
+                       var h = ui.helper;\r
+                       var c = o.containment;\r
+                       var self = ui.instance;\r
+                       var borderLeft = (parseInt(self.offsetParent.css("borderLeftWidth"), 10) || 0);\r
+                       var borderRight = (parseInt(self.offsetParent.css("borderRightWidth"), 10) || 0);\r
+                       var borderTop = (parseInt(self.offsetParent.css("borderTopWidth"), 10) || 0);\r
+                       var borderBottom = (parseInt(self.offsetParent.css("borderBottomWidth"), 10) || 0);\r
+                       \r
+                       if(c.constructor == Array) {\r
+                               if((self.position.absolute.left < c[0])) self.position.current.left = c[0] - self.offsets.parent.left - self.margins.left;\r
+                               if((self.position.absolute.top < c[1])) self.position.current.top = c[1] - self.offsets.parent.top - self.margins.top;\r
+                               if(self.position.absolute.left - c[2] + self.helperProportions.width >= 0) self.position.current.left = c[2] - self.offsets.parent.left - self.helperProportions.width - self.margins.left - borderLeft - borderRight;\r
+                               if(self.position.absolute.top - c[3] + self.helperProportions.height >= 0) self.position.current.top = c[3] - self.offsets.parent.top - self.helperProportions.height - self.margins.top - borderTop - borderBottom;\r
+                       } else {\r
+                               if((ui.position.left < c.left)) self.position.current.left = c.left;\r
+                               if((ui.position.top < c.top)) self.position.current.top = c.top;\r
+                               if(ui.position.left - self.offsetParent.innerWidth() + self.helperProportions.width + c.right + borderLeft + borderRight >= 0) self.position.current.left = self.offsetParent.innerWidth() - self.helperProportions.width - c.right - borderLeft - borderRight;\r
+                               if(ui.position.top - self.offsetParent.innerHeight() + self.helperProportions.height + c.bottom + borderTop + borderBottom >= 0) self.position.current.top = self.offsetParent.innerHeight() - self.helperProportions.height - c.bottom - borderTop - borderBottom;\r
+                       }\r
+\r
+               }\r
+       });\r
+\r
+       $.ui.plugin.add("sortable", "axis", {\r
+               sort: function(e, ui) {\r
+                       var o = ui.options;\r
+                       if(o.constraint) o.axis = o.constraint; //Legacy check\r
+                       o.axis == 'x' ? ui.instance.position.current.top = ui.instance.originalPosition.top : ui.instance.position.current.left = ui.instance.originalPosition.left;\r
+               }\r
+       });\r
+\r
+       $.ui.plugin.add("sortable", "scroll", {\r
+               start: function(e, ui) {\r
+                       var o = ui.options;\r
+                       o.scrollSensitivity     = o.scrollSensitivity || 20;\r
+                       o.scrollSpeed           = o.scrollSpeed || 20;\r
+\r
+                       ui.instance.overflowY = function(el) {\r
+                               do { if((/auto|scroll/).test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode);\r
+                               return $(document);\r
+                       }(this);\r
+                       ui.instance.overflowX = function(el) {\r
+                               do { if((/auto|scroll/).test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);\r
+                               return $(document);\r
+                       }(this);\r
+                       \r
+                       if(ui.instance.overflowY[0] != document && ui.instance.overflowY[0].tagName != 'HTML') ui.instance.overflowYstart = ui.instance.overflowY[0].scrollTop;\r
+                       if(ui.instance.overflowX[0] != document && ui.instance.overflowX[0].tagName != 'HTML') ui.instance.overflowXstart = ui.instance.overflowX[0].scrollLeft;\r
+                       \r
+               },\r
+               sort: function(e, ui) {\r
+                       \r
+                       var o = ui.options;\r
+                       var i = ui.instance;\r
+\r
+                       if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {\r
+                               if(i.overflowY[0].offsetHeight - (ui.position.top - i.overflowY[0].scrollTop + i.clickOffset.top) < o.scrollSensitivity)\r
+                                       i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed;\r
+                               if((ui.position.top - i.overflowY[0].scrollTop + i.clickOffset.top) < o.scrollSensitivity)\r
+                                       i.overflowY[0].scrollTop = i.overflowY[0].scrollTop - o.scrollSpeed;                            \r
+                       } else {\r
+                               //$(document.body).append('<p>'+(e.pageY - $(document).scrollTop())+'</p>');\r
+                               if(e.pageY - $(document).scrollTop() < o.scrollSensitivity)\r
+                                       $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);\r
+                               if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity)\r
+                                       $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);\r
+                       }\r
+                       \r
+                       if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {\r
+                               if(i.overflowX[0].offsetWidth - (ui.position.left - i.overflowX[0].scrollLeft + i.clickOffset.left) < o.scrollSensitivity)\r
+                                       i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed;\r
+                               if((ui.position.top - i.overflowX[0].scrollLeft + i.clickOffset.left) < o.scrollSensitivity)\r
+                                       i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft - o.scrollSpeed;                          \r
+                       } else {\r
+                               if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity)\r
+                                       $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);\r
+                               if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity)\r
+                                       $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);\r
+                       }\r
+                       \r
+                       //ui.instance.recallOffset(e);\r
+                       i.offset = {\r
+                               left: i.mouse.start.left - i.originalPosition.left + (i.overflowXstart !== undefined ? i.overflowXstart - i.overflowX[0].scrollLeft : 0),\r
+                               top: i.mouse.start.top - i.originalPosition.top + (i.overflowYstart !== undefined ? i.overflowYstart - i.overflowX[0].scrollTop : 0)\r
+                       };\r
+\r
+               }\r
+       });\r
+\r
+})(jQuery);\r
diff --git a/ui/source/ui.tabs.js b/ui/source/ui.tabs.js
new file mode 100644 (file)
index 0000000..3113557
--- /dev/null
@@ -0,0 +1,595 @@
+/*\r
+ * jQuery UI Tabs\r
+ *\r
+ * Copyright (c) 2007, 2008 Klaus Hartl (stilbuero.de)\r
+ * Dual licensed under the MIT (MIT-LICENSE.txt)\r
+ * and GPL (GPL-LICENSE.txt) licenses.\r
+ *\r
+ * http://docs.jquery.com/UI/Tabs\r
+ *\r
+ * Depends:\r
+ *     ui.core.js\r
+ *\r
+ * Revision: $Id: ui.tabs.js 5641 2008-05-20 02:53:23Z scott.gonzalez $\r
+ */\r
+;(function($) {\r
+       \r
+       $.widget("ui.tabs", {\r
+               init: function() {\r
+                       this.options.event += '.tabs'; // namespace event\r
+                       \r
+                       // create tabs\r
+                       this.tabify(true);\r
+               },\r
+               setData: function(key, value) {\r
+                       if ((/^selected/).test(key))\r
+                               this.select(value);\r
+                       else {\r
+                               this.options[key] = value;\r
+                               this.tabify();\r
+                       }\r
+               },\r
+               length: function() {\r
+                       return this.$tabs.length;\r
+               },\r
+               tabId: function(a) {\r
+                       return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '')\r
+                               || this.options.idPrefix + $.data(a);\r
+               },\r
+               ui: function(tab, panel) {\r
+                       return {\r
+                               instance: this,\r
+                               options: this.options,\r
+                               tab: tab,\r
+                               panel: panel\r
+                       };\r
+               },\r
+               tabify: function(init) {\r
+\r
+                       this.$lis = $('li:has(a[href])', this.element);\r
+                       this.$tabs = this.$lis.map(function() { return $('a', this)[0]; });\r
+                       this.$panels = $([]);\r
+\r
+                       var self = this, o = this.options;\r
+\r
+                       this.$tabs.each(function(i, a) {\r
+                               // inline tab\r
+                               if (a.hash && a.hash.replace('#', '')) // Safari 2 reports '#' for an empty hash\r
+                                       self.$panels = self.$panels.add(a.hash);\r
+                               // remote tab\r
+                               else if ($(a).attr('href') != '#') { // prevent loading the page itself if href is just "#"\r
+                                       $.data(a, 'href.tabs', a.href); // required for restore on destroy\r
+                                       $.data(a, 'load.tabs', a.href); // mutable\r
+                                       var id = self.tabId(a);\r
+                                       a.href = '#' + id;\r
+                                       var $panel = $('#' + id);\r
+                                       if (!$panel.length) {\r
+                                               $panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass)\r
+                                                       .insertAfter( self.$panels[i - 1] || self.element );\r
+                                               $panel.data('destroy.tabs', true);\r
+                                       }\r
+                                       self.$panels = self.$panels.add( $panel );\r
+                               }\r
+                               // invalid tab href\r
+                               else\r
+                                       o.disabled.push(i + 1);\r
+                       });\r
+\r
+                       if (init) {\r
+\r
+                               // attach necessary classes for styling if not present\r
+                               this.element.addClass(o.navClass);\r
+                               this.$panels.each(function() {\r
+                                       var $this = $(this);\r
+                                       $this.addClass(o.panelClass);\r
+                               });\r
+\r
+                               // Selected tab\r
+                               // use "selected" option or try to retrieve:\r
+                               // 1. from fragment identifier in url\r
+                               // 2. from cookie\r
+                               // 3. from selected class attribute on <li>\r
+                               if (o.selected === undefined) {\r
+                                       if (location.hash) {\r
+                                               this.$tabs.each(function(i, a) {\r
+                                                       if (a.hash == location.hash) {\r
+                                                               o.selected = i;\r
+                                                               // prevent page scroll to fragment\r
+                                                               if ($.browser.msie || $.browser.opera) { // && !o.remote\r
+                                                                       var $toShow = $(location.hash), toShowId = $toShow.attr('id');\r
+                                                                       $toShow.attr('id', '');\r
+                                                                       setTimeout(function() {\r
+                                                                               $toShow.attr('id', toShowId); // restore id\r
+                                                                       }, 500);\r
+                                                               }\r
+                                                               scrollTo(0, 0);\r
+                                                               return false; // break\r
+                                                       }\r
+                                               });\r
+                                       }\r
+                                       else if (o.cookie) {\r
+                                               var index = parseInt($.cookie('ui-tabs' + $.data(self.element)),10);\r
+                                               if (index && self.$tabs[index])\r
+                                                       o.selected = index;\r
+                                       }\r
+                                       else if (self.$lis.filter('.' + o.selectedClass).length)\r
+                                               o.selected = self.$lis.index( self.$lis.filter('.' + o.selectedClass)[0] );\r
+                               }\r
+                               o.selected = o.selected === null || o.selected !== undefined ? o.selected : 0; // first tab selected by default\r
+\r
+                               // Take disabling tabs via class attribute from HTML\r
+                               // into account and update option properly.\r
+                               // A selected tab cannot become disabled.\r
+                               o.disabled = $.unique(o.disabled.concat(\r
+                                       $.map(this.$lis.filter('.' + o.disabledClass),\r
+                                               function(n, i) { return self.$lis.index(n); } )\r
+                               )).sort();\r
+                               if ($.inArray(o.selected, o.disabled) != -1)\r
+                                       o.disabled.splice($.inArray(o.selected, o.disabled), 1);\r
+                               \r
+                               // highlight selected tab\r
+                               this.$panels.addClass(o.hideClass);\r
+                               this.$lis.removeClass(o.selectedClass);\r
+                               if (o.selected !== null) {\r
+                                       this.$panels.eq(o.selected).show().removeClass(o.hideClass); // use show and remove class to show in any case no matter how it has been hidden before\r
+                                       this.$lis.eq(o.selected).addClass(o.selectedClass);\r
+                                       \r
+                                       // seems to be expected behavior that the show callback is fired\r
+                                       var onShow = function() {\r
+                                               $(self.element).triggerHandler('tabsshow',\r
+                                                       [self.ui(self.$tabs[o.selected], self.$panels[o.selected])], o.show);\r
+                                       }; \r
+\r
+                                       // load if remote tab\r
+                                       if ($.data(this.$tabs[o.selected], 'load.tabs'))\r
+                                               this.load(o.selected, onShow);\r
+                                       // just trigger show event\r
+                                       else\r
+                                               onShow();\r
+                                       \r
+                               }\r
+                               \r
+                               // clean up to avoid memory leaks in certain versions of IE 6\r
+                               $(window).bind('unload', function() {\r
+                                       self.$tabs.unbind('.tabs');\r
+                                       self.$lis = self.$tabs = self.$panels = null;\r
+                               });\r
+\r
+                       }\r
+\r
+                       // disable tabs\r
+                       for (var i = 0, li; li = this.$lis[i]; i++)\r
+                               $(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass);\r
+\r
+                       // reset cache if switching from cached to not cached\r
+                       if (o.cache === false)\r
+                               this.$tabs.removeData('cache.tabs');\r
+                       \r
+                       // set up animations\r
+                       var hideFx, showFx, baseFx = { 'min-width': 0, duration: 1 }, baseDuration = 'normal';\r
+                       if (o.fx && o.fx.constructor == Array)\r
+                               hideFx = o.fx[0] || baseFx, showFx = o.fx[1] || baseFx;\r
+                       else\r
+                               hideFx = showFx = o.fx || baseFx;\r
+\r
+                       // reset some styles to maintain print style sheets etc.\r
+                       var resetCSS = { display: '', overflow: '', height: '' };\r
+                       if (!$.browser.msie) // not in IE to prevent ClearType font issue\r
+                               resetCSS.opacity = '';\r
+\r
+                       // Hide a tab, animation prevents browser scrolling to fragment,\r
+                       // $show is optional.\r
+                       function hideTab(clicked, $hide, $show) {\r
+                               $hide.animate(hideFx, hideFx.duration || baseDuration, function() { //\r
+                                       $hide.addClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.\r
+                                       if ($.browser.msie && hideFx.opacity)\r
+                                               $hide[0].style.filter = '';\r
+                                       if ($show)\r
+                                               showTab(clicked, $show, $hide);\r
+                               });\r
+                       }\r
+\r
+                       // Show a tab, animation prevents browser scrolling to fragment,\r
+                       // $hide is optional.\r
+                       function showTab(clicked, $show, $hide) {\r
+                               if (showFx === baseFx)\r
+                                       $show.css('display', 'block'); // prevent occasionally occuring flicker in Firefox cause by gap between showing and hiding the tab panels\r
+                               $show.animate(showFx, showFx.duration || baseDuration, function() {\r
+                                       $show.removeClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.\r
+                                       if ($.browser.msie && showFx.opacity)\r
+                                               $show[0].style.filter = '';\r
+\r
+                                       // callback\r
+                                       $(self.element).triggerHandler('tabsshow',\r
+                                               [self.ui(clicked, $show[0])], o.show);\r
+\r
+                               });\r
+                       }\r
+\r
+                       // switch a tab\r
+                       function switchTab(clicked, $li, $hide, $show) {\r
+                               /*if (o.bookmarkable && trueClick) { // add to history only if true click occured, not a triggered click\r
+                                       $.ajaxHistory.update(clicked.hash);\r
+                               }*/\r
+                               $li.addClass(o.selectedClass)\r
+                                       .siblings().removeClass(o.selectedClass);\r
+                               hideTab(clicked, $hide, $show);\r
+                       }\r
+\r
+                       // attach tab event handler, unbind to avoid duplicates from former tabifying...\r
+                       this.$tabs.unbind('.tabs').bind(o.event, function() {\r
+\r
+                               //var trueClick = e.clientX; // add to history only if true click occured, not a triggered click\r
+                               var $li = $(this).parents('li:eq(0)'),\r
+                                       $hide = self.$panels.filter(':visible'),\r
+                                       $show = $(this.hash);\r
+\r
+                               // If tab is already selected and not unselectable or tab disabled or \r
+                               // or is already loading or click callback returns false stop here.\r
+                               // Check if click handler returns false last so that it is not executed\r
+                               // for a disabled or loading tab!\r
+                               if (($li.hasClass(o.selectedClass) && !o.unselect)\r
+                                       || $li.hasClass(o.disabledClass) \r
+                                       || $(this).hasClass(o.loadingClass)\r
+                                       || $(self.element).triggerHandler('tabsselect', [self.ui(this, $show[0])], o.select) === false\r
+                                       ) {\r
+                                       this.blur();\r
+                                       return false;\r
+                               }\r
+\r
+                               self.options.selected = self.$tabs.index(this);\r
+\r
+                               // if tab may be closed\r
+                               if (o.unselect) {\r
+                                       if ($li.hasClass(o.selectedClass)) {\r
+                                               self.options.selected = null;\r
+                                               $li.removeClass(o.selectedClass);\r
+                                               self.$panels.stop();\r
+                                               hideTab(this, $hide);\r
+                                               this.blur();\r
+                                               return false;\r
+                                       } else if (!$hide.length) {\r
+                                               self.$panels.stop();\r
+                                               var a = this;\r
+                                               self.load(self.$tabs.index(this), function() {\r
+                                                       $li.addClass(o.selectedClass).addClass(o.unselectClass);\r
+                                                       showTab(a, $show);\r
+                                               });\r
+                                               this.blur();\r
+                                               return false;\r
+                                       }\r
+                               }\r
+\r
+                               if (o.cookie)\r
+                                       $.cookie('ui-tabs' + $.data(self.element), self.options.selected, o.cookie);\r
+\r
+                               // stop possibly running animations\r
+                               self.$panels.stop();\r
+\r
+                               // show new tab\r
+                               if ($show.length) {\r
+\r
+                                       // prevent scrollbar scrolling to 0 and than back in IE7, happens only if bookmarking/history is enabled\r
+                                       /*if ($.browser.msie && o.bookmarkable) {\r
+                                               var showId = this.hash.replace('#', '');\r
+                                               $show.attr('id', '');\r
+                                               setTimeout(function() {\r
+                                                       $show.attr('id', showId); // restore id\r
+                                               }, 0);\r
+                                       }*/\r
+\r
+                                       var a = this;\r
+                                       self.load(self.$tabs.index(this), $hide.length ? \r
+                                               function() {\r
+                                                       switchTab(a, $li, $hide, $show);\r
+                                               } :\r
+                                               function() {\r
+                                                       $li.addClass(o.selectedClass);\r
+                                                       showTab(a, $show);\r
+                                               }\r
+                                       );\r
+\r
+                                       // Set scrollbar to saved position - need to use timeout with 0 to prevent browser scroll to target of hash\r
+                                       /*var scrollX = window.pageXOffset || document.documentElement && document.documentElement.scrollLeft || document.body.scrollLeft || 0;\r
+                                       var scrollY = window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop || 0;\r
+                                       setTimeout(function() {\r
+                                               scrollTo(scrollX, scrollY);\r
+                                       }, 0);*/\r
+\r
+                               } else\r
+                                       throw 'jQuery UI Tabs: Mismatching fragment identifier.';\r
+\r
+                               // Prevent IE from keeping other link focussed when using the back button\r
+                               // and remove dotted border from clicked link. This is controlled in modern\r
+                               // browsers via CSS, also blur removes focus from address bar in Firefox\r
+                               // which can become a usability and annoying problem with tabsRotate.\r
+                               if ($.browser.msie)\r
+                                       this.blur();\r
+\r
+                               //return o.bookmarkable && !!trueClick; // convert trueClick == undefined to Boolean required in IE\r
+                               return false;\r
+\r
+                       });\r
+\r
+                       // disable click if event is configured to something else\r
+                       if (!(/^click/).test(o.event))\r
+                               this.$tabs.bind('click.tabs', function() { return false; });\r
+\r
+               },\r
+               add: function(url, label, index) {\r
+                       if (index == undefined) \r
+                               index = this.$tabs.length; // append by default\r
+\r
+                       var o = this.options;\r
+                       var $li = $(o.tabTemplate.replace(/#\{href\}/, url).replace(/#\{label\}/, label));\r
+                       $li.data('destroy.tabs', true);\r
+\r
+                       var id = url.indexOf('#') == 0 ? url.replace('#', '') : this.tabId( $('a:first-child', $li)[0] );\r
+\r
+                       // try to find an existing element before creating a new one\r
+                       var $panel = $('#' + id);\r
+                       if (!$panel.length) {\r
+                               $panel = $(o.panelTemplate).attr('id', id)\r
+                                       .addClass(o.hideClass)\r
+                                       .data('destroy.tabs', true);\r
+                       }\r
+                       $panel.addClass(o.panelClass);\r
+                       if (index >= this.$lis.length) {\r
+                               $li.appendTo(this.element);\r
+                               $panel.appendTo(this.element[0].parentNode);\r
+                       } else {\r
+                               $li.insertBefore(this.$lis[index]);\r
+                               $panel.insertBefore(this.$panels[index]);\r
+                       }\r
+                       \r
+                       o.disabled = $.map(o.disabled,\r
+                               function(n, i) { return n >= index ? ++n : n });\r
+                               \r
+                       this.tabify();\r
+\r
+                       if (this.$tabs.length == 1) {\r
+                               $li.addClass(o.selectedClass);\r
+                               $panel.removeClass(o.hideClass);\r
+                               var href = $.data(this.$tabs[0], 'load.tabs');\r
+                               if (href)\r
+                                       this.load(index, href);\r
+                       }\r
+\r
+                       // callback\r
+                       this.element.triggerHandler('tabsadd',\r
+                               [this.ui(this.$tabs[index], this.$panels[index])], o.add\r
+                       );\r
+               },\r
+               remove: function(index) {\r
+                       var o = this.options, $li = this.$lis.eq(index).remove(),\r
+                               $panel = this.$panels.eq(index).remove();\r
+\r
+                       // If selected tab was removed focus tab to the right or\r
+                       // in case the last tab was removed the tab to the left.\r
+                       if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1)\r
+                               this.select(index + (index + 1 < this.$tabs.length ? 1 : -1));\r
+\r
+                       o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),\r
+                               function(n, i) { return n >= index ? --n : n });\r
+\r
+                       this.tabify();\r
+\r
+                       // callback\r
+                       this.element.triggerHandler('tabsremove',\r
+                               [this.ui($li.find('a')[0], $panel[0])], o.remove\r
+                       );\r
+               },\r
+               enable: function(index) {\r
+                       var o = this.options;\r
+                       if ($.inArray(index, o.disabled) == -1)\r
+                               return;\r
+                               \r
+                       var $li = this.$lis.eq(index).removeClass(o.disabledClass);\r
+                       if ($.browser.safari) { // fix disappearing tab (that used opacity indicating disabling) after enabling in Safari 2...\r
+                               $li.css('display', 'inline-block');\r
+                               setTimeout(function() {\r
+                                       $li.css('display', 'block');\r
+                               }, 0);\r
+                       }\r
+\r
+                       o.disabled = $.grep(o.disabled, function(n, i) { return n != index; });\r
+\r
+                       // callback\r
+                       this.element.triggerHandler('tabsenable',\r
+                               [this.ui(this.$tabs[index], this.$panels[index])], o.enable\r
+                       );\r
+\r
+               },\r
+               disable: function(index) {\r
+                       var self = this, o = this.options;\r
+                       if (index != o.selected) { // cannot disable already selected tab\r
+                               this.$lis.eq(index).addClass(o.disabledClass);\r
+\r
+                               o.disabled.push(index);\r
+                               o.disabled.sort();\r
+\r
+                               // callback\r
+                               this.element.triggerHandler('tabsdisable',\r
+                                       [this.ui(this.$tabs[index], this.$panels[index])], o.disable\r
+                               );\r
+                       }\r
+               },\r
+               select: function(index) {\r
+                       if (typeof index == 'string')\r
+                               index = this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] );\r
+                       this.$tabs.eq(index).trigger(this.options.event);\r
+               },\r
+               load: function(index, callback) { // callback is for internal usage only\r
+                       \r
+                       var self = this, o = this.options, $a = this.$tabs.eq(index), a = $a[0],\r
+                                       bypassCache = callback == undefined || callback === false, url = $a.data('load.tabs');\r
+\r
+                       callback = callback || function() {};\r
+                       \r
+                       // no remote or from cache - just finish with callback\r
+                       if (!url || !bypassCache && $.data(a, 'cache.tabs')) {\r
+                               callback();\r
+                               return;\r
+                       }\r
+\r
+                       // load remote from here on\r
+                       \r
+                       var inner = function(parent) {\r
+                               var $parent = $(parent), $inner = $parent.find('*:last');\r
+                               return $inner.length && $inner || $parent;\r
+                       };\r
+                       var cleanup = function() {\r
+                               self.$tabs.filter('.' + o.loadingClass).removeClass(o.loadingClass)\r
+                                                       .each(function() {\r
+                                                               if (o.spinner)\r
+                                                                       inner(this).parent().html(inner(this).data('label.tabs'));\r
+                                                       });\r
+                               self.xhr = null;\r
+                       };\r
+                       \r
+                       if (o.spinner) {\r
+                               var label = inner(a).html();\r
+                               inner(a).wrapInner('<em></em>')\r
+                                       .find('em').data('label.tabs', label).html(o.spinner);\r
+                       }\r
+\r
+                       var ajaxOptions = $.extend({}, o.ajaxOptions, {\r
+                               url: url,\r
+                               success: function(r, s) {\r
+                                       $(a.hash).html(r);\r
+                                       cleanup();\r
+                                       \r
+                                       if (o.cache)\r
+                                               $.data(a, 'cache.tabs', true); // if loaded once do not load them again\r
+\r
+                                       // callbacks\r
+                                       $(self.element).triggerHandler('tabsload',\r
+                                               [self.ui(self.$tabs[index], self.$panels[index])], o.load\r
+                                       );\r
+                                       o.ajaxOptions.success && o.ajaxOptions.success(r, s);\r
+                                       \r
+                                       // This callback is required because the switch has to take\r
+                                       // place after loading has completed. Call last in order to \r
+                                       // fire load before show callback...\r
+                                       callback();\r
+                               }\r
+                       });\r
+                       if (this.xhr) {\r
+                               // terminate pending requests from other tabs and restore tab label\r
+                               this.xhr.abort();\r
+                               cleanup();\r
+                       }\r
+                       $a.addClass(o.loadingClass);\r
+                       setTimeout(function() { // timeout is again required in IE, "wait" for id being restored\r
+                               self.xhr = $.ajax(ajaxOptions);\r
+                       }, 0);\r
+\r
+               },\r
+               url: function(index, url) {\r
+                       this.$tabs.eq(index).removeData('cache.tabs').data('load.tabs', url);\r
+               },\r
+               destroy: function() {\r
+                       var o = this.options;\r
+                       this.element.unbind('.tabs')\r
+                               .removeClass(o.navClass).removeData('tabs');\r
+                       this.$tabs.each(function() {\r
+                               var href = $.data(this, 'href.tabs');\r
+                               if (href)\r
+                                       this.href = href;\r
+                               var $this = $(this).unbind('.tabs');\r
+                               $.each(['href', 'load', 'cache'], function(i, prefix) {\r
+                                       $this.removeData(prefix + '.tabs');\r
+                               });\r
+                       });\r
+                       this.$lis.add(this.$panels).each(function() {\r
+                               if ($.data(this, 'destroy.tabs'))\r
+                                       $(this).remove();\r
+                               else\r
+                                       $(this).removeClass([o.selectedClass, o.unselectClass,\r
+                                               o.disabledClass, o.panelClass, o.hideClass].join(' '));\r
+                       });\r
+               }\r
+       });\r
+       \r
+       $.ui.tabs.defaults = {\r
+               // basic setup\r
+               unselect: false,\r
+               event: 'click',\r
+               disabled: [],\r
+               cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }\r
+               // TODO history: false,\r
+\r
+               // Ajax\r
+               spinner: 'Loading&#8230;',\r
+               cache: false,\r
+               idPrefix: 'ui-tabs-',\r
+               ajaxOptions: {},\r
+\r
+               // animations\r
+               fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }\r
+\r
+               // templates\r
+               tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>',\r
+               panelTemplate: '<div></div>',\r
+\r
+               // CSS classes\r
+               navClass: 'ui-tabs-nav',\r
+               selectedClass: 'ui-tabs-selected',\r
+               unselectClass: 'ui-tabs-unselect',\r
+               disabledClass: 'ui-tabs-disabled',\r
+               panelClass: 'ui-tabs-panel',\r
+               hideClass: 'ui-tabs-hide',\r
+               loadingClass: 'ui-tabs-loading'\r
+       };\r
+       \r
+       $.ui.tabs.getter = "length";\r
+\r
+/*\r
+ * Tabs Extensions\r
+ */\r
+\r
+       /*\r
+        * Rotate\r
+        */\r
+       $.extend($.ui.tabs.prototype, {\r
+               rotation: null,\r
+               rotate: function(ms, continuing) {\r
+                       \r
+                       continuing = continuing || false;\r
+                       \r
+                       var self = this, t = this.options.selected;\r
+                       \r
+                       function start() {\r
+                               self.rotation = setInterval(function() {\r
+                                       t = ++t < self.$tabs.length ? t : 0;\r
+                                       self.select(t);\r
+                               }, ms); \r
+                       }\r
+                       \r
+                       function stop(e) {\r
+                               if (!e || e.clientX) { // only in case of a true click\r
+                                       clearInterval(self.rotation);\r
+                               }\r
+                       }\r
+                       \r
+                       // start interval\r
+                       if (ms) {\r
+                               start();\r
+                               if (!continuing)\r
+                                       this.$tabs.bind(this.options.event, stop);\r
+                               else\r
+                                       this.$tabs.bind(this.options.event, function() {\r
+                                               stop();\r
+                                               t = self.options.selected;\r
+                                               start();\r
+                                       });\r
+                       }\r
+                       // stop interval\r
+                       else {\r
+                               stop();\r
+                               this.$tabs.unbind(this.options.event, stop);\r
+                       }\r
+               }\r
+       });\r
+\r
+})(jQuery);\r