Browse Source

re staged lightbox2 to git tree

bach 2 years ago
parent
commit
7b1e954f7f
49 changed files with 10955 additions and 0 deletions
  1. 339 0
      sites/all/modules/lightbox2/LICENSE.txt
  2. 259 0
      sites/all/modules/lightbox2/README.txt
  3. 22 0
      sites/all/modules/lightbox2/TODO.txt
  4. 62 0
      sites/all/modules/lightbox2/css/lightbox-rtl.css
  5. 284 0
      sites/all/modules/lightbox2/css/lightbox.css
  6. 230 0
      sites/all/modules/lightbox2/css/lightbox_alt.css
  7. 60 0
      sites/all/modules/lightbox2/css/lightbox_lite-rtl.css
  8. 60 0
      sites/all/modules/lightbox2/css/lightbox_lite.css
  9. BIN
      sites/all/modules/lightbox2/images/blank.gif
  10. BIN
      sites/all/modules/lightbox2/images/brokenimage.jpg
  11. BIN
      sites/all/modules/lightbox2/images/close.gif
  12. BIN
      sites/all/modules/lightbox2/images/close_hover.gif
  13. BIN
      sites/all/modules/lightbox2/images/close_lite.gif
  14. BIN
      sites/all/modules/lightbox2/images/closelabel.gif
  15. BIN
      sites/all/modules/lightbox2/images/contract.gif
  16. BIN
      sites/all/modules/lightbox2/images/expand.gif
  17. BIN
      sites/all/modules/lightbox2/images/loading.gif
  18. BIN
      sites/all/modules/lightbox2/images/loading_lite.gif
  19. BIN
      sites/all/modules/lightbox2/images/next.gif
  20. BIN
      sites/all/modules/lightbox2/images/next_alt.gif
  21. BIN
      sites/all/modules/lightbox2/images/next_hover.gif
  22. BIN
      sites/all/modules/lightbox2/images/nextlabel.gif
  23. BIN
      sites/all/modules/lightbox2/images/overlay.png
  24. BIN
      sites/all/modules/lightbox2/images/pause.png
  25. BIN
      sites/all/modules/lightbox2/images/play.png
  26. BIN
      sites/all/modules/lightbox2/images/prev.gif
  27. BIN
      sites/all/modules/lightbox2/images/prev_alt.gif
  28. BIN
      sites/all/modules/lightbox2/images/prev_hover.gif
  29. BIN
      sites/all/modules/lightbox2/images/prevlabel.gif
  30. 33 0
      sites/all/modules/lightbox2/js/auto_image_handling.js
  31. 136 0
      sites/all/modules/lightbox2/js/builder.js
  32. 1122 0
      sites/all/modules/lightbox2/js/effects.js
  33. 1195 0
      sites/all/modules/lightbox2/js/lightbox.js
  34. 192 0
      sites/all/modules/lightbox2/js/lightbox2.js
  35. 394 0
      sites/all/modules/lightbox2/js/lightbox_lite.js
  36. 37 0
      sites/all/modules/lightbox2/js/lightbox_modal.js
  37. 21 0
      sites/all/modules/lightbox2/js/lightbox_video.js
  38. 4221 0
      sites/all/modules/lightbox2/js/prototype.js
  39. 58 0
      sites/all/modules/lightbox2/js/scriptaculous.js
  40. 27 0
      sites/all/modules/lightbox2/lightbox2-insert-image.tpl.php
  41. 943 0
      sites/all/modules/lightbox2/lightbox2.admin.inc
  42. 632 0
      sites/all/modules/lightbox2/lightbox2.formatter.inc
  43. 26 0
      sites/all/modules/lightbox2/lightbox2.info
  44. 68 0
      sites/all/modules/lightbox2/lightbox2.insert.inc
  45. 202 0
      sites/all/modules/lightbox2/lightbox2.install
  46. 76 0
      sites/all/modules/lightbox2/lightbox2.module
  47. 47 0
      sites/all/modules/lightbox2/lightbox2.views.inc
  48. 152 0
      sites/all/modules/lightbox2/lightbox2_handler_field_lightbox2.inc
  49. 57 0
      sites/all/modules/lightbox2/page--node--lightbox2.tpl.php

+ 339 - 0
sites/all/modules/lightbox2/LICENSE.txt

@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.

+ 259 - 0
sites/all/modules/lightbox2/README.txt

@@ -0,0 +1,259 @@
+CONTENTS OF THIS FILE
+----------------------
+
+  * Introduction
+  * Installation
+  * Adding Lightbox Functionality to your Images
+    - No Grouping
+    - With Grouping
+    - Slideshow
+    - Video
+    - HTML Content Support
+    - Inline Content Support
+    - Turning the Image Caption into a Link
+  * Keyboard Shortcuts
+  * Translation of Configured Strings
+  * Known Issues
+    - Keyboard Shortcuts in Opera
+
+
+INTRODUCTION
+------------
+Maintainers:
+  Stella Power (http://drupal.org/user/66894)
+  Daniel F. Kudwien (http://drupal.org/user/54136)
+  Mark Ashmead (http://drupal.org/user/52392)
+  Fernando Correa da Conceição (http://drupal.org/user/889254)
+
+Documentation: http://drupal.org/node/144469
+
+Licensed under the GNU/GPL License
+Based on Lightbox v2.03.3 by Lokesh Dhakar
+<http://www.huddletogether.com/projects/lightbox2/>
+
+Originally written to make use of the Prototype framework, and Script.acalo.us,
+now altered to use jQuery.
+
+Permission has been granted to Mark Ashmead & other Drupal Lightbox2 module
+maintainers to distribute the original lightbox.js via Drupal.org under this
+license scheme.  This file has been subsequently modified to make use of jQuery
+instead of prototype / script.acalo.us.
+
+This module enables the use of lightbox2 which places images above your
+current page, not within. This frees you from the constraints of the layout,
+particularly column widths.
+
+This module will include the lightbox CSS and JS files in your Drupal
+Installation without the need to edit the theme. The module comes with a
+Lightbox2 Lite option which does not use the jQuery libraries; it is therefore
+less likely to conflict with anything else.
+
+
+INSTALLATION
+------------
+1. Copy lightbox2 folder to modules directory.
+2. At admin/build/modules enable the lightbox2 module.
+3. Enable permissions at admin/user/permissions.
+4. Configure the module at admin/settings/lightbox2.
+5. Modify your image links to open in a lightbox where necessary, see "Adding
+   Lightbox Functionality to your Images' section below.
+6. If you need to play flv files, then you may need to install a FLV player.
+   There are a number of freely available ones on the Internet, including
+   http://www.jeroenwijering.com/
+
+
+ADDING LIGHTBOX FUNCTIONALITY TO YOUR IMAGES
+--------------------------------------------
+No Grouping
+===========
+Add rel="lightbox" attribute to any link tag to activate the lightbox.
+For example:
+<a href="images/image-1.jpg" rel="lightbox">image #1</a>
+<a href="images/image-1.jpg" rel="lightbox[][my caption]">image #1</a>
+
+Optional: To show a caption either use the title attribute or put in the second
+set of [] of the rel attribute.
+
+With Grouping
+==============
+If you have a set of related images that you would like to group, follow step
+one but additionally include a group name between square brackets in the rel
+attribute. For example:
+
+<a href="images/image-1.jpg" rel="lightbox[roadtrip]">image #1</a>
+<a href="images/image-2.jpg" rel="lightbox[roadtrip][caption 2]">image #2</a>
+<a href="images/image-3.jpg" rel="lightbox[roadtrip][caption 3]">image #3</a>
+
+No limits to the number of image sets per page or how many images are allowed
+in each set. Go nuts!
+
+If you have a set of images that you would like to group together in a
+lightbox, but only wish for one of these images to be visible on your page, you
+can assign the "lightbox_hide_image" class to hide the additional images.  For
+example:
+
+<a href="images/image-1.jpg" rel="lightbox[roadtrip]">image #1</a>
+<a href="images/image-2.jpg" rel="lightbox[roadtrip]" class="lightbox_hide_image">image #2</a>
+<a href="images/image-3.jpg" rel="lightbox[roadtrip]" class="lightbox_hide_image">image #3</a>
+
+Slideshow
+=========
+This is very similar to the grouping functionality described above.  The only
+difference is that "rel" attribute should be set to "lightshow" instead of
+"lightbox".  Using the same example as above, we could launch the images in a
+slideshow by doing:
+
+<a href="images/image-1.jpg" rel="lightshow[roadtrip]">image #1</a>
+<a href="images/image-2.jpg" rel="lightshow[roadtrip][caption 2]">image #2</a>
+<a href="images/image-3.jpg" rel="lightshow[roadtrip][caption 3]">image #3</a>
+
+Video
+=====
+It's possible to show video content in the lightbox.  In this case the "rel"
+attribute should be set to "lightvideo".  It's possible to group videos and 
+to control the size of the lightbox by setting the 'width' and 'height
+properties.  The properties can be configured like
+"lightvideo[group|width:300px; height: 200px;]" and
+"lightvideo[|width:300px; height: 200px;][my caption]".  The properties should
+all be of the format "property: value;" - note the closing semi-colon.  If no
+properties are set, then the default width and height of 400px will be used.
+See below for more detailed examples.
+
+Basic example:
+<a href="http://video.google.com/videoplay?docid=1811233136844420765"
+rel="lightvideo">Google video example - default size</a>
+
+Basic example with caption:
+<a href="http://video.google.com/videoplay?docid=1811233136844420765"
+rel="lightvideo[][my caption]">Google video example - default size</a>
+
+Grouped example:
+<a href="http://video.google.com/videoplay?docid=29023498723974239479"
+rel="lightvideo[group][caption 1]">Grouped example 1</a>
+<a href="http://video.google.com/videoplay?docid=1811233136844420765"
+rel="lightvideo[group][caption 2]">Grouped example 2</a>
+
+Controlling lightbox size example:
+<a href="http://video.google.com/videoplay?docid=1811233136844420765"
+rel="lightvideo[|width:400px; height:300px;][my caption]">Google video example -
+custom size</a>
+
+Supported Video Formats
+asx, wmv, mov and swf videos should all be supported.  A number of video
+providers are also supported, for example YouTube and Google Video. For full
+details on how to integrate these with lightbox, please see the online
+documentation.
+
+HTML Content Support
+====================
+It's possible to show webpage content in the lightbox, using iframes.  In this
+case the "rel" attribute should be set to "lightframe".  Again it's possible to
+group the content, (e.g. "lightframe[search]") but in addition to that, it's
+possible to control some of the iframe properties.  It's possible to set the
+'width', 'height' and 'scrolling' properties of the iframe.  The properties are
+separated from the group name by a '|', for example
+"lightframe[search|width:100px;]" and
+"lightframe[search|width:100px;][my caption]".  If no grouping is being used,
+then the '|' is still used and the format would be "lightframe[|width:100px;]".
+The properties should all be of the format "property: value;" - note the closing
+semi-colon.  If no iframe properties are set, then the default width and height
+of 400px will be used. See below for more detailed examples.
+
+Basic example:
+<a href="http://www.google.com" rel="lightframe">Search google</a>
+
+Basic example with caption:
+<a href="http://www.google.com" rel="lightframe[][my caption]">Search google</a>
+
+Grouped example:
+<a href="http://www.google.com" rel="lightframe[search]">Search google</a>
+<a href="http://www.yahoo.com" rel="lightframe[search][Search Yahoo]">Search yahoo</a>
+
+Controlling iframe property example:
+<a href="http://www.google.com" rel="lightframe[|width:400px; height:300px; scrolling: auto;]">Search google</a>
+
+Controlling iframe property when grouped example:
+<a href="http://www.google.com" rel="lightframe[search|width:400px; height:300px; scrolling: auto;][Search Google]">Search google</a>
+<a href="http://www.yahoo.com" rel="lightframe[search|width:400px; height:300px;]">Search yahoo</a>
+<a href="http://www.yahoo.com" rel="lightframe[search|width:400px; height:300px;][Search Yahoo]">Search yahoo</a>
+
+Inline Content Support
+=======================
+It's possible to show HTML snippets in the lightbox, that is on the same domain.
+In this case the "rel" attribute should be set to "lightmodal".  Again it's
+possible to group the content, (e.g. "lightmodal[search]") but in addition to
+that, it's possible to control some of the inline / modal properties.  It's
+possible to set the 'width', 'height' and 'scrolling' properties of the inline
+content.  The properties are separated from the group name by a '|', for example
+"lightmodal[search|width:100px;]" and
+"lightmodal[search|width:100px;][my caption]".  If no grouping is being used,
+then the '|' is still used and the format would be "lightmodal[|width:100px;]".
+The properties should all be of the format "property: value;" - note the closing
+semi-colon.  If no properties are set, then the default width and height of
+400px will be used. See below for more detailed examples.
+
+Basic example:
+<a href="search.php" rel="lightmodal">Search</a>
+
+Basic example with caption:
+<a href="search.php" rel="lightmodal[][my caption]">Search</a>
+
+Grouped example:
+<a href="search.php" rel="lightmodal[search]">Search</a>
+<a href="search.php?status=1" rel="lightmodal[search][published]">Search published content</a>
+
+Controlling modal property example:
+<a href="search.php" rel="lightmodal[|width:400px; height:300px; scrolling: auto;]">Search</a>
+
+Controlling modal property when grouped example:
+<a href="search.php" rel="lightmodal[search|width:400px; height:300px; scrolling: auto;]">Search</a>
+<a href="search.php?status=1" rel="lightmodal[search|width:400px; height:300px;][Search published]">Search published content</a>
+<a href="search.php?status=0" rel="lightmodal[search|width:400px; height:300px;][Search Unpublished]">Search unpublished content</a>
+
+
+
+Turning the Image Caption into a Link
+=====================================
+If you wish to turn the caption into a link, format your caption in the
+following way:
+
+<a href="images/image-1.jpg" rel="lightbox[][&lt;a href=\"http://www.yourlink.com\"&gt;Clicky Visit Link&lt;/a&gt;'>image #1</a>
+
+Note, the < and > characters have been changed to their HTML entities, and the "
+have been escaped.
+
+
+KEYBOARD SHORTCUTS
+------------------
+Not all of the default keyboard shortcuts work in the Opera browser, for example
+'z' for toggling the zoom and 'spacebar' for toggling play / pause in
+slideshows.  This can be overcome by updating your shortcut settings in the
+Opera preferences editor.
+
+The default keyboard shortcuts are listed below.  You can override these on
+admin/settings/lightbox2.
+
+Close : x, o, c, ESC
+Previous Image : p, Left Arrow
+Next Image : n, Right Arrow
+Toggle Zoom : z (not available in slideshow)
+Toggle Play / Pause : Spacebar (slideshow only)
+
+
+TRANSLATION OF CONFIGURED STRINGS
+----------------------------------
+In order to translate the lightbox2 configuration strings, such as the text for
+the "View Image Details" link and the image count, please install the i18n:
+internationalization module and follow the instructions at 
+http://drupal.org/node/134002.
+
+
+KNOWN ISSUES
+------------
+
+Keyboard Shortcuts in Opera
+---------------------------
+Not all of the default keyboard shortcuts work in the Opera browser, for example
+'z' for toggling the zoom and 'spacebar' for toggling play / pause in
+slideshows.  This can be overcome by updating your shortcut settings in the
+Opera preferences editor.

+ 22 - 0
sites/all/modules/lightbox2/TODO.txt

@@ -0,0 +1,22 @@
+Drupal 7 port
+
+Works
+  * Add a image with rel="lightbox"
+  * Add a image group with rel="lightbox[group]"
+  * Slideshow using rel="lightshow[group]"
+  * HTML content using rel="lightframe"
+  * Modal with rel="lightmodal", and with settings, show a blank screen if
+    the url address is invalid(404 error)
+ 
+Integration with external modules
+  * acidvideo - There is not a drupal 7 version
+
+Not tested
+  * Video using rel=lightshow
+
+To do
+  * Add a description in hook_permission
+  * This is many filters without any action, look if this is really necessaary,
+    if not, remove the ones without action
+
+  

+ 62 - 0
sites/all/modules/lightbox2/css/lightbox-rtl.css

@@ -0,0 +1,62 @@
+/* $Id: lightbox-rtl.css,v 1.1.2.18 2010/06/07 14:43:02 snpower Exp $ */
+
+#imageData #imageDetails {
+  float: right;
+  text-align: right;
+}
+
+/* Image location mod */
+#bottomNavClose {
+  float: left;
+}
+
+#bottomNavZoom,
+#bottomNavZoomOut {
+  left: -30px;
+  float: left;
+}
+
+#lightshowPlay,
+#lightshowPause {
+  float: left;
+  margin-right: 0px;
+  margin-left: 5px;
+}
+
+#prevLink, #nextLink {
+  width: 49%;
+  height: 100%;
+  background: transparent url(../images/blank.gif) no-repeat; /* Trick IE into showing hover */
+  display: block;
+}
+
+#prevLink, #framePrevLink {
+  left: auto;
+  right: 0;
+  float: right;
+}
+
+#nextLink, #frameNextLink {
+  right: auto;
+  left: 0;
+  float: left;
+}
+
+#prevLink:hover, #prevLink:visited:hover, #prevLink.force_show_nav, #framePrevLink {
+  background: url(../images/next.gif) right 15% no-repeat;
+}
+
+#nextLink:hover, #nextLink:visited:hover, #nextLink.force_show_nav, #frameNextLink {
+  background: url(../images/prev.gif) left 15% no-repeat;
+}
+
+#prevLink:hover.force_show_nav, #prevLink:visited:hover.force_show_nav,
+#framePrevLink:hover, #framePrevLink:visited:hover {
+  background: url(../images/next_hover.gif) right 15% no-repeat;
+}
+
+#nextLink:hover.force_show_nav, #nextLink:visited:hover.force_show_nav,
+#frameNextLink:hover, #frameNextLink:visited:hover {
+  background: url(../images/prev_hover.gif) left 15% no-repeat;
+}
+

+ 284 - 0
sites/all/modules/lightbox2/css/lightbox.css

@@ -0,0 +1,284 @@
+/* $Id: lightbox.css,v 1.1.4.28 2010/09/22 10:47:15 snpower Exp $ */
+#lightbox {
+  position: absolute;
+  top: 40px;
+  left: 0;
+  width: 100%;
+  z-index: 100;
+  text-align: center;
+  line-height: 0;
+}
+
+#lightbox a img {
+  border: none;
+}
+
+#outerImageContainer {
+  position: relative;
+  background-color: #fff;
+  width: 250px;
+  height: 250px;
+  margin: 0 auto;
+  min-width: 240px;
+  overflow: hidden;
+}
+
+#imageContainer, #frameContainer, #modalContainer {
+  padding: 10px;
+}
+
+#modalContainer {
+  line-height: 1em;
+  overflow: auto;
+}
+
+#loading {
+  height: 25%;
+  width: 100%;
+  text-align: center;
+  line-height: 0;
+  position: absolute;
+  top: 40%;
+  left: 45%;
+  /* left: 0%; */
+}
+
+#hoverNav {
+  position: absolute;
+  top: 0;
+  left: 0;
+  height: 100%;
+  width: 100%;
+  z-index: 10;
+}
+
+#imageContainer>#hoverNav {
+  left: 0;
+}
+
+#frameHoverNav {
+  z-index: 10;
+  margin-left: auto;
+  margin-right: auto;
+  width: 20%;
+  position: absolute;
+  bottom: 0px;
+  height: 45px;
+}
+
+#imageData>#frameHoverNav {
+  left: 0;
+}
+
+#hoverNav a, #frameHoverNav a {
+  outline: none;
+}
+
+#prevLink, #nextLink {
+  width: 49%;
+  height: 100%;
+  background: transparent url(../images/blank.gif) no-repeat; /* Trick IE into showing hover */
+  display: block;
+}
+
+#prevLink, #framePrevLink {
+  left: 0;
+  float: left;
+}
+
+#nextLink, #frameNextLink {
+  right: 0;
+  float: right;
+}
+
+#prevLink:hover, #prevLink:visited:hover, #prevLink.force_show_nav, #framePrevLink {
+  background: url(../images/prev.gif) left 15% no-repeat;
+}
+
+#nextLink:hover, #nextLink:visited:hover, #nextLink.force_show_nav, #frameNextLink {
+  background: url(../images/next.gif) right 15% no-repeat;
+}
+
+#prevLink:hover.force_show_nav, #prevLink:visited:hover.force_show_nav,
+#framePrevLink:hover, #framePrevLink:visited:hover {
+  background: url(../images/prev_hover.gif) left 15% no-repeat;
+}
+
+#nextLink:hover.force_show_nav, #nextLink:visited:hover.force_show_nav,
+#frameNextLink:hover, #frameNextLink:visited:hover {
+  background: url(../images/next_hover.gif) right 15% no-repeat;
+}
+
+#framePrevLink, #frameNextLink {
+  width: 45px;
+  height: 45px;
+  display: block;
+  position: absolute;
+  bottom: 0px;
+}
+
+#imageDataContainer {
+  font: 10px Verdana, Helvetica, sans-serif;
+  background-color: #fff;
+  margin: 0 auto;
+  line-height: 1.4em;
+  min-width: 240px;
+}
+
+#imageData {
+  padding: 0 10px;
+}
+
+#imageData #imageDetails {
+  width: 70%;
+  float: left;
+  text-align: left;
+}
+
+#imageData #caption {
+  font-weight: bold;
+}
+
+#imageData #numberDisplay {
+  display: block;
+  clear: left;
+  padding-bottom: 1.0em;
+}
+
+#imageData #lightbox2-node-link-text {
+  display: block;
+  padding-bottom: 1.0em;
+}
+
+#imageData #bottomNav {
+  height: 66px;
+}
+.lightbox2-alt-layout #imageData #bottomNav,
+.lightbox2-alt-layout-data #bottomNav {
+  margin-bottom: 60px;
+}
+
+#lightbox2-overlay {
+  position: absolute;
+  top: 0;
+  left: 0;
+  z-index: 90;
+  width: 100%;
+  height: 500px;
+  background-color: #000;
+}
+
+#overlay_default {
+  opacity: 0.6;
+}
+
+#overlay_macff2 {
+  background: transparent url(../images/overlay.png) repeat;
+}
+
+.clearfix:after {
+  content: ".";
+  display: block;
+  height: 0;
+  clear: both;
+  visibility: hidden;
+}
+
+* html>body .clearfix {
+  display: inline;
+  width: 100%;
+}
+
+* html .clearfix {
+  /* Hides from IE-mac \*/
+  height: 1%;
+  /* End hide from IE-mac */
+}
+
+
+/* Image location mod */
+#bottomNavClose {
+  display: block;
+  background: url(../images/close.gif) left no-repeat;
+  margin-top: 33px;
+  float: right;
+  padding-top: 0.7em;
+  height: 26px;
+  width: 26px;
+}
+
+#bottomNavClose:hover {
+  background-position: right;
+}
+
+#loadingLink {
+  display: block;
+  background: url(../images/loading.gif) no-repeat;
+  width: 32px;
+  height: 32px;
+}
+
+#bottomNavZoom {
+  display: none;
+  background: url(../images/expand.gif) no-repeat;
+  width: 34px;
+  height: 34px;
+  position: relative;
+  left: 30px;
+  float: right;
+}
+
+#bottomNavZoomOut {
+  display: none;
+  background: url(../images/contract.gif) no-repeat;
+  width: 34px;
+  height: 34px;
+  position: relative;
+  left: 30px;
+  float: right;
+}
+
+#lightshowPlay {
+  margin-top: 42px;
+  float: right;
+  margin-right: 5px;
+  margin-bottom: 1px;
+  height: 20px;
+  width: 20px;
+  background: url(../images/play.png) no-repeat;
+}
+
+#lightshowPause {
+  margin-top: 42px;
+  float: right;
+  margin-right: 5px;
+  margin-bottom: 1px;
+  height: 20px;
+  width: 20px;
+  background: url(../images/pause.png) no-repeat;
+}
+
+.lightbox2-alt-layout-data #bottomNavClose,
+.lightbox2-alt-layout #bottomNavClose {
+  margin-top: 93px;
+}
+.lightbox2-alt-layout-data #bottomNavZoom,
+.lightbox2-alt-layout-data #bottomNavZoomOut,
+.lightbox2-alt-layout #bottomNavZoom,
+.lightbox2-alt-layout #bottomNavZoomOut {
+  margin-top: 93px;
+}
+.lightbox2-alt-layout-data #lightshowPlay,
+.lightbox2-alt-layout-data #lightshowPause,
+.lightbox2-alt-layout #lightshowPlay,
+.lightbox2-alt-layout #lightshowPause {
+  margin-top: 102px;
+}
+
+.lightbox_hide_image {
+  display: none;
+}
+
+#lightboxImage {
+  -ms-interpolation-mode: bicubic;
+}

+ 230 - 0
sites/all/modules/lightbox2/css/lightbox_alt.css

@@ -0,0 +1,230 @@
+/* $Id: lightbox_alt.css,v 1.1.4.22 2010/09/22 10:47:15 snpower Exp $ */
+/**
+ * Based on a design created by Nicolas Borda:
+ * http://www.ipwa.net/assets/myslimbox/
+ */
+
+#lightbox {
+  position: absolute;
+  top: 40px;
+  left: 0;
+  width: 100%;
+  z-index: 100;
+  text-align: center;
+  line-height: 0;
+}
+
+#lightbox a img {
+  border: none;
+}
+
+#outerImageContainer {
+  position: relative;
+  background-color: #fff;
+  width: 250px;
+  height: 250px;
+  margin: 0 auto;
+  min-width: 240px;
+  overflow: hidden;
+}
+
+#imageContainer, #frameContainer, #modalContainer {
+  padding: 10px;
+}
+
+#modalContainer {
+  line-height: 1em;
+  overflow: auto;
+}
+
+#loading {
+  height: 25%;
+  width: 100%;
+  text-align: center;
+  line-height: 0;
+  position: absolute;
+  top: 40%;
+  left: 45%;
+  *left: 0%;
+}
+
+#hoverNav {
+  z-index: 10;
+}
+
+#imageData>#hoverNav {
+  left: 0;
+}
+
+#hoverNav a {
+  outline: none;
+}
+
+#prevLink, #nextLink {
+  width: 45px;
+  height: 45px;
+  display: block;
+}
+
+#prevLink {
+  left: 0;
+  float: left;
+  background: url(../images/prev_alt.gif) left 15% no-repeat;
+}
+
+#nextLink {
+  right: 0;
+  float: right;
+  background: url(../images/next_alt.gif) right 15% no-repeat;
+}
+
+#prevLink:hover, #prevLink:visited:hover {
+  background-position: right 15%;
+}
+
+#nextLink:hover, #nextLink:visited:hover {
+  background-position: left 15%;
+}
+
+#imageDataContainer {
+  font: 10px Verdana, Helvetica, sans-serif;
+  background-color: #fff;
+  margin: 0 auto;
+  line-height: 1.4em;
+  min-width: 240px;
+}
+
+#imageData {
+  padding: 0 10px;
+}
+
+#imageData #imageDetails {
+  width: 70%;
+  margin-right: auto;
+  margin-left: auto;
+  text-align: center;
+}
+
+#imageData #caption {
+  font-weight: bold;
+}
+
+#imageData #numberDisplay {
+  display: block;
+  padding-bottom: 1.0em;
+}
+
+#imageData #lightbox2-node-link-text {
+  display: block;
+  padding-bottom: 1.0em;
+}
+
+#lightbox2-overlay {
+  position: absolute;
+  top: 0;
+  left: 0;
+  z-index: 90;
+  width: 100%;
+  height: 500px;
+  background-color: #000;
+}
+
+#overlay_default {
+  opacity: 0.6;
+}
+
+#overlay_macff2 {
+  background: transparent url(../images/overlay.png) repeat;
+}
+
+
+.clearfix:after {
+  content: ".";
+  display: block;
+  height: 0;
+  clear: both;
+  visibility: hidden;
+}
+
+* html>body .clearfix {
+  display: inline;
+  width: 100%;
+}
+
+* html .clearfix {
+  /* Hides from IE-mac \*/
+  height: 1%;
+  /* End hide from IE-mac */
+}
+
+
+/* Image location mod */
+#bottomNavClose {
+  display: block;
+  z-index: 200;
+  background: url(../images/close.gif) left no-repeat;
+  position: absolute;
+  top: 0px;
+  right: 0px;
+  height: 26px;
+  width: 26px;
+}
+
+#bottomNavClose:hover {
+  background-position: right;
+}
+
+#loadingLink {
+  display: block;
+  background: url(../images/loading.gif) no-repeat;
+  width: 32px;
+  height: 32px;
+}
+
+#bottomNavZoom {
+  display: block;
+  background: url(../images/expand.gif) no-repeat;
+  width: 34px;
+  height: 34px;
+  position: absolute;
+  bottom: 25px;
+  right: 5px;
+}
+
+#bottomNavZoomOut {
+  display: block;
+  background: url(../images/contract.gif) no-repeat;
+  width: 34px;
+  height: 34px;
+  position: absolute;
+  bottom: 25px;
+  right: 5px;
+}
+
+#lightshowPlay {
+  background: url(../images/play.png) no-repeat;
+  display: block;
+  margin-right: auto;
+  margin-left: auto;
+  margin-bottom: 5px;
+  height: 20px;
+  width: 20px;
+}
+
+#lightshowPause {
+  background: url(../images/pause.png) no-repeat;
+  display: block;
+  margin-right: auto;
+  margin-left: auto;
+  margin-bottom: 5px;
+  height: 20px;
+  width: 20px;
+}
+
+.lightbox_hide_image {
+  display: none;
+}
+
+#lightboxImage {
+  -ms-interpolation-mode: bicubic;
+}

+ 60 - 0
sites/all/modules/lightbox2/css/lightbox_lite-rtl.css

@@ -0,0 +1,60 @@
+/* $Id: lightbox_lite-rtl.css,v 1.1.2.6 2010/06/07 14:54:30 snpower Exp $ */
+#lightbox {
+  background-color: #eee;
+  padding: 10px;
+  border-bottom: 2px solid #666;
+  border-right: 2px solid #666;
+  min-width: 240px;
+}
+
+#lightboxDetails {
+  font-size: 1.2em;
+  padding-top: 0.6em;
+  min-width: 240px;
+}
+
+#lightboxCaption {
+  float: right;
+  font: 0.9em black;
+}
+
+#keyboardMsg {
+  float: left;
+  font: 0.9em black;
+}
+
+#closeButton {
+  top: 5px;
+  right: 5px;
+  width: 20px;
+  height: 20px;
+  position: absolute;
+  z-index: 200;
+  background: url(../images/close_lite.gif) no-repeat;
+}
+
+#loadingImage {
+  position: absolute;
+  top: 30%;
+  left: 45%;
+  height: 25%;
+  width: 100%;
+  text-align: center;
+  line-height: 0;
+  background: url(../images/loading_lite.gif) no-repeat;
+  width: 126px;
+  height: 22px;
+  z-index: 150;
+}
+
+#lightbox img {
+  border: none;
+  clear: both;
+}
+
+#lightbox2-overlay {
+  background-color: #333;
+  opacity: 0.6;
+  filter:alpha(opacity=60);
+}
+

+ 60 - 0
sites/all/modules/lightbox2/css/lightbox_lite.css

@@ -0,0 +1,60 @@
+/* $Id: lightbox_lite.css,v 1.1.4.11 2010/06/07 14:54:30 snpower Exp $ */
+#lightbox {
+  background-color: #eee;
+  padding: 10px;
+  border-bottom: 2px solid #666;
+  border-right: 2px solid #666;
+  min-width: 240px;
+}
+
+#lightboxDetails {
+  font-size: 1.2em;
+  padding-top: 0.6em;
+  min-width: 240px;
+}
+
+#lightboxCaption {
+  float: left;
+  font: 0.9em black;
+}
+
+#keyboardMsg {
+  float: right;
+  font: 0.9em black;
+}
+
+#closeButton {
+  top: 5px;
+  right: 5px;
+  width: 20px;
+  height: 20px;
+  position: absolute;
+  z-index: 200;
+  background: url(../images/close_lite.gif) no-repeat;
+}
+
+#loadingImage {
+  position: absolute;
+  top: 30%;
+  left: 45%;
+  height: 25%;
+  width: 100%;
+  text-align: center;
+  line-height: 0;
+  background: url(../images/loading_lite.gif) no-repeat;
+  width: 126px;
+  height: 22px;
+  z-index: 150;
+}
+
+#lightbox img {
+  border: none;
+  clear: both;
+}
+
+#lightbox2-overlay {
+  background-color: #333;
+  opacity: 0.6;
+  filter:alpha(opacity=60);
+}
+

BIN
sites/all/modules/lightbox2/images/blank.gif


BIN
sites/all/modules/lightbox2/images/brokenimage.jpg


BIN
sites/all/modules/lightbox2/images/close.gif


BIN
sites/all/modules/lightbox2/images/close_hover.gif


BIN
sites/all/modules/lightbox2/images/close_lite.gif


BIN
sites/all/modules/lightbox2/images/closelabel.gif


BIN
sites/all/modules/lightbox2/images/contract.gif


BIN
sites/all/modules/lightbox2/images/expand.gif


BIN
sites/all/modules/lightbox2/images/loading.gif


BIN
sites/all/modules/lightbox2/images/loading_lite.gif


BIN
sites/all/modules/lightbox2/images/next.gif


BIN
sites/all/modules/lightbox2/images/next_alt.gif


BIN
sites/all/modules/lightbox2/images/next_hover.gif


BIN
sites/all/modules/lightbox2/images/nextlabel.gif


BIN
sites/all/modules/lightbox2/images/overlay.png


BIN
sites/all/modules/lightbox2/images/pause.png


BIN
sites/all/modules/lightbox2/images/play.png


BIN
sites/all/modules/lightbox2/images/prev.gif


BIN
sites/all/modules/lightbox2/images/prev_alt.gif


BIN
sites/all/modules/lightbox2/images/prev_hover.gif


BIN
sites/all/modules/lightbox2/images/prevlabel.gif


File diff suppressed because it is too large
+ 33 - 0
sites/all/modules/lightbox2/js/auto_image_handling.js


+ 136 - 0
sites/all/modules/lightbox2/js/builder.js

@@ -0,0 +1,136 @@
+// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+var Builder = {
+  NODEMAP: {
+    AREA: 'map',
+    CAPTION: 'table',
+    COL: 'table',
+    COLGROUP: 'table',
+    LEGEND: 'fieldset',
+    OPTGROUP: 'select',
+    OPTION: 'select',
+    PARAM: 'object',
+    TBODY: 'table',
+    TD: 'table',
+    TFOOT: 'table',
+    TH: 'table',
+    THEAD: 'table',
+    TR: 'table'
+  },
+  // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
+  //       due to a Firefox bug
+  node: function(elementName) {
+    elementName = elementName.toUpperCase();
+    
+    // try innerHTML approach
+    var parentTag = this.NODEMAP[elementName] || 'div';
+    var parentElement = document.createElement(parentTag);
+    try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
+      parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
+    } catch(e) {}
+    var element = parentElement.firstChild || null;
+      
+    // see if browser added wrapping tags
+    if(element && (element.tagName.toUpperCase() != elementName))
+      element = element.getElementsByTagName(elementName)[0];
+    
+    // fallback to createElement approach
+    if(!element) element = document.createElement(elementName);
+    
+    // abort if nothing could be created
+    if(!element) return;
+
+    // attributes (or text)
+    if(arguments[1])
+      if(this._isStringOrNumber(arguments[1]) ||
+        (arguments[1] instanceof Array) ||
+        arguments[1].tagName) {
+          this._children(element, arguments[1]);
+        } else {
+          var attrs = this._attributes(arguments[1]);
+          if(attrs.length) {
+            try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
+              parentElement.innerHTML = "<" +elementName + " " +
+                attrs + "></" + elementName + ">";
+            } catch(e) {}
+            element = parentElement.firstChild || null;
+            // workaround firefox 1.0.X bug
+            if(!element) {
+              element = document.createElement(elementName);
+              for(attr in arguments[1]) 
+                element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
+            }
+            if(element.tagName.toUpperCase() != elementName)
+              element = parentElement.getElementsByTagName(elementName)[0];
+          }
+        } 
+
+    // text, or array of children
+    if(arguments[2])
+      this._children(element, arguments[2]);
+
+     return element;
+  },
+  _text: function(text) {
+     return document.createTextNode(text);
+  },
+
+  ATTR_MAP: {
+    'className': 'class',
+    'htmlFor': 'for'
+  },
+
+  _attributes: function(attributes) {
+    var attrs = [];
+    for(attribute in attributes)
+      attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
+          '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;') + '"');
+    return attrs.join(" ");
+  },
+  _children: function(element, children) {
+    if(children.tagName) {
+      element.appendChild(children);
+      return;
+    }
+    if(typeof children=='object') { // array can hold nodes and text
+      children.flatten().each( function(e) {
+        if(typeof e=='object')
+          element.appendChild(e)
+        else
+          if(Builder._isStringOrNumber(e))
+            element.appendChild(Builder._text(e));
+      });
+    } else
+      if(Builder._isStringOrNumber(children))
+        element.appendChild(Builder._text(children));
+  },
+  _isStringOrNumber: function(param) {
+    return(typeof param=='string' || typeof param=='number');
+  },
+  build: function(html) {
+    var element = this.node('div');
+    $(element).update(html.strip());
+    return element.down();
+  },
+  dump: function(scope) { 
+    if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope 
+  
+    var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
+      "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
+      "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
+      "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
+      "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
+      "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
+  
+    tags.each( function(tag){ 
+      scope[tag] = function() { 
+        return Builder.node.apply(Builder, [tag].concat($A(arguments)));  
+      } 
+    });
+  }
+}

+ 1122 - 0
sites/all/modules/lightbox2/js/effects.js

@@ -0,0 +1,1122 @@
+// script.aculo.us effects.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// Contributors:
+//  Justin Palmer (http://encytemedia.com/)
+//  Mark Pilgrim (http://diveintomark.org/)
+//  Martin Bialasinki
+// 
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/ 
+
+// converts rgb() and #xxx to #xxxxxx format,  
+// returns self (or first argument) if not convertable  
+String.prototype.parseColor = function() {  
+  var color = '#';
+  if (this.slice(0,4) == 'rgb(') {  
+    var cols = this.slice(4,this.length-1).split(',');  
+    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);  
+  } else {  
+    if (this.slice(0,1) == '#') {  
+      if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();  
+      if (this.length==7) color = this.toLowerCase();  
+    }  
+  }  
+  return (color.length==7 ? color : (arguments[0] || this));  
+};
+
+/*--------------------------------------------------------------------------*/
+
+Element.collectTextNodes = function(element) {  
+  return $A($(element).childNodes).collect( function(node) {
+    return (node.nodeType==3 ? node.nodeValue : 
+      (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
+  }).flatten().join('');
+};
+
+Element.collectTextNodesIgnoreClass = function(element, className) {  
+  return $A($(element).childNodes).collect( function(node) {
+    return (node.nodeType==3 ? node.nodeValue : 
+      ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? 
+        Element.collectTextNodesIgnoreClass(node, className) : ''));
+  }).flatten().join('');
+};
+
+Element.setContentZoom = function(element, percent) {
+  element = $(element);  
+  element.setStyle({fontSize: (percent/100) + 'em'});   
+  if (Prototype.Browser.WebKit) window.scrollBy(0,0);
+  return element;
+};
+
+Element.getInlineOpacity = function(element){
+  return $(element).style.opacity || '';
+};
+
+Element.forceRerendering = function(element) {
+  try {
+    element = $(element);
+    var n = document.createTextNode(' ');
+    element.appendChild(n);
+    element.removeChild(n);
+  } catch(e) { }
+};
+
+/*--------------------------------------------------------------------------*/
+
+var Effect = {
+  _elementDoesNotExistError: {
+    name: 'ElementDoesNotExistError',
+    message: 'The specified DOM element does not exist, but is required for this effect to operate'
+  },
+  Transitions: {
+    linear: Prototype.K,
+    sinoidal: function(pos) {
+      return (-Math.cos(pos*Math.PI)/2) + 0.5;
+    },
+    reverse: function(pos) {
+      return 1-pos;
+    },
+    flicker: function(pos) {
+      var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
+      return pos > 1 ? 1 : pos;
+    },
+    wobble: function(pos) {
+      return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
+    },
+    pulse: function(pos, pulses) { 
+      pulses = pulses || 5; 
+      return (
+        ((pos % (1/pulses)) * pulses).round() == 0 ? 
+              ((pos * pulses * 2) - (pos * pulses * 2).floor()) : 
+          1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
+        );
+    },
+    spring: function(pos) { 
+      return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); 
+    },
+    none: function(pos) {
+      return 0;
+    },
+    full: function(pos) {
+      return 1;
+    }
+  },
+  DefaultOptions: {
+    duration:   1.0,   // seconds
+    fps:        100,   // 100= assume 66fps max.
+    sync:       false, // true for combining
+    from:       0.0,
+    to:         1.0,
+    delay:      0.0,
+    queue:      'parallel'
+  },
+  tagifyText: function(element) {
+    var tagifyStyle = 'position:relative';
+    if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
+    
+    element = $(element);
+    $A(element.childNodes).each( function(child) {
+      if (child.nodeType==3) {
+        child.nodeValue.toArray().each( function(character) {
+          element.insertBefore(
+            new Element('span', {style: tagifyStyle}).update(
+              character == ' ' ? String.fromCharCode(160) : character), 
+              child);
+        });
+        Element.remove(child);
+      }
+    });
+  },
+  multiple: function(element, effect) {
+    var elements;
+    if (((typeof element == 'object') || 
+        Object.isFunction(element)) && 
+       (element.length))
+      elements = element;
+    else
+      elements = $(element).childNodes;
+      
+    var options = Object.extend({
+      speed: 0.1,
+      delay: 0.0
+    }, arguments[2] || { });
+    var masterDelay = options.delay;
+
+    $A(elements).each( function(element, index) {
+      new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
+    });
+  },
+  PAIRS: {
+    'slide':  ['SlideDown','SlideUp'],
+    'blind':  ['BlindDown','BlindUp'],
+    'appear': ['Appear','Fade']
+  },
+  toggle: function(element, effect) {
+    element = $(element);
+    effect = (effect || 'appear').toLowerCase();
+    var options = Object.extend({
+      queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
+    }, arguments[2] || { });
+    Effect[element.visible() ? 
+      Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
+  }
+};
+
+Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;
+
+/* ------------- core effects ------------- */
+
+Effect.ScopedQueue = Class.create(Enumerable, {
+  initialize: function() {
+    this.effects  = [];
+    this.interval = null;    
+  },
+  _each: function(iterator) {
+    this.effects._each(iterator);
+  },
+  add: function(effect) {
+    var timestamp = new Date().getTime();
+    
+    var position = Object.isString(effect.options.queue) ? 
+      effect.options.queue : effect.options.queue.position;
+    
+    switch(position) {
+      case 'front':
+        // move unstarted effects after this effect  
+        this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
+            e.startOn  += effect.finishOn;
+            e.finishOn += effect.finishOn;
+          });
+        break;
+      case 'with-last':
+        timestamp = this.effects.pluck('startOn').max() || timestamp;
+        break;
+      case 'end':
+        // start effect after last queued effect has finished
+        timestamp = this.effects.pluck('finishOn').max() || timestamp;
+        break;
+    }
+    
+    effect.startOn  += timestamp;
+    effect.finishOn += timestamp;
+
+    if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
+      this.effects.push(effect);
+    
+    if (!this.interval)
+      this.interval = setInterval(this.loop.bind(this), 15);
+  },
+  remove: function(effect) {
+    this.effects = this.effects.reject(function(e) { return e==effect });
+    if (this.effects.length == 0) {
+      clearInterval(this.interval);
+      this.interval = null;
+    }
+  },
+  loop: function() {
+    var timePos = new Date().getTime();
+    for(var i=0, len=this.effects.length;i<len;i++) 
+      this.effects[i] && this.effects[i].loop(timePos);
+  }
+});
+
+Effect.Queues = {
+  instances: $H(),
+  get: function(queueName) {
+    if (!Object.isString(queueName)) return queueName;
+    
+    return this.instances.get(queueName) ||
+      this.instances.set(queueName, new Effect.ScopedQueue());
+  }
+};
+Effect.Queue = Effect.Queues.get('global');
+
+Effect.Base = Class.create({
+  position: null,
+  start: function(options) {
+    function codeForEvent(options,eventName){
+      return (
+        (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
+        (options[eventName] ? 'this.options.'+eventName+'(this);' : '')
+      );
+    }
+    if (options && options.transition === false) options.transition = Effect.Transitions.linear;
+    this.options      = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
+    this.currentFrame = 0;
+    this.state        = 'idle';
+    this.startOn      = this.options.delay*1000;
+    this.finishOn     = this.startOn+(this.options.duration*1000);
+    this.fromToDelta  = this.options.to-this.options.from;
+    this.totalTime    = this.finishOn-this.startOn;
+    this.totalFrames  = this.options.fps*this.options.duration;
+    
+    eval('this.render = function(pos){ '+
+      'if (this.state=="idle"){this.state="running";'+
+      codeForEvent(this.options,'beforeSetup')+
+      (this.setup ? 'this.setup();':'')+ 
+      codeForEvent(this.options,'afterSetup')+
+      '};if (this.state=="running"){'+
+      'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
+      'this.position=pos;'+
+      codeForEvent(this.options,'beforeUpdate')+
+      (this.update ? 'this.update(pos);':'')+
+      codeForEvent(this.options,'afterUpdate')+
+      '}}');
+    
+    this.event('beforeStart');
+    if (!this.options.sync)
+      Effect.Queues.get(Object.isString(this.options.queue) ? 
+        'global' : this.options.queue.scope).add(this);
+  },
+  loop: function(timePos) {
+    if (timePos >= this.startOn) {
+      if (timePos >= this.finishOn) {
+        this.render(1.0);
+        this.cancel();
+        this.event('beforeFinish');
+        if (this.finish) this.finish(); 
+        this.event('afterFinish');
+        return;  
+      }
+      var pos   = (timePos - this.startOn) / this.totalTime,
+          frame = (pos * this.totalFrames).round();
+      if (frame > this.currentFrame) {
+        this.render(pos);
+        this.currentFrame = frame;
+      }
+    }
+  },
+  cancel: function() {
+    if (!this.options.sync)
+      Effect.Queues.get(Object.isString(this.options.queue) ? 
+        'global' : this.options.queue.scope).remove(this);
+    this.state = 'finished';
+  },
+  event: function(eventName) {
+    if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
+    if (this.options[eventName]) this.options[eventName](this);
+  },
+  inspect: function() {
+    var data = $H();
+    for(property in this)
+      if (!Object.isFunction(this[property])) data.set(property, this[property]);
+    return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
+  }
+});
+
+Effect.Parallel = Class.create(Effect.Base, {
+  initialize: function(effects) {
+    this.effects = effects || [];
+    this.start(arguments[1]);
+  },
+  update: function(position) {
+    this.effects.invoke('render', position);
+  },
+  finish: function(position) {
+    this.effects.each( function(effect) {
+      effect.render(1.0);
+      effect.cancel();
+      effect.event('beforeFinish');
+      if (effect.finish) effect.finish(position);
+      effect.event('afterFinish');
+    });
+  }
+});
+
+Effect.Tween = Class.create(Effect.Base, {
+  initialize: function(object, from, to) {
+    object = Object.isString(object) ? $(object) : object;
+    var args = $A(arguments), method = args.last(), 
+      options = args.length == 5 ? args[3] : null;
+    this.method = Object.isFunction(method) ? method.bind(object) :
+      Object.isFunction(object[method]) ? object[method].bind(object) : 
+      function(value) { object[method] = value };
+    this.start(Object.extend({ from: from, to: to }, options || { }));
+  },
+  update: function(position) {
+    this.method(position);
+  }
+});
+
+Effect.Event = Class.create(Effect.Base, {
+  initialize: function() {
+    this.start(Object.extend({ duration: 0 }, arguments[0] || { }));
+  },
+  update: Prototype.emptyFunction
+});
+
+Effect.Opacity = Class.create(Effect.Base, {
+  initialize: function(element) {
+    this.element = $(element);
+    if (!this.element) throw(Effect._elementDoesNotExistError);
+    // make this work on IE on elements without 'layout'
+    if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
+      this.element.setStyle({zoom: 1});
+    var options = Object.extend({
+      from: this.element.getOpacity() || 0.0,
+      to:   1.0
+    }, arguments[1] || { });
+    this.start(options);
+  },
+  update: function(position) {
+    this.element.setOpacity(position);
+  }
+});
+
+Effect.Move = Class.create(Effect.Base, {
+  initialize: function(element) {
+    this.element = $(element);
+    if (!this.element) throw(Effect._elementDoesNotExistError);
+    var options = Object.extend({
+      x:    0,
+      y:    0,
+      mode: 'relative'
+    }, arguments[1] || { });
+    this.start(options);
+  },
+  setup: function() {
+    this.element.makePositioned();
+    this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
+    this.originalTop  = parseFloat(this.element.getStyle('top')  || '0');
+    if (this.options.mode == 'absolute') {
+      this.options.x = this.options.x - this.originalLeft;
+      this.options.y = this.options.y - this.originalTop;
+    }
+  },
+  update: function(position) {
+    this.element.setStyle({
+      left: (this.options.x  * position + this.originalLeft).round() + 'px',
+      top:  (this.options.y  * position + this.originalTop).round()  + 'px'
+    });
+  }
+});
+
+// for backwards compatibility
+Effect.MoveBy = function(element, toTop, toLeft) {
+  return new Effect.Move(element, 
+    Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
+};
+
+Effect.Scale = Class.create(Effect.Base, {
+  initialize: function(element, percent) {
+    this.element = $(element);
+    if (!this.element) throw(Effect._elementDoesNotExistError);
+    var options = Object.extend({
+      scaleX: true,
+      scaleY: true,
+      scaleContent: true,
+      scaleFromCenter: false,
+      scaleMode: 'box',        // 'box' or 'contents' or { } with provided values
+      scaleFrom: 100.0,
+      scaleTo:   percent
+    }, arguments[2] || { });
+    this.start(options);
+  },
+  setup: function() {
+    this.restoreAfterFinish = this.options.restoreAfterFinish || false;
+    this.elementPositioning = this.element.getStyle('position');
+    
+    this.originalStyle = { };
+    ['top','left','width','height','fontSize'].each( function(k) {
+      this.originalStyle[k] = this.element.style[k];
+    }.bind(this));
+      
+    this.originalTop  = this.element.offsetTop;
+    this.originalLeft = this.element.offsetLeft;
+    
+    var fontSize = this.element.getStyle('font-size') || '100%';
+    ['em','px','%','pt'].each( function(fontSizeType) {
+      if (fontSize.indexOf(fontSizeType)>0) {
+        this.fontSize     = parseFloat(fontSize);
+        this.fontSizeType = fontSizeType;
+      }
+    }.bind(this));
+    
+    this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
+    
+    this.dims = null;
+    if (this.options.scaleMode=='box')
+      this.dims = [this.element.offsetHeight, this.element.offsetWidth];
+    if (/^content/.test(this.options.scaleMode))
+      this.dims = [this.element.scrollHeight, this.element.scrollWidth];
+    if (!this.dims)
+      this.dims = [this.options.scaleMode.originalHeight,
+                   this.options.scaleMode.originalWidth];
+  },
+  update: function(position) {
+    var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
+    if (this.options.scaleContent && this.fontSize)
+      this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
+    this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
+  },
+  finish: function(position) {
+    if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
+  },
+  setDimensions: function(height, width) {
+    var d = { };
+    if (this.options.scaleX) d.width = width.round() + 'px';
+    if (this.options.scaleY) d.height = height.round() + 'px';
+    if (this.options.scaleFromCenter) {
+      var topd  = (height - this.dims[0])/2;
+      var leftd = (width  - this.dims[1])/2;
+      if (this.elementPositioning == 'absolute') {
+        if (this.options.scaleY) d.top = this.originalTop-topd + 'px';
+        if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
+      } else {
+        if (this.options.scaleY) d.top = -topd + 'px';
+        if (this.options.scaleX) d.left = -leftd + 'px';
+      }
+    }
+    this.element.setStyle(d);
+  }
+});
+
+Effect.Highlight = Class.create(Effect.Base, {
+  initialize: function(element) {
+    this.element = $(element);
+    if (!this.element) throw(Effect._elementDoesNotExistError);
+    var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { });
+    this.start(options);
+  },
+  setup: function() {
+    // Prevent executing on elements not in the layout flow
+    if (this.element.getStyle('display')=='none') { this.cancel(); return; }
+    // Disable background image during the effect
+    this.oldStyle = { };
+    if (!this.options.keepBackgroundImage) {
+      this.oldStyle.backgroundImage = this.element.getStyle('background-image');
+      this.element.setStyle({backgroundImage: 'none'});
+    }
+    if (!this.options.endcolor)
+      this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
+    if (!this.options.restorecolor)
+      this.options.restorecolor = this.element.getStyle('background-color');
+    // init color calculations
+    this._base  = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
+    this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
+  },
+  update: function(position) {
+    this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
+      return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) });
+  },
+  finish: function() {
+    this.element.setStyle(Object.extend(this.oldStyle, {
+      backgroundColor: this.options.restorecolor
+    }));
+  }
+});
+
+Effect.ScrollTo = function(element) {
+  var options = arguments[1] || { },
+    scrollOffsets = document.viewport.getScrollOffsets(),
+    elementOffsets = $(element).cumulativeOffset(),
+    max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();  
+
+  if (options.offset) elementOffsets[1] += options.offset;
+
+  return new Effect.Tween(null,
+    scrollOffsets.top,
+    elementOffsets[1] > max ? max : elementOffsets[1],
+    options,
+    function(p){ scrollTo(scrollOffsets.left, p.round()) }
+  );
+};
+
+/* ------------- combination effects ------------- */
+
+Effect.Fade = function(element) {
+  element = $(element);
+  var oldOpacity = element.getInlineOpacity();
+  var options = Object.extend({
+    from: element.getOpacity() || 1.0,
+    to:   0.0,
+    afterFinishInternal: function(effect) { 
+      if (effect.options.to!=0) return;
+      effect.element.hide().setStyle({opacity: oldOpacity}); 
+    }
+  }, arguments[1] || { });
+  return new Effect.Opacity(element,options);
+};
+
+Effect.Appear = function(element) {
+  element = $(element);
+  var options = Object.extend({
+  from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
+  to:   1.0,
+  // force Safari to render floated elements properly
+  afterFinishInternal: function(effect) {
+    effect.element.forceRerendering();
+  },
+  beforeSetup: function(effect) {
+    effect.element.setOpacity(effect.options.from).show(); 
+  }}, arguments[1] || { });
+  return new Effect.Opacity(element,options);
+};
+
+Effect.Puff = function(element) {
+  element = $(element);
+  var oldStyle = { 
+    opacity: element.getInlineOpacity(), 
+    position: element.getStyle('position'),
+    top:  element.style.top,
+    left: element.style.left,
+    width: element.style.width,
+    height: element.style.height
+  };
+  return new Effect.Parallel(
+   [ new Effect.Scale(element, 200, 
+      { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 
+     new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 
+     Object.extend({ duration: 1.0, 
+      beforeSetupInternal: function(effect) {
+        Position.absolutize(effect.effects[0].element)
+      },
+      afterFinishInternal: function(effect) {
+         effect.effects[0].element.hide().setStyle(oldStyle); }
+     }, arguments[1] || { })
+   );
+};
+
+Effect.BlindUp = function(element) {
+  element = $(element);
+  element.makeClipping();
+  return new Effect.Scale(element, 0,
+    Object.extend({ scaleContent: false, 
+      scaleX: false, 
+      restoreAfterFinish: true,
+      afterFinishInternal: function(effect) {
+        effect.element.hide().undoClipping();
+      } 
+    }, arguments[1] || { })
+  );
+};
+
+Effect.BlindDown = function(element) {
+  element = $(element);
+  var elementDimensions = element.getDimensions();
+  return new Effect.Scale(element, 100, Object.extend({ 
+    scaleContent: false, 
+    scaleX: false,
+    scaleFrom: 0,
+    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
+    restoreAfterFinish: true,
+    afterSetup: function(effect) {
+      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
+    },  
+    afterFinishInternal: function(effect) {
+      effect.element.undoClipping();
+    }
+  }, arguments[1] || { }));
+};
+
+Effect.SwitchOff = function(element) {
+  element = $(element);
+  var oldOpacity = element.getInlineOpacity();
+  return new Effect.Appear(element, Object.extend({
+    duration: 0.4,
+    from: 0,
+    transition: Effect.Transitions.flicker,
+    afterFinishInternal: function(effect) {
+      new Effect.Scale(effect.element, 1, { 
+        duration: 0.3, scaleFromCenter: true,
+        scaleX: false, scaleContent: false, restoreAfterFinish: true,
+        beforeSetup: function(effect) { 
+          effect.element.makePositioned().makeClipping();
+        },
+        afterFinishInternal: function(effect) {
+          effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
+        }
+      })
+    }
+  }, arguments[1] || { }));
+};
+
+Effect.DropOut = function(element) {
+  element = $(element);
+  var oldStyle = {
+    top: element.getStyle('top'),
+    left: element.getStyle('left'),
+    opacity: element.getInlineOpacity() };
+  return new Effect.Parallel(
+    [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 
+      new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
+    Object.extend(
+      { duration: 0.5,
+        beforeSetup: function(effect) {
+          effect.effects[0].element.makePositioned(); 
+        },
+        afterFinishInternal: function(effect) {
+          effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
+        } 
+      }, arguments[1] || { }));
+};
+
+Effect.Shake = function(element) {
+  element = $(element);
+  var options = Object.extend({
+    distance: 20,
+    duration: 0.5
+  }, arguments[1] || {});
+  var distance = parseFloat(options.distance);
+  var split = parseFloat(options.duration) / 10.0;
+  var oldStyle = {
+    top: element.getStyle('top'),
+    left: element.getStyle('left') };
+    return new Effect.Move(element,
+      { x:  distance, y: 0, duration: split, afterFinishInternal: function(effect) {
+    new Effect.Move(effect.element,
+      { x: -distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
+    new Effect.Move(effect.element,
+      { x:  distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
+    new Effect.Move(effect.element,
+      { x: -distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
+    new Effect.Move(effect.element,
+      { x:  distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
+    new Effect.Move(effect.element,
+      { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
+        effect.element.undoPositioned().setStyle(oldStyle);
+  }}) }}) }}) }}) }}) }});
+};
+
+Effect.SlideDown = function(element) {
+  element = $(element).cleanWhitespace();
+  // SlideDown need to have the content of the element wrapped in a container element with fixed height!
+  var oldInnerBottom = element.down().getStyle('bottom');
+  var elementDimensions = element.getDimensions();
+  return new Effect.Scale(element, 100, Object.extend({ 
+    scaleContent: false, 
+    scaleX: false, 
+    scaleFrom: window.opera ? 0 : 1,
+    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
+    restoreAfterFinish: true,
+    afterSetup: function(effect) {
+      effect.element.makePositioned();
+      effect.element.down().makePositioned();
+      if (window.opera) effect.element.setStyle({top: ''});
+      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
+    },
+    afterUpdateInternal: function(effect) {
+      effect.element.down().setStyle({bottom:
+        (effect.dims[0] - effect.element.clientHeight) + 'px' }); 
+    },
+    afterFinishInternal: function(effect) {
+      effect.element.undoClipping().undoPositioned();
+      effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
+    }, arguments[1] || { })
+  );
+};
+
+Effect.SlideUp = function(element) {
+  element = $(element).cleanWhitespace();
+  var oldInnerBottom = element.down().getStyle('bottom');
+  var elementDimensions = element.getDimensions();
+  return new Effect.Scale(element, window.opera ? 0 : 1,
+   Object.extend({ scaleContent: false, 
+    scaleX: false, 
+    scaleMode: 'box',
+    scaleFrom: 100,
+    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
+    restoreAfterFinish: true,
+    afterSetup: function(effect) {
+      effect.element.makePositioned();
+      effect.element.down().makePositioned();
+      if (window.opera) effect.element.setStyle({top: ''});
+      effect.element.makeClipping().show();
+    },  
+    afterUpdateInternal: function(effect) {
+      effect.element.down().setStyle({bottom:
+        (effect.dims[0] - effect.element.clientHeight) + 'px' });
+    },
+    afterFinishInternal: function(effect) {
+      effect.element.hide().undoClipping().undoPositioned();
+      effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom});
+    }
+   }, arguments[1] || { })
+  );
+};
+
+// Bug in opera makes the TD containing this element expand for a instance after finish 
+Effect.Squish = function(element) {
+  return new Effect.Scale(element, window.opera ? 1 : 0, { 
+    restoreAfterFinish: true,
+    beforeSetup: function(effect) {
+      effect.element.makeClipping(); 
+    },  
+    afterFinishInternal: function(effect) {
+      effect.element.hide().undoClipping(); 
+    }
+  });
+};
+
+Effect.Grow = function(element) {
+  element = $(element);
+  var options = Object.extend({
+    direction: 'center',
+    moveTransition: Effect.Transitions.sinoidal,
+    scaleTransition: Effect.Transitions.sinoidal,
+    opacityTransition: Effect.Transitions.full
+  }, arguments[1] || { });
+  var oldStyle = {
+    top: element.style.top,
+    left: element.style.left,
+    height: element.style.height,
+    width: element.style.width,
+    opacity: element.getInlineOpacity() };
+
+  var dims = element.getDimensions();    
+  var initialMoveX, initialMoveY;
+  var moveX, moveY;
+  
+  switch (options.direction) {
+    case 'top-left':
+      initialMoveX = initialMoveY = moveX = moveY = 0; 
+      break;
+    case 'top-right':
+      initialMoveX = dims.width;
+      initialMoveY = moveY = 0;
+      moveX = -dims.width;
+      break;
+    case 'bottom-left':
+      initialMoveX = moveX = 0;
+      initialMoveY = dims.height;
+      moveY = -dims.height;
+      break;
+    case 'bottom-right':
+      initialMoveX = dims.width;
+      initialMoveY = dims.height;
+      moveX = -dims.width;
+      moveY = -dims.height;
+      break;
+    case 'center':
+      initialMoveX = dims.width / 2;
+      initialMoveY = dims.height / 2;
+      moveX = -dims.width / 2;
+      moveY = -dims.height / 2;
+      break;
+  }
+  
+  return new Effect.Move(element, {
+    x: initialMoveX,
+    y: initialMoveY,
+    duration: 0.01, 
+    beforeSetup: function(effect) {
+      effect.element.hide().makeClipping().makePositioned();
+    },
+    afterFinishInternal: function(effect) {
+      new Effect.Parallel(
+        [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
+          new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
+          new Effect.Scale(effect.element, 100, {
+            scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 
+            sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
+        ], Object.extend({
+             beforeSetup: function(effect) {
+               effect.effects[0].element.setStyle({height: '0px'}).show(); 
+             },
+             afterFinishInternal: function(effect) {
+               effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); 
+             }
+           }, options)
+      )
+    }
+  });
+};
+
+Effect.Shrink = function(element) {
+  element = $(element);
+  var options = Object.extend({
+    direction: 'center',
+    moveTransition: Effect.Transitions.sinoidal,
+    scaleTransition: Effect.Transitions.sinoidal,
+    opacityTransition: Effect.Transitions.none
+  }, arguments[1] || { });
+  var oldStyle = {
+    top: element.style.top,
+    left: element.style.left,
+    height: element.style.height,
+    width: element.style.width,
+    opacity: element.getInlineOpacity() };
+
+  var dims = element.getDimensions();
+  var moveX, moveY;
+  
+  switch (options.direction) {
+    case 'top-left':
+      moveX = moveY = 0;
+      break;
+    case 'top-right':
+      moveX = dims.width;
+      moveY = 0;
+      break;
+    case 'bottom-left':
+      moveX = 0;
+      moveY = dims.height;
+      break;
+    case 'bottom-right':
+      moveX = dims.width;
+      moveY = dims.height;
+      break;
+    case 'center':  
+      moveX = dims.width / 2;
+      moveY = dims.height / 2;
+      break;
+  }
+  
+  return new Effect.Parallel(
+    [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
+      new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
+      new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
+    ], Object.extend({            
+         beforeStartInternal: function(effect) {
+           effect.effects[0].element.makePositioned().makeClipping(); 
+         },
+         afterFinishInternal: function(effect) {
+           effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
+       }, options)
+  );
+};
+
+Effect.Pulsate = function(element) {
+  element = $(element);
+  var options    = arguments[1] || { };
+  var oldOpacity = element.getInlineOpacity();
+  var transition = options.transition || Effect.Transitions.sinoidal;
+  var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
+  reverser.bind(transition);
+  return new Effect.Opacity(element, 
+    Object.extend(Object.extend({  duration: 2.0, from: 0,
+      afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
+    }, options), {transition: reverser}));
+};
+
+Effect.Fold = function(element) {
+  element = $(element);
+  var oldStyle = {
+    top: element.style.top,
+    left: element.style.left,
+    width: element.style.width,
+    height: element.style.height };
+  element.makeClipping();
+  return new Effect.Scale(element, 5, Object.extend({   
+    scaleContent: false,
+    scaleX: false,
+    afterFinishInternal: function(effect) {
+    new Effect.Scale(element, 1, { 
+      scaleContent: false, 
+      scaleY: false,
+      afterFinishInternal: function(effect) {
+        effect.element.hide().undoClipping().setStyle(oldStyle);
+      } });
+  }}, arguments[1] || { }));
+};
+
+Effect.Morph = Class.create(Effect.Base, {
+  initialize: function(element) {
+    this.element = $(element);
+    if (!this.element) throw(Effect._elementDoesNotExistError);
+    var options = Object.extend({
+      style: { }
+    }, arguments[1] || { });
+    
+    if (!Object.isString(options.style)) this.style = $H(options.style);
+    else {
+      if (options.style.include(':'))
+        this.style = options.style.parseStyle();
+      else {
+        this.element.addClassName(options.style);
+        this.style = $H(this.element.getStyles());
+        this.element.removeClassName(options.style);
+        var css = this.element.getStyles();
+        this.style = this.style.reject(function(style) {
+          return style.value == css[style.key];
+        });
+        options.afterFinishInternal = function(effect) {
+          effect.element.addClassName(effect.options.style);
+          effect.transforms.each(function(transform) {
+            effect.element.style[transform.style] = '';
+          });
+        }
+      }
+    }
+    this.start(options);
+  },
+  
+  setup: function(){
+    function parseColor(color){
+      if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
+      color = color.parseColor();
+      return $R(0,2).map(function(i){
+        return parseInt( color.slice(i*2+1,i*2+3), 16 ) 
+      });
+    }
+    this.transforms = this.style.map(function(pair){
+      var property = pair[0], value = pair[1], unit = null;
+
+      if (value.parseColor('#zzzzzz') != '#zzzzzz') {
+        value = value.parseColor();
+        unit  = 'color';
+      } else if (property == 'opacity') {
+        value = parseFloat(value);
+        if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
+          this.element.setStyle({zoom: 1});
+      } else if (Element.CSS_LENGTH.test(value)) {
+          var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
+          value = parseFloat(components[1]);
+          unit = (components.length == 3) ? components[2] : null;
+      }
+
+      var originalValue = this.element.getStyle(property);
+      return { 
+        style: property.camelize(), 
+        originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), 
+        targetValue: unit=='color' ? parseColor(value) : value,
+        unit: unit
+      };
+    }.bind(this)).reject(function(transform){
+      return (
+        (transform.originalValue == transform.targetValue) ||
+        (
+          transform.unit != 'color' &&
+          (isNaN(transform.originalValue) || isNaN(transform.targetValue))
+        )
+      )
+    });
+  },
+  update: function(position) {
+    var style = { }, transform, i = this.transforms.length;
+    while(i--)
+      style[(transform = this.transforms[i]).style] = 
+        transform.unit=='color' ? '#'+
+          (Math.round(transform.originalValue[0]+
+            (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
+          (Math.round(transform.originalValue[1]+
+            (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() +
+          (Math.round(transform.originalValue[2]+
+            (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
+        (transform.originalValue +
+          (transform.targetValue - transform.originalValue) * position).toFixed(3) + 
+            (transform.unit === null ? '' : transform.unit);
+    this.element.setStyle(style, true);
+  }
+});
+
+Effect.Transform = Class.create({
+  initialize: function(tracks){
+    this.tracks  = [];
+    this.options = arguments[1] || { };
+    this.addTracks(tracks);
+  },
+  addTracks: function(tracks){
+    tracks.each(function(track){
+      track = $H(track);
+      var data = track.values().first();
+      this.tracks.push($H({
+        ids:     track.keys().first(),
+        effect:  Effect.Morph,
+        options: { style: data }
+      }));
+    }.bind(this));
+    return this;
+  },
+  play: function(){
+    return new Effect.Parallel(
+      this.tracks.map(function(track){
+        var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options');
+        var elements = [$(ids) || $$(ids)].flatten();
+        return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) });
+      }).flatten(),
+      this.options
+    );
+  }
+});
+
+Element.CSS_PROPERTIES = $w(
+  'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + 
+  'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
+  'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
+  'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
+  'fontSize fontWeight height left letterSpacing lineHeight ' +
+  'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+
+  'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
+  'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
+  'right textIndent top width wordSpacing zIndex');
+  
+Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
+
+String.__parseStyleElement = document.createElement('div');
+String.prototype.parseStyle = function(){
+  var style, styleRules = $H();
+  if (Prototype.Browser.WebKit)
+    style = new Element('div',{style:this}).style;
+  else {
+    String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>';
+    style = String.__parseStyleElement.childNodes[0].style;
+  }
+  
+  Element.CSS_PROPERTIES.each(function(property){
+    if (style[property]) styleRules.set(property, style[property]); 
+  });
+  
+  if (Prototype.Browser.IE && this.include('opacity'))
+    styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);
+
+  return styleRules;
+};
+
+if (document.defaultView && document.defaultView.getComputedStyle) {
+  Element.getStyles = function(element) {
+    var css = document.defaultView.getComputedStyle($(element), null);
+    return Element.CSS_PROPERTIES.inject({ }, function(styles, property) {
+      styles[property] = css[property];
+      return styles;
+    });
+  };
+} else {
+  Element.getStyles = function(element) {
+    element = $(element);
+    var css = element.currentStyle, styles;
+    styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) {
+      results[property] = css[property];
+      return results;
+    });
+    if (!styles.opacity) styles.opacity = element.getOpacity();
+    return styles;
+  };
+};
+
+Effect.Methods = {
+  morph: function(element, style) {
+    element = $(element);
+    new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { }));
+    return element;
+  },
+  visualEffect: function(element, effect, options) {
+    element = $(element)
+    var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
+    new Effect[klass](element, options);
+    return element;
+  },
+  highlight: function(element, options) {
+    element = $(element);
+    new Effect.Highlight(element, options);
+    return element;
+  }
+};
+
+$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
+  'pulsate shake puff squish switchOff dropOut').each(
+  function(effect) { 
+    Effect.Methods[effect] = function(element, options){
+      element = $(element);
+      Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
+      return element;
+    }
+  }
+);
+
+$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( 
+  function(f) { Effect.Methods[f] = Element[f]; }
+);
+
+Element.addMethods(Effect.Methods);

+ 1195 - 0
sites/all/modules/lightbox2/js/lightbox.js

@@ -0,0 +1,1195 @@
+/* $Id: lightbox.js,v 1.5.2.6.2.136 2010/09/24 08:39:40 snpower Exp $ */
+
+/**
+ * jQuery Lightbox
+ * @author
+ *   Stella Power, <http://drupal.org/user/66894>
+ *
+ * Based on Lightbox v2.03.3 by Lokesh Dhakar
+ * <http://www.huddletogether.com/projects/lightbox2/>
+ * Also partially based on the jQuery Lightbox by Warren Krewenki
+ *   <http://warren.mesozen.com>
+ *
+ * Permission has been granted to Mark Ashmead & other Drupal Lightbox2 module
+ * maintainers to distribute this file via Drupal.org
+ * Under GPL license.
+ *
+ * Slideshow, iframe and video functionality added by Stella Power.
+ */
+
+var Lightbox;
+(function($) {
+Lightbox = {
+  auto_modal : false,
+  overlayOpacity : 0.8, // Controls transparency of shadow overlay.
+  overlayColor : '000', // Controls colour of shadow overlay.
+  disableCloseClick : true,
+  // Controls the order of the lightbox resizing animation sequence.
+  resizeSequence: 0, // 0: simultaneous, 1: width then height, 2: height then width.
+  resizeSpeed: 'normal', // Controls the speed of the lightbox resizing animation.
+  fadeInSpeed: 'normal', // Controls the speed of the image appearance.
+  slideDownSpeed: 'slow', // Controls the speed of the image details appearance.
+  minWidth: 240,
+  borderSize : 10,
+  boxColor : 'fff',
+  fontColor : '000',
+  topPosition : '',
+  infoHeight: 20,
+  alternative_layout : false,
+  imageArray : [],
+  imageNum : null,
+  total : 0,
+  activeImage : null,
+  inprogress : false,
+  disableResize : false,
+  disableZoom : false,
+  isZoomedIn : false,
+  rtl : false,
+  loopItems : false,
+  keysClose : ['c', 'x', 27],
+  keysPrevious : ['p', 37],
+  keysNext : ['n', 39],
+  keysZoom : ['z'],
+  keysPlayPause : [32],
+
+  // Slideshow options.
+  slideInterval : 5000, // In milliseconds.
+  showPlayPause : true,
+  autoStart : true,
+  autoExit : true,
+  pauseOnNextClick : false, // True to pause the slideshow when the "Next" button is clicked.
+  pauseOnPrevClick : true, // True to pause the slideshow when the "Prev" button is clicked.
+  slideIdArray : [],
+  slideIdCount : 0,
+  isSlideshow : false,
+  isPaused : false,
+  loopSlides : false,
+
+  // Iframe options.
+  isLightframe : false,
+  iframe_width : 600,
+  iframe_height : 400,
+  iframe_border : 1,
+
+  // Video and modal options.
+  enableVideo : false,
+  flvPlayer : '/flvplayer.swf',
+  flvFlashvars : '',
+  isModal : false,
+  isVideo : false,
+  videoId : false,
+  modalWidth : 400,
+  modalHeight : 400,
+  modalHTML : null,
+
+
+  // initialize()
+  // Constructor runs on completion of the DOM loading.
+  // The function inserts html at the bottom of the page which is used
+  // to display the shadow overlay and the image container.
+  initialize: function() {
+
+    var s = Drupal.settings.lightbox2;
+    Lightbox.overlayOpacity = s.overlay_opacity;
+    Lightbox.overlayColor = s.overlay_color;
+    Lightbox.disableCloseClick = s.disable_close_click;
+    Lightbox.resizeSequence = s.resize_sequence;
+    Lightbox.resizeSpeed = s.resize_speed;
+    Lightbox.fadeInSpeed = s.fade_in_speed;
+    Lightbox.slideDownSpeed = s.slide_down_speed;
+    Lightbox.borderSize = s.border_size;
+    Lightbox.boxColor = s.box_color;
+    Lightbox.fontColor = s.font_color;
+    Lightbox.topPosition = s.top_position;
+    Lightbox.rtl = s.rtl;
+    Lightbox.loopItems = s.loop_items;
+    Lightbox.keysClose = s.keys_close.split(" ");
+    Lightbox.keysPrevious = s.keys_previous.split(" ");
+    Lightbox.keysNext = s.keys_next.split(" ");
+    Lightbox.keysZoom = s.keys_zoom.split(" ");
+    Lightbox.keysPlayPause = s.keys_play_pause.split(" ");
+    Lightbox.disableResize = s.disable_resize;
+    Lightbox.disableZoom = s.disable_zoom;
+    Lightbox.slideInterval = s.slideshow_interval;
+    Lightbox.showPlayPause = s.show_play_pause;
+    Lightbox.showCaption = s.show_caption;
+    Lightbox.autoStart = s.slideshow_automatic_start;
+    Lightbox.autoExit = s.slideshow_automatic_exit;
+    Lightbox.pauseOnNextClick = s.pause_on_next_click;
+    Lightbox.pauseOnPrevClick = s.pause_on_previous_click;
+    Lightbox.loopSlides = s.loop_slides;
+    Lightbox.alternative_layout = s.use_alt_layout;
+    Lightbox.iframe_width = s.iframe_width;
+    Lightbox.iframe_height = s.iframe_height;
+    Lightbox.iframe_border = s.iframe_border;
+    Lightbox.enableVideo = s.enable_video;
+    if (s.enable_video) {
+      Lightbox.flvPlayer = s.flvPlayer;
+      Lightbox.flvFlashvars = s.flvFlashvars;
+    }
+
+    // Make the lightbox divs.
+    var layout_class = (s.use_alt_layout ? 'lightbox2-alt-layout' : 'lightbox2-orig-layout');
+    var output = '<div id="lightbox2-overlay" style="display: none;"></div>\
+      <div id="lightbox" style="display: none;" class="' + layout_class + '">\
+        <div id="outerImageContainer"></div>\
+        <div id="imageDataContainer" class="clearfix">\
+          <div id="imageData"></div>\
+        </div>\
+      </div>';
+    var loading = '<div id="loading"><a href="#" id="loadingLink"></a></div>';
+    var modal = '<div id="modalContainer" style="display: none;"></div>';
+    var frame = '<div id="frameContainer" style="display: none;"></div>';
+    var imageContainer = '<div id="imageContainer" style="display: none;"></div>';
+    var details = '<div id="imageDetails"></div>';
+    var bottomNav = '<div id="bottomNav"></div>';
+    var image = '<img id="lightboxImage" alt="" />';
+    var hoverNav = '<div id="hoverNav"><a id="prevLink" href="#"></a><a id="nextLink" href="#"></a></div>';
+    var frameNav = '<div id="frameHoverNav"><a id="framePrevLink" href="#"></a><a id="frameNextLink" href="#"></a></div>';
+    var hoverNav = '<div id="hoverNav"><a id="prevLink" title="' + Drupal.t('Previous') + '" href="#"></a><a id="nextLink" title="' + Drupal.t('Next') + '" href="#"></a></div>';
+    var frameNav = '<div id="frameHoverNav"><a id="framePrevLink" title="' + Drupal.t('Previous') + '" href="#"></a><a id="frameNextLink" title="' + Drupal.t('Next') + '" href="#"></a></div>';
+    var caption = '<span id="caption"></span>';
+    var numberDisplay = '<span id="numberDisplay"></span>';
+    var close = '<a id="bottomNavClose" title="' + Drupal.t('Close') + '" href="#"></a>';
+    var zoom = '<a id="bottomNavZoom" href="#"></a>';
+    var zoomOut = '<a id="bottomNavZoomOut" href="#"></a>';
+    var pause = '<a id="lightshowPause" title="' + Drupal.t('Pause Slideshow') + '" href="#" style="display: none;"></a>';
+    var play = '<a id="lightshowPlay" title="' + Drupal.t('Play Slideshow') + '" href="#" style="display: none;"></a>';
+
+    $("body").append(output);
+    $('#outerImageContainer').append(modal + frame + imageContainer + loading);
+    if (!s.use_alt_layout) {
+      $('#imageContainer').append(image + hoverNav);
+      $('#imageData').append(details + bottomNav);
+      $('#imageDetails').append(caption + numberDisplay);
+      $('#bottomNav').append(frameNav + close + zoom + zoomOut + pause + play);
+    }
+    else {
+      $('#outerImageContainer').append(bottomNav);
+      $('#imageContainer').append(image);
+      $('#bottomNav').append(close + zoom + zoomOut);
+      $('#imageData').append(hoverNav + details);
+      $('#imageDetails').append(caption + numberDisplay + pause + play);
+    }
+
+    // Setup onclick handlers.
+    if (Lightbox.disableCloseClick) {
+      $('#lightbox2-overlay').click(function() { Lightbox.end(); return false; } ).hide();
+    }
+    $('#loadingLink, #bottomNavClose').click(function() { Lightbox.end('forceClose'); return false; } );
+    $('#prevLink, #framePrevLink').click(function() { Lightbox.changeData(Lightbox.activeImage - 1); return false; } );
+    $('#nextLink, #frameNextLink').click(function() { Lightbox.changeData(Lightbox.activeImage + 1); return false; } );
+    $('#bottomNavZoom').click(function() { Lightbox.changeData(Lightbox.activeImage, true); return false; } );
+    $('#bottomNavZoomOut').click(function() { Lightbox.changeData(Lightbox.activeImage, false); return false; } );
+    $('#lightshowPause').click(function() { Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); return false; } );
+    $('#lightshowPlay').click(function() { Lightbox.togglePlayPause("lightshowPlay", "lightshowPause"); return false; } );
+
+    // Fix positioning.
+    $('#prevLink, #nextLink, #framePrevLink, #frameNextLink').css({ 'paddingTop': Lightbox.borderSize + 'px'});
+    $('#imageContainer, #frameContainer, #modalContainer').css({ 'padding': Lightbox.borderSize + 'px'});
+    $('#outerImageContainer, #imageDataContainer, #bottomNavClose').css({'backgroundColor': '#' + Lightbox.boxColor, 'color': '#'+Lightbox.fontColor});
+    if (Lightbox.alternative_layout) {
+      $('#bottomNavZoom, #bottomNavZoomOut').css({'bottom': Lightbox.borderSize + 'px', 'right': Lightbox.borderSize + 'px'});
+    }
+    else if (Lightbox.rtl == 1 && $.browser.msie) {
+      $('#bottomNavZoom, #bottomNavZoomOut').css({'left': '0px'});
+    }
+
+    // Force navigation links to always be displayed
+    if (s.force_show_nav) {
+      $('#prevLink, #nextLink').addClass("force_show_nav");
+    }
+
+  },
+
+  // initList()
+  // Loops through anchor tags looking for 'lightbox', 'lightshow' and
+  // 'lightframe', etc, references and applies onclick events to appropriate
+  // links. You can rerun after dynamically adding images w/ajax.
+  initList : function(context) {
+
+    if (context == undefined || context == null) {
+      context = document;
+    }
+
+    // Attach lightbox to any links with rel 'lightbox', 'lightshow' or
+    // 'lightframe', etc.
+    $("a[rel^='lightbox']:not(.lightbox-processed), area[rel^='lightbox']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) {
+      if (Lightbox.disableCloseClick) {
+        $('#lightbox').unbind('click');
+        $('#lightbox').click(function() { Lightbox.end('forceClose'); } );
+      }
+      Lightbox.start(this, false, false, false, false);
+      if (e.preventDefault) { e.preventDefault(); }
+      return false;
+    });
+    $("a[rel^='lightshow']:not(.lightbox-processed), area[rel^='lightshow']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) {
+      if (Lightbox.disableCloseClick) {
+        $('#lightbox').unbind('click');
+        $('#lightbox').click(function() { Lightbox.end('forceClose'); } );
+      }
+      Lightbox.start(this, true, false, false, false);
+      if (e.preventDefault) { e.preventDefault(); }
+      return false;
+    });
+    $("a[rel^='lightframe']:not(.lightbox-processed), area[rel^='lightframe']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) {
+      if (Lightbox.disableCloseClick) {
+        $('#lightbox').unbind('click');
+        $('#lightbox').click(function() { Lightbox.end('forceClose'); } );
+      }
+      Lightbox.start(this, false, true, false, false);
+      if (e.preventDefault) { e.preventDefault(); }
+      return false;
+    });
+    if (Lightbox.enableVideo) {
+      $("a[rel^='lightvideo']:not(.lightbox-processed), area[rel^='lightvideo']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) {
+        if (Lightbox.disableCloseClick) {
+          $('#lightbox').unbind('click');
+          $('#lightbox').click(function() { Lightbox.end('forceClose'); } );
+        }
+        Lightbox.start(this, false, false, true, false);
+        if (e.preventDefault) { e.preventDefault(); }
+        return false;
+      });
+    }
+    $("a[rel^='lightmodal']:not(.lightbox-processed), area[rel^='lightmodal']:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) {
+      $('#lightbox').unbind('click');
+      // Add classes from the link to the lightbox div - don't include lightbox-processed
+      $('#lightbox').addClass($(this).attr('class'));
+      $('#lightbox').removeClass('lightbox-processed');
+      Lightbox.start(this, false, false, false, true);
+      if (e.preventDefault) { e.preventDefault(); }
+      return false;
+    });
+    $("#lightboxAutoModal:not(.lightbox-processed)", context).addClass('lightbox-processed').click(function(e) {
+      Lightbox.auto_modal = true;
+      $('#lightbox').unbind('click');
+      Lightbox.start(this, false, false, false, true);
+      if (e.preventDefault) { e.preventDefault(); }
+      return false;
+    });
+  },
+
+  // start()
+  // Display overlay and lightbox. If image is part of a set, add siblings to
+  // imageArray.
+  start: function(imageLink, slideshow, lightframe, lightvideo, lightmodal) {
+
+    Lightbox.isPaused = !Lightbox.autoStart;
+
+    // Replaces hideSelectBoxes() and hideFlash() calls in original lightbox2.
+    Lightbox.toggleSelectsFlash('hide');
+
+    // Stretch overlay to fill page and fade in.
+    var arrayPageSize = Lightbox.getPageSize();
+    $("#lightbox2-overlay").hide().css({
+      'width': '100%',
+      'zIndex': '10090',
+      'height': arrayPageSize[1] + 'px',
+      'backgroundColor' : '#' + Lightbox.overlayColor
+    });
+    // Detect OS X FF2 opacity + flash issue.
+    if (lightvideo && this.detectMacFF2()) {
+      $("#lightbox2-overlay").removeClass("overlay_default");
+      $("#lightbox2-overlay").addClass("overlay_macff2");
+      $("#lightbox2-overlay").css({'opacity' : null});
+    }
+    else {
+      $("#lightbox2-overlay").removeClass("overlay_macff2");
+      $("#lightbox2-overlay").addClass("overlay_default");
+      $("#lightbox2-overlay").css({'opacity' : Lightbox.overlayOpacity});
+    }
+    $("#lightbox2-overlay").fadeIn(Lightbox.fadeInSpeed);
+
+
+    Lightbox.isSlideshow = slideshow;
+    Lightbox.isLightframe = lightframe;
+    Lightbox.isVideo = lightvideo;
+    Lightbox.isModal = lightmodal;
+    Lightbox.imageArray = [];
+    Lightbox.imageNum = 0;
+
+    var anchors = $(imageLink.tagName);
+    var anchor = null;
+    var rel_parts = Lightbox.parseRel(imageLink);
+    var rel = rel_parts["rel"];
+    var rel_group = rel_parts["group"];
+    var title = (rel_parts["title"] ? rel_parts["title"] : imageLink.title);
+    var rel_style = null;
+    var i = 0;
+
+    if (rel_parts["flashvars"]) {
+      Lightbox.flvFlashvars = Lightbox.flvFlashvars + '&' + rel_parts["flashvars"];
+    }
+
+    // Set the title for image alternative text.
+    var alt = imageLink.title;
+    if (!alt) {
+      var img = $(imageLink).find("img");
+      if (img && $(img).attr("alt")) {
+        alt = $(img).attr("alt");
+      }
+      else {
+        alt = title;
+      }
+    }
+
+    if ($(imageLink).attr('id') == 'lightboxAutoModal') {
+      rel_style = rel_parts["style"];
+      Lightbox.imageArray.push(['#lightboxAutoModal > *', title, alt, rel_style, 1]);
+    }
+    else {
+      // Handle lightbox images with no grouping.
+      if ((rel == 'lightbox' || rel == 'lightshow') && !rel_group) {
+        Lightbox.imageArray.push([imageLink.href, title, alt]);
+      }
+
+      // Handle other items with no grouping.
+      else if (!rel_group) {
+        rel_style = rel_parts["style"];
+        Lightbox.imageArray.push([imageLink.href, title, alt, rel_style]);
+      }
+
+      // Handle grouped items.
+      else {
+
+        // Loop through anchors and add them to imageArray.
+        for (i = 0; i < anchors.length; i++) {
+          anchor = anchors[i];
+          if (anchor.href && typeof(anchor.href) == "string" && $(anchor).attr('rel')) {
+            var rel_data = Lightbox.parseRel(anchor);
+            var anchor_title = (rel_data["title"] ? rel_data["title"] : anchor.title);
+            img_alt = anchor.title;
+            if (!img_alt) {
+              var anchor_img = $(anchor).find("img");
+              if (anchor_img && $(anchor_img).attr("alt")) {
+                img_alt = $(anchor_img).attr("alt");
+              }
+              else {
+                img_alt = title;
+              }
+            }
+            if (rel_data["rel"] == rel) {
+              if (rel_data["group"] == rel_group) {
+                if (Lightbox.isLightframe || Lightbox.isModal || Lightbox.isVideo) {
+                  rel_style = rel_data["style"];
+                }
+                Lightbox.imageArray.push([anchor.href, anchor_title, img_alt, rel_style]);
+              }
+            }
+          }
+        }
+
+        // Remove duplicates.
+        for (i = 0; i < Lightbox.imageArray.length; i++) {
+          for (j = Lightbox.imageArray.length-1; j > i; j--) {
+            if (Lightbox.imageArray[i][0] == Lightbox.imageArray[j][0]) {
+              Lightbox.imageArray.splice(j,1);
+            }
+          }
+        }
+        while (Lightbox.imageArray[Lightbox.imageNum][0] != imageLink.href) {
+          Lightbox.imageNum++;
+        }
+      }
+    }
+
+    if (Lightbox.isSlideshow && Lightbox.showPlayPause && Lightbox.isPaused) {
+      $('#lightshowPlay').show();
+      $('#lightshowPause').hide();
+    }
+
+    // Calculate top and left offset for the lightbox.
+    var arrayPageScroll = Lightbox.getPageScroll();
+    var lightboxTop = arrayPageScroll[1] + (Lightbox.topPosition == '' ? (arrayPageSize[3] / 10) : Lightbox.topPosition) * 1;
+    var lightboxLeft = arrayPageScroll[0];
+    $('#frameContainer, #modalContainer, #lightboxImage').hide();
+    $('#hoverNav, #prevLink, #nextLink, #frameHoverNav, #framePrevLink, #frameNextLink').hide();
+    $('#imageDataContainer, #numberDisplay, #bottomNavZoom, #bottomNavZoomOut').hide();
+    $('#outerImageContainer').css({'width': '250px', 'height': '250px'});
+    $('#lightbox').css({
+      'zIndex': '10500',
+      'top': lightboxTop + 'px',
+      'left': lightboxLeft + 'px'
+    }).show();
+
+    Lightbox.total = Lightbox.imageArray.length;
+    Lightbox.changeData(Lightbox.imageNum);
+  },
+
+  // changeData()
+  // Hide most elements and preload image in preparation for resizing image
+  // container.
+  changeData: function(imageNum, zoomIn) {
+
+    if (Lightbox.inprogress === false) {
+      if (Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) {
+        if (imageNum >= Lightbox.total) imageNum = 0;
+        if (imageNum < 0) imageNum = Lightbox.total - 1;
+      }
+
+      if (Lightbox.isSlideshow) {
+        for (var i = 0; i < Lightbox.slideIdCount; i++) {
+          window.clearTimeout(Lightbox.slideIdArray[i]);
+        }
+      }
+      Lightbox.inprogress = true;
+      Lightbox.activeImage = imageNum;
+
+      if (Lightbox.disableResize && !Lightbox.isSlideshow) {
+        zoomIn = true;
+      }
+      Lightbox.isZoomedIn = zoomIn;
+
+
+      // Hide elements during transition.
+      $('#loading').css({'zIndex': '10500'}).show();
+      if (!Lightbox.alternative_layout) {
+        $('#imageContainer').hide();
+      }
+      $('#frameContainer, #modalContainer, #lightboxImage').hide();
+      $('#hoverNav, #prevLink, #nextLink, #frameHoverNav, #framePrevLink, #frameNextLink').hide();
+      $('#imageDataContainer, #numberDisplay, #bottomNavZoom, #bottomNavZoomOut').hide();
+
+      // Preload image content, but not iframe pages.
+      if (!Lightbox.isLightframe && !Lightbox.isVideo && !Lightbox.isModal) {
+        $("#lightbox #imageDataContainer").removeClass('lightbox2-alt-layout-data');
+        imgPreloader = new Image();
+        imgPreloader.onerror = function() { Lightbox.imgNodeLoadingError(this); };
+
+        imgPreloader.onload = function() {
+          var photo = document.getElementById('lightboxImage');
+          photo.src = Lightbox.imageArray[Lightbox.activeImage][0];
+          photo.alt = Lightbox.imageArray[Lightbox.activeImage][2];
+
+          var imageWidth = imgPreloader.width;
+          var imageHeight = imgPreloader.height;
+
+          // Resize code.
+          var arrayPageSize = Lightbox.getPageSize();
+          var targ = { w:arrayPageSize[2] - (Lightbox.borderSize * 2), h:arrayPageSize[3] - (Lightbox.borderSize * 6) - (Lightbox.infoHeight * 4) - (arrayPageSize[3] / 10) };
+          var orig = { w:imgPreloader.width, h:imgPreloader.height };
+
+          // Image is very large, so show a smaller version of the larger image
+          // with zoom button.
+          if (zoomIn !== true) {
+            var ratio = 1.0; // Shrink image with the same aspect.
+            $('#bottomNavZoomOut, #bottomNavZoom').hide();
+            if ((orig.w >= targ.w || orig.h >= targ.h) && orig.h && orig.w) {
+              ratio = ((targ.w / orig.w) < (targ.h / orig.h)) ? targ.w / orig.w : targ.h / orig.h;
+              if (!Lightbox.disableZoom && !Lightbox.isSlideshow) {
+                $('#bottomNavZoom').css({'zIndex': '10500'}).show();
+              }
+            }
+
+            imageWidth  = Math.floor(orig.w * ratio);
+            imageHeight = Math.floor(orig.h * ratio);
+          }
+
+          else {
+            $('#bottomNavZoom').hide();
+            // Only display zoom out button if the image is zoomed in already.
+            if ((orig.w >= targ.w || orig.h >= targ.h) && orig.h && orig.w) {
+              // Only display zoom out button if not a slideshow and if the
+              // buttons aren't disabled.
+              if (!Lightbox.disableResize && Lightbox.isSlideshow === false && !Lightbox.disableZoom) {
+                $('#bottomNavZoomOut').css({'zIndex': '10500'}).show();
+              }
+            }
+          }
+
+          photo.style.width = (imageWidth) + 'px';
+          photo.style.height = (imageHeight) + 'px';
+          Lightbox.resizeContainer(imageWidth, imageHeight);
+
+          // Clear onLoad, IE behaves irratically with animated gifs otherwise.
+          imgPreloader.onload = function() {};
+        };
+
+        imgPreloader.src = Lightbox.imageArray[Lightbox.activeImage][0];
+        imgPreloader.alt = Lightbox.imageArray[Lightbox.activeImage][2];
+      }
+
+      // Set up frame size, etc.
+      else if (Lightbox.isLightframe) {
+        $("#lightbox #imageDataContainer").addClass('lightbox2-alt-layout-data');
+        var src = Lightbox.imageArray[Lightbox.activeImage][0];
+        $('#frameContainer').html('<iframe id="lightboxFrame" style="display: none;" src="'+src+'"></iframe>');
+
+        // Enable swf support in Gecko browsers.
+        if ($.browser.mozilla && src.indexOf('.swf') != -1) {
+          setTimeout(function () {
+            document.getElementById("lightboxFrame").src = Lightbox.imageArray[Lightbox.activeImage][0];
+          }, 1000);
+        }
+
+        if (!Lightbox.iframe_border) {
+          $('#lightboxFrame').css({'border': 'none'});
+          $('#lightboxFrame').attr('frameborder', '0');
+        }
+        var iframe = document.getElementById('lightboxFrame');
+        var iframeStyles = Lightbox.imageArray[Lightbox.activeImage][3];
+        iframe = Lightbox.setStyles(iframe, iframeStyles);
+        Lightbox.resizeContainer(parseInt(iframe.width, 10), parseInt(iframe.height, 10));
+      }
+      else if (Lightbox.isVideo || Lightbox.isModal) {
+        $("#lightbox #imageDataContainer").addClass('lightbox2-alt-layout-data');
+        var container = document.getElementById('modalContainer');
+        var modalStyles = Lightbox.imageArray[Lightbox.activeImage][3];
+        container = Lightbox.setStyles(container, modalStyles);
+        if (Lightbox.isVideo) {
+          Lightbox.modalHeight =  parseInt(container.height, 10) - 10;
+          Lightbox.modalWidth =  parseInt(container.width, 10) - 10;
+          Lightvideo.startVideo(Lightbox.imageArray[Lightbox.activeImage][0]);
+        }
+        Lightbox.resizeContainer(parseInt(container.width, 10), parseInt(container.height, 10));
+      }
+    }
+  },
+
+  // imgNodeLoadingError()
+  imgNodeLoadingError: function(image) {
+    var s = Drupal.settings.lightbox2;
+    var original_image = Lightbox.imageArray[Lightbox.activeImage][0];
+    if (s.display_image_size !== "") {
+      original_image = original_image.replace(new RegExp("."+s.display_image_size), "");
+    }
+    Lightbox.imageArray[Lightbox.activeImage][0] = original_image;
+    image.onerror = function() { Lightbox.imgLoadingError(image); };
+    image.src = original_image;
+  },
+
+  // imgLoadingError()
+  imgLoadingError: function(image) {
+    var s = Drupal.settings.lightbox2;
+    Lightbox.imageArray[Lightbox.activeImage][0] = s.default_image;
+    image.src = s.default_image;
+  },
+
+  // resizeContainer()
+  resizeContainer: function(imgWidth, imgHeight) {
+
+    imgWidth = (imgWidth < Lightbox.minWidth ? Lightbox.minWidth : imgWidth);
+
+    this.widthCurrent = $('#outerImageContainer').width();
+    this.heightCurrent = $('#outerImageContainer').height();
+
+    var widthNew = (imgWidth  + (Lightbox.borderSize * 2));
+    var heightNew = (imgHeight  + (Lightbox.borderSize * 2));
+
+    // Scalars based on change from old to new.
+    this.xScale = ( widthNew / this.widthCurrent) * 100;
+    this.yScale = ( heightNew / this.heightCurrent) * 100;
+
+    // Calculate size difference between new and old image, and resize if
+    // necessary.
+    wDiff = this.widthCurrent - widthNew;
+    hDiff = this.heightCurrent - heightNew;
+
+    $('#modalContainer').css({'width': imgWidth, 'height': imgHeight});
+    // Detect animation sequence.
+    if (Lightbox.resizeSequence) {
+      var animate1 = {width: widthNew};
+      var animate2 = {height: heightNew};
+      if (Lightbox.resizeSequence == 2) {
+        animate1 = {height: heightNew};
+        animate2 = {width: widthNew};
+      }
+      $('#outerImageContainer').animate(animate1, Lightbox.resizeSpeed).animate(animate2, Lightbox.resizeSpeed, 'linear', function() { Lightbox.showData(); });
+    }
+    // Simultaneous.
+    else {
+      $('#outerImageContainer').animate({'width': widthNew, 'height': heightNew}, Lightbox.resizeSpeed, 'linear', function() { Lightbox.showData(); });
+    }
+
+    // If new and old image are same size and no scaling transition is necessary
+    // do a quick pause to prevent image flicker.
+    if ((hDiff === 0) && (wDiff === 0)) {
+      if ($.browser.msie) {
+        Lightbox.pause(250);
+      }
+      else {
+        Lightbox.pause(100);
+      }
+    }
+
+    var s = Drupal.settings.lightbox2;
+    if (!s.use_alt_layout) {
+      $('#prevLink, #nextLink').css({'height': imgHeight + 'px'});
+    }
+    $('#imageDataContainer').css({'width': widthNew + 'px'});
+  },
+
+  // showData()
+  // Display image and begin preloading neighbors.
+  showData: function() {
+    $('#loading').hide();
+
+    if (Lightbox.isLightframe || Lightbox.isVideo || Lightbox.isModal) {
+      Lightbox.updateDetails();
+      if (Lightbox.isLightframe) {
+        $('#frameContainer').show();
+        if ($.browser.safari || Lightbox.fadeInSpeed === 0) {
+          $('#lightboxFrame').css({'zIndex': '10500'}).show();
+        }
+        else {
+          $('#lightboxFrame').css({'zIndex': '10500'}).fadeIn(Lightbox.fadeInSpeed);
+        }
+      }
+      else {
+        if (Lightbox.isVideo) {
+          $("#modalContainer").html(Lightbox.modalHTML).click(function(){return false;}).css('zIndex', '10500').show();
+        }
+        else {
+          var src = unescape(Lightbox.imageArray[Lightbox.activeImage][0]);
+          if (Lightbox.imageArray[Lightbox.activeImage][4]) {
+            $(src).appendTo("#modalContainer");
+            $('#modalContainer').css({'zIndex': '10500'}).show();
+          }
+          else {
+            // Use a callback to show the new image, otherwise you get flicker.
+            $("#modalContainer").hide().load(src, function () {$('#modalContainer').css({'zIndex': '10500'}).show();});
+          }
+          $('#modalContainer').unbind('click');
+        }
+        // This might be needed in the Lightframe section above.
+        //$('#modalContainer').css({'zIndex': '10500'}).show();
+      }
+    }
+
+    // Handle display of image content.
+    else {
+      $('#imageContainer').show();
+      if ($.browser.safari || Lightbox.fadeInSpeed === 0) {
+        $('#lightboxImage').css({'zIndex': '10500'}).show();
+      }
+      else {
+        $('#lightboxImage').css({'zIndex': '10500'}).fadeIn(Lightbox.fadeInSpeed);
+      }
+      Lightbox.updateDetails();
+      this.preloadNeighborImages();
+    }
+    Lightbox.inprogress = false;
+
+    // Slideshow specific stuff.
+    if (Lightbox.isSlideshow) {
+      if (!Lightbox.loopSlides && Lightbox.activeImage == (Lightbox.total - 1)) {
+        if (Lightbox.autoExit) {
+          Lightbox.slideIdArray[Lightbox.slideIdCount++] = setTimeout(function () {Lightbox.end('slideshow');}, Lightbox.slideInterval);
+        }
+      }
+      else {
+        if (!Lightbox.isPaused && Lightbox.total > 1) {
+          Lightbox.slideIdArray[Lightbox.slideIdCount++] = setTimeout(function () {Lightbox.changeData(Lightbox.activeImage + 1);}, Lightbox.slideInterval);
+        }
+      }
+      if (Lightbox.showPlayPause && Lightbox.total > 1 && !Lightbox.isPaused) {
+        $('#lightshowPause').show();
+        $('#lightshowPlay').hide();
+      }
+      else if (Lightbox.showPlayPause && Lightbox.total > 1) {
+        $('#lightshowPause').hide();
+        $('#lightshowPlay').show();
+      }
+    }
+
+    // Adjust the page overlay size.
+    var arrayPageSize = Lightbox.getPageSize();
+    var arrayPageScroll = Lightbox.getPageScroll();
+    var pageHeight = arrayPageSize[1];
+    if (Lightbox.isZoomedIn && arrayPageSize[1] > arrayPageSize[3]) {
+      var lightboxTop = (Lightbox.topPosition == '' ? (arrayPageSize[3] / 10) : Lightbox.topPosition) * 1;
+      pageHeight = pageHeight + arrayPageScroll[1] + lightboxTop;
+    }
+    $('#lightbox2-overlay').css({'height': pageHeight + 'px', 'width': arrayPageSize[0] + 'px'});
+
+    // Gecko browsers (e.g. Firefox, SeaMonkey, etc) don't handle pdfs as
+    // expected.
+    if ($.browser.mozilla) {
+      if (Lightbox.imageArray[Lightbox.activeImage][0].indexOf(".pdf") != -1) {
+        setTimeout(function () {
+          document.getElementById("lightboxFrame").src = Lightbox.imageArray[Lightbox.activeImage][0];
+        }, 1000);
+      }
+    }
+  },
+
+  // updateDetails()
+  // Display caption, image number, and bottom nav.
+  updateDetails: function() {
+
+    $("#imageDataContainer").hide();
+
+    var s = Drupal.settings.lightbox2;
+
+    if (s.show_caption) {
+      var caption = Lightbox.filterXSS(Lightbox.imageArray[Lightbox.activeImage][1]);
+      if (!caption) caption = '';
+      $('#caption').html(caption).css({'zIndex': '10500'}).show();
+    }
+
+    // If image is part of set display 'Image x of x'.
+    var numberDisplay = null;
+    if (s.image_count && Lightbox.total > 1) {
+      var currentImage = Lightbox.activeImage + 1;
+      if (!Lightbox.isLightframe && !Lightbox.isModal && !Lightbox.isVideo) {
+        numberDisplay = s.image_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total);
+      }
+      else if (Lightbox.isVideo) {
+        numberDisplay = s.video_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total);
+      }
+      else {
+        numberDisplay = s.page_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total);
+      }
+      $('#numberDisplay').html(numberDisplay).css({'zIndex': '10500'}).show();
+    }
+    else {
+      $('#numberDisplay').hide();
+    }
+
+    $("#imageDataContainer").hide().slideDown(Lightbox.slideDownSpeed, function() {
+      $("#bottomNav").show();
+    });
+    if (Lightbox.rtl == 1) {
+      $("#bottomNav").css({'float': 'left'});
+    }
+    Lightbox.updateNav();
+  },
+
+  // updateNav()
+  // Display appropriate previous and next hover navigation.
+  updateNav: function() {
+
+    $('#hoverNav').css({'zIndex': '10500'}).show();
+    var prevLink = '#prevLink';
+    var nextLink = '#nextLink';
+
+    // Slideshow is separated as we need to show play / pause button.
+    if (Lightbox.isSlideshow) {
+      if ((Lightbox.total > 1 && Lightbox.loopSlides) || Lightbox.activeImage !== 0) {
+        $(prevLink).css({'zIndex': '10500'}).show().click(function() {
+          if (Lightbox.pauseOnPrevClick) {
+            Lightbox.togglePlayPause("lightshowPause", "lightshowPlay");
+          }
+          Lightbox.changeData(Lightbox.activeImage - 1); return false;
+        });
+      }
+      else {
+        $(prevLink).hide();
+      }
+
+      // If not last image in set, display next image button.
+      if ((Lightbox.total > 1 && Lightbox.loopSlides) || Lightbox.activeImage != (Lightbox.total - 1)) {
+        $(nextLink).css({'zIndex': '10500'}).show().click(function() {
+          if (Lightbox.pauseOnNextClick) {
+            Lightbox.togglePlayPause("lightshowPause", "lightshowPlay");
+          }
+          Lightbox.changeData(Lightbox.activeImage + 1); return false;
+        });
+      }
+      // Safari browsers need to have hide() called again.
+      else {
+        $(nextLink).hide();
+      }
+    }
+
+    // All other types of content.
+    else {
+
+      if ((Lightbox.isLightframe || Lightbox.isModal || Lightbox.isVideo) && !Lightbox.alternative_layout) {
+        $('#frameHoverNav').css({'zIndex': '10500'}).show();
+        $('#hoverNav').css({'zIndex': '10500'}).hide();
+        prevLink = '#framePrevLink';
+        nextLink = '#frameNextLink';
+      }
+
+      // If not first image in set, display prev image button.
+      if ((Lightbox.total > 1 && Lightbox.loopItems) || Lightbox.activeImage !== 0) {
+        // Unbind any other click handlers, otherwise this adds a new click handler
+        // each time the arrow is clicked.
+        $(prevLink).css({'zIndex': '10500'}).show().unbind().click(function() {
+          Lightbox.changeData(Lightbox.activeImage - 1); return false;
+        });
+      }
+      // Safari browsers need to have hide() called again.
+      else {
+        $(prevLink).hide();
+      }
+
+      // If not last image in set, display next image button.
+      if ((Lightbox.total > 1 && Lightbox.loopItems) || Lightbox.activeImage != (Lightbox.total - 1)) {
+        // Unbind any other click handlers, otherwise this adds a new click handler
+        // each time the arrow is clicked.
+        $(nextLink).css({'zIndex': '10500'}).show().unbind().click(function() {
+          Lightbox.changeData(Lightbox.activeImage + 1); return false;
+        });
+      }
+      // Safari browsers need to have hide() called again.
+      else {
+        $(nextLink).hide();
+      }
+    }
+
+    // Don't enable keyboard shortcuts so forms will work.
+    if (!Lightbox.isModal) {
+      this.enableKeyboardNav();
+    }
+  },
+
+
+  // enableKeyboardNav()
+  enableKeyboardNav: function() {
+    $(document).bind("keydown", this.keyboardAction);
+  },
+
+  // disableKeyboardNav()
+  disableKeyboardNav: function() {
+    $(document).unbind("keydown", this.keyboardAction);
+  },
+
+  // keyboardAction()
+  keyboardAction: function(e) {
+    if (e === null) { // IE.
+      keycode = event.keyCode;
+      escapeKey = 27;
+    }
+    else { // Mozilla.
+      keycode = e.keyCode;
+      escapeKey = e.DOM_VK_ESCAPE;
+    }
+
+    key = String.fromCharCode(keycode).toLowerCase();
+
+    // Close lightbox.
+    if (Lightbox.checkKey(Lightbox.keysClose, key, keycode)) {
+      Lightbox.end('forceClose');
+    }
+    // Display previous image (p, <-).
+    else if (Lightbox.checkKey(Lightbox.keysPrevious, key, keycode)) {
+      if ((Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) || Lightbox.activeImage !== 0) {
+        Lightbox.changeData(Lightbox.activeImage - 1);
+      }
+
+    }
+    // Display next image (n, ->).
+    else if (Lightbox.checkKey(Lightbox.keysNext, key, keycode)) {
+      if ((Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) || Lightbox.activeImage != (Lightbox.total - 1)) {
+        Lightbox.changeData(Lightbox.activeImage + 1);
+      }
+    }
+    // Zoom in.
+    else if (Lightbox.checkKey(Lightbox.keysZoom, key, keycode) && !Lightbox.disableResize && !Lightbox.disableZoom && !Lightbox.isSlideshow && !Lightbox.isLightframe) {
+      if (Lightbox.isZoomedIn) {
+        Lightbox.changeData(Lightbox.activeImage, false);
+      }
+      else if (!Lightbox.isZoomedIn) {
+        Lightbox.changeData(Lightbox.activeImage, true);
+      }
+      return false;
+    }
+    // Toggle play / pause (space).
+    else if (Lightbox.checkKey(Lightbox.keysPlayPause, key, keycode) && Lightbox.isSlideshow) {
+
+      if (Lightbox.isPaused) {
+        Lightbox.togglePlayPause("lightshowPlay", "lightshowPause");
+      }
+      else {
+        Lightbox.togglePlayPause("lightshowPause", "lightshowPlay");
+      }
+      return false;
+    }
+  },
+
+  preloadNeighborImages: function() {
+
+    if ((Lightbox.total - 1) > Lightbox.activeImage) {
+      preloadNextImage = new Image();
+      preloadNextImage.src = Lightbox.imageArray[Lightbox.activeImage + 1][0];
+    }
+    if (Lightbox.activeImage > 0) {
+      preloadPrevImage = new Image();
+      preloadPrevImage.src = Lightbox.imageArray[Lightbox.activeImage - 1][0];
+    }
+
+  },
+
+  end: function(caller) {
+    var closeClick = (caller == 'slideshow' ? false : true);
+    if (Lightbox.isSlideshow && Lightbox.isPaused && !closeClick) {
+      return;
+    }
+    // To prevent double clicks on navigation links.
+    if (Lightbox.inprogress === true && caller != 'forceClose') {
+      return;
+    }
+    Lightbox.disableKeyboardNav();
+    $('#lightbox').hide();
+    $("#lightbox2-overlay").fadeOut();
+    Lightbox.isPaused = true;
+    Lightbox.inprogress = false;
+    // Replaces calls to showSelectBoxes() and showFlash() in original
+    // lightbox2.
+    Lightbox.toggleSelectsFlash('visible');
+    if (Lightbox.isSlideshow) {
+      for (var i = 0; i < Lightbox.slideIdCount; i++) {
+        window.clearTimeout(Lightbox.slideIdArray[i]);
+      }
+      $('#lightshowPause, #lightshowPlay').hide();
+    }
+    else if (Lightbox.isLightframe) {
+      $('#frameContainer').empty().hide();
+    }
+    else if (Lightbox.isVideo || Lightbox.isModal) {
+      if (!Lightbox.auto_modal) {
+        $('#modalContainer').hide().html("");
+      }
+      Lightbox.auto_modal = false;
+    }
+  },
+
+
+  // getPageScroll()
+  // Returns array with x,y page scroll values.
+  // Core code from - quirksmode.com.
+  getPageScroll : function() {
+
+    var xScroll, yScroll;
+
+    if (self.pageYOffset || self.pageXOffset) {
+      yScroll = self.pageYOffset;
+      xScroll = self.pageXOffset;
+    }
+    else if (document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {  // Explorer 6 Strict.
+      yScroll = document.documentElement.scrollTop;
+      xScroll = document.documentElement.scrollLeft;
+    }
+    else if (document.body) {// All other Explorers.
+      yScroll = document.body.scrollTop;
+      xScroll = document.body.scrollLeft;
+    }
+
+    arrayPageScroll = [xScroll,yScroll];
+    return arrayPageScroll;
+  },
+
+  // getPageSize()
+  // Returns array with page width, height and window width, height.
+  // Core code from - quirksmode.com.
+  // Edit for Firefox by pHaez.
+
+  getPageSize : function() {
+
+    var xScroll, yScroll;
+
+    if (window.innerHeight && window.scrollMaxY) {
+      xScroll = window.innerWidth + window.scrollMaxX;
+      yScroll = window.innerHeight + window.scrollMaxY;
+    }
+    else if (document.body.scrollHeight > document.body.offsetHeight) { // All but Explorer Mac.
+      xScroll = document.body.scrollWidth;
+      yScroll = document.body.scrollHeight;
+    }
+    else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari.
+      xScroll = document.body.offsetWidth;
+      yScroll = document.body.offsetHeight;
+    }
+
+    var windowWidth, windowHeight;
+
+    if (self.innerHeight) { // All except Explorer.
+      if (document.documentElement.clientWidth) {
+        windowWidth = document.documentElement.clientWidth;
+      }
+      else {
+        windowWidth = self.innerWidth;
+      }
+      windowHeight = self.innerHeight;
+    }
+    else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode.
+      windowWidth = document.documentElement.clientWidth;
+      windowHeight = document.documentElement.clientHeight;
+    }
+    else if (document.body) { // Other Explorers.
+      windowWidth = document.body.clientWidth;
+      windowHeight = document.body.clientHeight;
+    }
+    // For small pages with total height less than height of the viewport.
+    if (yScroll < windowHeight) {
+      pageHeight = windowHeight;
+    }
+    else {
+      pageHeight = yScroll;
+    }
+    // For small pages with total width less than width of the viewport.
+    if (xScroll < windowWidth) {
+      pageWidth = xScroll;
+    }
+    else {
+      pageWidth = windowWidth;
+    }
+    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
+    return arrayPageSize;
+  },
+
+
+  // pause(numberMillis)
+  pause : function(ms) {
+    var date = new Date();
+    var curDate = null;
+    do { curDate = new Date(); }
+    while (curDate - date < ms);
+  },
+
+
+  // toggleSelectsFlash()
+  // Hide / unhide select lists and flash objects as they appear above the
+  // lightbox in some browsers.
+  toggleSelectsFlash: function (state) {
+    if (state == 'visible') {
+      $("select.lightbox_hidden, embed.lightbox_hidden, object.lightbox_hidden").show();
+    }
+    else if (state == 'hide') {
+      $("select:visible, embed:visible, object:visible").not('#lightboxAutoModal select, #lightboxAutoModal embed, #lightboxAutoModal object').addClass("lightbox_hidden");
+      $("select.lightbox_hidden, embed.lightbox_hidden, object.lightbox_hidden").hide();
+    }
+  },
+
+
+  // parseRel()
+  parseRel: function (link) {
+    var parts = [];
+    parts["rel"] = parts["title"] = parts["group"] = parts["style"] = parts["flashvars"] = null;
+    if (!$(link).attr('rel')) return parts;
+    parts["rel"] = $(link).attr('rel').match(/\w+/)[0];
+
+    if ($(link).attr('rel').match(/\[(.*)\]/)) {
+      var info = $(link).attr('rel').match(/\[(.*?)\]/)[1].split('|');
+      parts["group"] = info[0];
+      parts["style"] = info[1];
+      if (parts["style"] != undefined && parts["style"].match(/flashvars:\s?(.*?);/)) {
+        parts["flashvars"] = parts["style"].match(/flashvars:\s?(.*?);/)[1];
+      }
+    }
+    if ($(link).attr('rel').match(/\[.*\]\[(.*)\]/)) {
+      parts["title"] = $(link).attr('rel').match(/\[.*\]\[(.*)\]/)[1];
+    }
+    return parts;
+  },
+
+  // setStyles()
+  setStyles: function(item, styles) {
+    item.width = Lightbox.iframe_width;
+    item.height = Lightbox.iframe_height;
+    item.scrolling = "auto";
+
+    if (!styles) return item;
+    var stylesArray = styles.split(';');
+    for (var i = 0; i< stylesArray.length; i++) {
+      if (stylesArray[i].indexOf('width:') >= 0) {
+        var w = stylesArray[i].replace('width:', '');
+        item.width = jQuery.trim(w);
+      }
+      else if (stylesArray[i].indexOf('height:') >= 0) {
+        var h = stylesArray[i].replace('height:', '');
+        item.height = jQuery.trim(h);
+      }
+      else if (stylesArray[i].indexOf('scrolling:') >= 0) {
+        var scrolling = stylesArray[i].replace('scrolling:', '');
+        item.scrolling = jQuery.trim(scrolling);
+      }
+      else if (stylesArray[i].indexOf('overflow:') >= 0) {
+        var overflow = stylesArray[i].replace('overflow:', '');
+        item.overflow = jQuery.trim(overflow);
+      }
+    }
+    return item;
+  },
+
+
+  // togglePlayPause()
+  // Hide the pause / play button as appropriate.  If pausing the slideshow also
+  // clear the timers, otherwise move onto the next image.
+  togglePlayPause: function(hideId, showId) {
+    if (Lightbox.isSlideshow && hideId == "lightshowPause") {
+      for (var i = 0; i < Lightbox.slideIdCount; i++) {
+        window.clearTimeout(Lightbox.slideIdArray[i]);
+      }
+    }
+    $('#' + hideId).hide();
+    $('#' + showId).show();
+
+    if (hideId == "lightshowPlay") {
+      Lightbox.isPaused = false;
+      if (!Lightbox.loopSlides && Lightbox.activeImage == (Lightbox.total - 1)) {
+        Lightbox.end();
+      }
+      else if (Lightbox.total > 1) {
+        Lightbox.changeData(Lightbox.activeImage + 1);
+      }
+    }
+    else {
+      Lightbox.isPaused = true;
+    }
+  },
+
+  triggerLightbox: function (rel_type, rel_group) {
+    if (rel_type.length) {
+      if (rel_group && rel_group.length) {
+        $("a[rel^='" + rel_type +"\[" + rel_group + "\]'], area[rel^='" + rel_type +"\[" + rel_group + "\]']").eq(0).trigger("click");
+      }
+      else {
+        $("a[rel^='" + rel_type +"'], area[rel^='" + rel_type +"']").eq(0).trigger("click");
+      }
+    }
+  },
+
+  detectMacFF2: function() {
+    var ua = navigator.userAgent.toLowerCase();
+    if (/firefox[\/\s](\d+\.\d+)/.test(ua)) {
+      var ffversion = new Number(RegExp.$1);
+      if (ffversion < 3 && ua.indexOf('mac') != -1) {
+        return true;
+      }
+    }
+    return false;
+  },
+
+  checkKey: function(keys, key, code) {
+    return (jQuery.inArray(key, keys) != -1 || jQuery.inArray(String(code), keys) != -1);
+  },
+
+  filterXSS: function(str, allowed_tags) {
+    var output = "";
+    $.ajax({
+      url: Drupal.settings.basePath + 'system/lightbox2/filter-xss',
+      data: {
+        'string' : str,
+        'allowed_tags' : allowed_tags
+      },
+      type: "POST",
+      async: false,
+      dataType:  "json",
+      success: function(data) {
+        output = data;
+      }
+    });
+    return output;
+  }
+
+};
+
+// Initialize the lightbox.
+Drupal.behaviors.initLightbox = {
+  attach: function(context) {
+
+  $('body:not(.lightbox-processed)', context).addClass('lightbox-processed').each(function() {
+    Lightbox.initialize();
+    return false; // Break the each loop.
+  });
+
+  // Attach lightbox to any links with lightbox rels.
+  Lightbox.initList(context);
+  $('#lightboxAutoModal', context).triggerHandler('click');
+  }
+};
+})(jQuery);

+ 192 - 0
sites/all/modules/lightbox2/js/lightbox2.js

@@ -0,0 +1,192 @@
+/* $Id: lightbox2.js,v 1.1.4.39 2010/06/07 15:24:24 snpower Exp $ */
+
+// start jQuery block
+(function ($) {
+
+function alt_layout_handler(event) {
+  if ($("input[name=lightbox2_lite]:checked").val() != 1) {
+    if ($("input[name=lightbox2_use_alt_layout]:checked").val() == 1) {
+      $("input[name=lightbox2_force_show_nav]").attr("disabled", "disabled");
+    }
+    else {
+      $("input[name=lightbox2_force_show_nav]").removeAttr("disabled");
+    }
+  }
+}
+
+function zoom_handler(event) {
+  if ($("input[name=lightbox2_disable_resize]:checked").val() == 1) {
+    $("input[name=lightbox2_disable_zoom]").attr("disabled", "disabled");
+  }
+  else {
+    $("input[name=lightbox2_disable_zoom]").removeAttr("disabled");
+  }
+}
+
+function lightbox2_lite_general_handler(event) {
+  // Enable / disable the non-lightbox2-lite options.
+  if ($("input[name=lightbox2_lite]:checked").val() == 1) {
+    $("input[name=lightbox2_use_alt_layout]").attr("disabled", "disabled");
+    $("input[name=lightbox2_force_show_nav]").attr("disabled", "disabled");
+    $("input[name=lightbox2_loop_items]").attr("disabled", "disabled");
+    $("input[name=lightbox2_disable_resize]").attr("disabled", "disabled");
+    $("input[name=lightbox2_disable_zoom]").attr("disabled", "disabled");
+    $("input[name=lightbox2_enable_video]").attr("disabled", "disabled");
+    $("input[name=lightbox2_enable_login]").attr("disabled", "disabled");
+    $("input[name=lightbox2_enable_contact]").attr("disabled", "disabled");
+    $("input[name=lightbox2_node_link_text]").attr("disabled", "disabled");
+    $("input[name=lightbox2_download_link_text]").attr("disabled", "disabled");
+    $("input[name=lightbox2_node_link_target]").attr("disabled", "disabled");
+    $("input[name=lightbox2_image_count_str]").attr("disabled", "disabled");
+    $("input[name=lightbox2_video_count_str]").attr("disabled", "disabled");
+    $("input[name=lightbox2_page_count_str]").attr("disabled", "disabled");
+    $("select[name=lightbox2_display_image_size]").attr("disabled", "disabled");
+    $("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled");
+    $("select[name=lightbox2_image_ncck_group_node_id]").attr("disabled", "disabled");
+    $("select[name=lightbox2_imagefield_group_node_id]").attr("disabled", "disabled");
+    $("input[name=lightbox2_imagefield_use_node_title]").attr("disabled", "disabled");
+    $("input[name=lightbox2_disable_close_click]").attr("disabled", "disabled");
+    $("input[name=lightbox2_border_size]").attr("disabled", "disabled");
+    $("input[name=lightbox2_box_color]").attr("disabled", "disabled");
+    $("input[name=lightbox2_font_color]").attr("disabled", "disabled");
+    $("input[name=lightbox2_top_position]").attr("disabled", "disabled");
+    $("select[name=lightbox2_resize_sequence]").attr("disabled", "disabled");
+    $("input[name=lightbox2_resize_speed]").attr("disabled", "disabled");
+    $("input[name=lightbox2_fadein_speed]").attr("disabled", "disabled");
+    $("input[name=lightbox2_slidedown_speed]").attr("disabled", "disabled");
+  }
+  else {
+    $("input[name=lightbox2_use_alt_layout]").removeAttr("disabled");
+    $("input[name=lightbox2_force_show_nav]").removeAttr("disabled");
+    $("input[name=lightbox2_loop_items]").removeAttr("disabled");
+    $("input[name=lightbox2_disable_resize]").removeAttr("disabled");
+    $("input[name=lightbox2_disable_zoom]").removeAttr("disabled");
+    $("input[name=lightbox2_node_link_text]").removeAttr("disabled");
+    $("input[name=lightbox2_download_link_text]").removeAttr("disabled");
+    $("input[name=lightbox2_node_link_target]").removeAttr("disabled");
+    $("input[name=lightbox2_enable_video]").removeAttr("disabled");
+    $("input[name=lightbox2_enable_login]").removeAttr("disabled");
+    $("input[name=lightbox2_enable_contact]").removeAttr("disabled");
+    $("input[name=lightbox2_image_count_str]").removeAttr("disabled");
+    $("input[name=lightbox2_video_count_str]").removeAttr("disabled");
+    $("input[name=lightbox2_page_count_str]").removeAttr("disabled");
+    $("select[name=lightbox2_display_image_size]").removeAttr("disabled");
+    $("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled");
+    $("select[name=lightbox2_image_ncck_group_node_id]").removeAttr("disabled");
+    $("select[name=lightbox2_imagefield_group_node_id]").removeAttr("disabled");
+    $("input[name=lightbox2_imagefield_use_node_title]").removeAttr("disabled");
+    $("input[name=lightbox2_disable_close_click]").removeAttr("disabled");
+    $("input[name=lightbox2_border_size]").removeAttr("disabled");
+    $("input[name=lightbox2_box_color]").removeAttr("disabled");
+    $("input[name=lightbox2_font_color]").removeAttr("disabled");
+    $("input[name=lightbox2_top_position]").removeAttr("disabled");
+    $("select[name=lightbox2_resize_sequence]").removeAttr("disabled");
+    $("input[name=lightbox2_resize_speed]").removeAttr("disabled");
+    $("input[name=lightbox2_fadein_speed]").removeAttr("disabled");
+    $("input[name=lightbox2_slidedown_speed]").removeAttr("disabled");
+    alt_layout_handler();
+    zoom_handler();
+  }
+}
+
+function image_node_handler(event) {
+  // Image node, flickr, gallery2, inline and custom images stuff.
+  if ($("input[name=lightbox2_lite]").val() != 1) {
+    // Image node only stuff.
+    if ($("select[name=lightbox2_image_node]").val() !== 0) {
+      $("input[name=lightbox2_disable_nested_galleries]").removeAttr("disabled");
+      $("select[name=lightbox2_display_image_size]").removeAttr("disabled");
+      $("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled");
+    }
+    else {
+      $("input[name=lightbox2_disable_nested_galleries]").attr("disabled", "disabled");
+      $("select[name=lightbox2_display_image_size]").attr("disabled", "disabled");
+      $("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled");
+    }
+  }
+}
+
+function lightbox2_lite_auto_handler(event) {
+  // Enable / disable the image node options.
+  if ($("input[name=lightbox2_lite]").val() == 1) {
+    // Disable iframe options.
+    $("input[name=lightbox2_default_frame_width]").attr("disabled", "disabled");
+    $("input[name=lightbox2_default_frame_height]").attr("disabled", "disabled");
+    $("input[name=lightbox2_frame_border]").attr("disabled", "disabled");
+
+    // Disable slideshow options.
+    $("input[name=lightbox2_slideshow_interval]").attr("disabled", "disabled");
+    $("input[name=lightbox2_slideshow_automatic_start]").attr("disabled", "disabled");
+    $("input[name=lightbox2_slideshow_automatic_exit]").attr("disabled", "disabled");
+    $("input[name=lightbox2_slideshow_show_play_pause]").attr("disabled", "disabled");
+    $("input[name=lightbox2_slideshow_pause_on_next_click]").attr("disabled", "disabled");
+    $("input[name=lightbox2_slideshow_pause_on_previous_click]").attr("disabled", "disabled");
+    $("input[name=lightbox2_loop_slides]").attr("disabled", "disabled");
+
+    // Disable automatic image handling options.
+    $("select[name=lightbox2_image_node]").attr("disabled", "disabled");
+    $("select[name=lightbox2_display_image_size]").attr("disabled", "disabled");
+    $("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled");
+    $("select[name=lightbox2_flickr]").attr("disabled", "disabled");
+    $("select[name=lightbox2_gallery2_blocks]").attr("disabled", "disabled");
+    $("select[name=lightbox2_image_assist_custom]").attr("disabled", "disabled");
+    $("select[name=lightbox2_inline]").attr("disabled", "disabled");
+    $("select[name=lightbox2_custom_class_handler]").attr("disabled", "disabled");
+    $("textarea[name=lightbox2_custom_trigger_classes]").attr("disabled", "disabled");
+    $("input[name=lightbox2_disable_nested_galleries]").attr("disabled", "disabled");
+    $("input[name=lightbox2_disable_nested_acidfree_galleries]").attr("disabled", "disabled");
+    $("input[name=lightbox2_enable_acidfree_videos]").attr("disabled", "disabled");
+  }
+  else {
+    // Enable iframe options.
+    $("input[name=lightbox2_default_frame_width]").removeAttr("disabled");
+    $("input[name=lightbox2_default_frame_height]").removeAttr("disabled");
+    $("input[name=lightbox2_frame_border]").removeAttr("disabled");
+
+    // Enable slideshow options.
+    $("input[name=lightbox2_slideshow_interval]").removeAttr("disabled");
+    $("input[name=lightbox2_slideshow_automatic_start]").removeAttr("disabled");
+    $("input[name=lightbox2_slideshow_automatic_exit]").removeAttr("disabled");
+    $("input[name=lightbox2_slideshow_show_play_pause]").removeAttr("disabled");
+    $("input[name=lightbox2_slideshow_pause_on_next_click]").removeAttr("disabled");
+    $("input[name=lightbox2_slideshow_pause_on_previous_click]").removeAttr("disabled");
+    $("input[name=lightbox2_loop_slides]").removeAttr("disabled");
+
+    // Enable automatic image handling options.
+    $("select[name=lightbox2_image_node]").removeAttr("disabled");
+    $("select[name=lightbox2_flickr]").removeAttr("disabled");
+    $("select[name=lightbox2_gallery2_blocks]").removeAttr("disabled");
+    $("select[name=lightbox2_image_assist_custom]").removeAttr("disabled");
+    $("select[name=lightbox2_inline]").removeAttr("disabled");
+    $("select[name=lightbox2_custom_class_handler]").removeAttr("disabled");
+    $("textarea[name=lightbox2_custom_trigger_classes]").removeAttr("disabled");
+    $("select[name=lightbox2_display_image_size]").removeAttr("disabled");
+    $("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled");
+    $("input[name=lightbox2_disable_nested_galleries]").removeAttr("disabled");
+    $("input[name=lightbox2_disable_nested_acidfree_galleries]").removeAttr("disabled");
+    $("input[name=lightbox2_enable_acidfree_videos]").removeAttr("disabled");
+    image_node_handler();
+  }
+}
+
+$(document).ready(function () {
+    // Handle lightbox2_settings_form.
+    lightbox2_lite_general_handler();
+    lightbox2_lite_auto_handler();
+    image_node_handler();
+    $("input[name=lightbox2_lite]").bind("click", lightbox2_lite_general_handler);
+    $("input[name=lightbox2_use_alt_layout]").bind("click", alt_layout_handler);
+    $("input[name=lightbox2_disable_resize]").bind("click", zoom_handler);
+    $("select[name=lightbox2_image_node]").bind("click", image_node_handler);
+    $("select[name=lightbox2_flickr]").bind("click", image_node_handler);
+    $("select[name=lightbox2_gallery2_blocks]").bind("click", image_node_handler);
+    $("select[name=lightbox2_image_assist_custom]").bind("click", image_node_handler);
+    $("select[name=lightbox2_inline]").bind("click", image_node_handler);
+    $("select[name=lightbox2_custom_class_handler]").bind("change", image_node_handler);
+    $("textarea[name=lightbox2_custom_trigger_classes]").bind("change", image_node_handler);
+  });
+
+//End jQuery block
+}(jQuery));
+
+

+ 394 - 0
sites/all/modules/lightbox2/js/lightbox_lite.js

@@ -0,0 +1,394 @@
+/* $Id: lightbox_lite.js,v 1.1.2.2.2.19 2010/06/07 14:54:30 snpower Exp $ */
+
+/**
+ * Lightbox JS: Fullsize Image Overlays
+ * by Lokesh Dhakar - http://www.huddletogether.com
+ *
+ * For more information on this script, visit:
+ * http://huddletogether.com/projects/lightbox/
+ *
+ * This script is distributed via Drupal.org with permission from Lokesh Dhakar.
+ * Under GPL license.
+ *    Mailto: bugzie@gmail.com
+ */
+
+// start jQuery block
+(function ($) {
+//
+// getPageScroll()
+// Returns array with x,y page scroll values.
+// Core code from - quirksmode.org
+//
+function getPageScroll() {
+
+  var xScroll, yScroll;
+
+  if (self.pageYOffset) {
+    yScroll = self.pageYOffset;
+    xScroll = self.pageXOffset;
+
+  // Explorer 6 Strict
+  }
+  else if (document.documentElement && document.documentElement.scrollTop) {
+    yScroll = document.documentElement.scrollTop;
+    xScroll = document.documentElement.scrollLeft;
+  }
+  else if (document.body) {// all other Explorers
+    yScroll = document.body.scrollTop;
+    xScroll = document.body.scrollLeft;
+  }
+
+  arrayPageScroll = [xScroll, yScroll];
+  return arrayPageScroll;
+}
+
+
+
+// getPageSize()
+// Returns array with page width, height and window width, height
+// Core code from - quirksmode.org
+// Edit for Firefox by pHaez
+function getPageSize() {
+
+  var xScroll, yScroll;
+
+  if (window.innerHeight && window.scrollMaxY) {
+    xScroll = window.innerWidth + window.scrollMaxX;
+    yScroll = window.innerHeight + window.scrollMaxY;
+  // all but Explorer Mac
+  }
+  else if (document.body.scrollHeight > document.body.offsetHeight) {
+    xScroll = document.body.scrollWidth;
+    yScroll = document.body.scrollHeight;
+  // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
+  }
+  else {
+    xScroll = document.body.offsetWidth;
+    yScroll = document.body.offsetHeight;
+  }
+
+  var windowWidth, windowHeight;
+  if (self.innerHeight) { // all except Explorer
+    if (document.documentElement.clientHeight) {
+      windowWidth = document.documentElement.clientWidth;
+    }
+    else {
+      windowWidth = self.innerWidth;
+    }
+    windowHeight = self.innerHeight;
+  }
+  else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
+    windowWidth = document.documentElement.clientWidth;
+    windowHeight = document.documentElement.clientHeight;
+  }
+  else if (document.body) { // other Explorers
+    windowWidth = document.body.clientWidth;
+    windowHeight = document.body.clientHeight;
+  }
+
+  // for small pages with total height less then height of the viewport
+  if (yScroll < windowHeight) {
+    pageHeight = windowHeight;
+  }
+  else {
+    pageHeight = yScroll;
+  }
+
+  // for small pages with total width less then width of the viewport
+  if (xScroll < windowWidth) {
+    pageWidth = xScroll;
+  }
+  else {
+    pageWidth = windowWidth;
+  }
+
+
+  arrayPageSize = [pageWidth, pageHeight, windowWidth, windowHeight];
+  return arrayPageSize;
+}
+
+
+// pause(numberMillis)
+function pause(ms) {
+  var date = new Date();
+  var curDate = null;
+  do { curDate = new Date(); }
+  while (curDate - date < ms);
+}
+
+// hideLightbox()
+function hideLightbox() {
+  // get objects
+  objOverlay = document.getElementById('lightbox2-overlay');
+  objLightbox = document.getElementById('lightbox');
+
+  // hide lightbox and overlay
+  objOverlay.style.display = 'none';
+  objLightbox.style.display = 'none';
+
+  // make select boxes visible
+  selects = document.getElementsByTagName("select");
+  for (i = 0; i != selects.length; i++) {
+    if (selects[i].style.display != "none") {
+      selects[i].style.visibility = "visible";
+    }
+  }
+
+  // make flash objects visible
+  embed = document.getElementsByTagName("embed");
+  for (i = 0; i != embed.length; i++) {
+    if (embed[i].style.display != "none") {
+      embed[i].style.visibility = "visible";
+    }
+  }
+  objects = document.getElementsByTagName("object");
+  for (i = 0; i != objects.length; i++) {
+    if (objects[i].style.display != "none") {
+      objects[i].style.visibility = "visible";
+    }
+  }
+
+  // disable keydown listener
+  document.onkeydown = '';
+}
+
+
+// getKey(key)
+// Gets keycode. If 'x' is pressed then it hides the lightbox.
+function getKey(e) {
+  if (e === null) { // ie
+    keycode = event.keyCode;
+    escapeKey = 27;
+  }
+  else { // mozilla
+    keycode = e.keyCode;
+    escapeKey = e.DOM_VK_ESCAPE;
+  }
+  key = String.fromCharCode(keycode).toLowerCase();
+
+  if (key == 'x' || key == 'c' || keycode == escapeKey) { hideLightbox(); }
+}
+
+
+// listenKey()
+function listenKey () { document.onkeydown = getKey; }
+
+
+function imgLoadingError(image, objImage, objLink) {
+  var settings = Drupal.settings.lightbox2;
+  image.src = settings.default_image;
+  objImage.src = settings.default_image;
+  objLink.href = settings.default_image;
+}
+
+
+// showLightbox()
+// Preloads images. Pleaces new image in lightbox then centers and displays.
+function showLightbox(objLink) {
+  var settings = Drupal.settings.lightbox2;
+  // prep objects
+  var objOverlay = document.getElementById('lightbox2-overlay');
+  var objLightbox = document.getElementById('lightbox');
+  var objCaption = document.getElementById('lightboxCaption');
+  var objImage = document.getElementById('lightboxImage');
+  var objLoadingImage = document.getElementById('loadingImage');
+  var objLightboxDetails = document.getElementById('lightboxDetails');
+
+  var arrayPageSize = getPageSize();
+  var arrayPageScroll = getPageScroll();
+
+  // set height of Overlay to take up whole page and show
+  objOverlay.style.height = (arrayPageSize[1] + 'px');
+  objOverlay.style.display = 'block';
+  objOverlay.style.opacity = settings.overlay_opacity;
+  objOverlay.style.backgroundColor = '#' + settings.overlay_color;
+
+  // preload image
+  imgPreload = new Image();
+  imgPreload.onerror = function() { imgLoadingError(this, objImage, objLink); };
+
+  imgPreload.onload = function() {
+    objImage.src = objLink.href;
+
+    // center lightbox and make sure that the top and left values are not
+    // negative and the image placed outside the viewport
+    var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - imgPreload.height) / 2);
+    var lightboxLeft = ((arrayPageSize[0] - 20 - imgPreload.width) / 2);
+
+    objLightbox.style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px";
+    objLightbox.style.left = (lightboxLeft < 0) ? "0px" : lightboxLeft + "px";
+
+
+    //objLightboxDetails.style.width = imgPreload.width + 'px';
+    objLightbox.style.width = imgPreload.width + 'px';
+
+    if (objLink.getAttribute('title')) {
+      objCaption.style.display = 'block';
+      //objCaption.style.width = imgPreload.width + 'px';
+      objCaption.innerHTML = objLink.getAttribute('title');
+    }
+    else {
+      objCaption.style.display = 'none';
+    }
+
+    // A small pause between the image loading and displaying is required with
+    // IE,  this prevents the previous image displaying for a short burst
+    // causing flicker.
+    if (navigator.appVersion.indexOf("MSIE") != -1) {
+      pause(250);
+    }
+
+    if (objLoadingImage) { objLoadingImage.style.display = 'none'; }
+
+    // Hide select boxes as they will 'peek' through the image in IE
+    selects = document.getElementsByTagName("select");
+    for (i = 0; i != selects.length; i++) {
+      if (selects[i].style.display != "none") {
+        selects[i].style.visibility = "hidden";
+      }
+    }
+
+    // Hide flash objects as they will 'peek' through the image in IE
+    embed = document.getElementsByTagName("embed");
+    for (i = 0; i != embed.length; i++) {
+      if (embed[i].style.display != "none") {
+        embed[i].style.visibility = "hidden";
+      }
+    }
+    objects = document.getElementsByTagName("object");
+    for (i = 0; i != objects.length; i++) {
+      if (objects[i].style.display != "none") {
+        objects[i].style.visibility = "hidden";
+      }
+    }
+
+    objLightbox.style.display = 'block';
+
+    // After image is loaded, update the overlay height as the new image might
+    // have increased the overall page height.
+    arrayPageSize = getPageSize();
+    objOverlay.style.height = (arrayPageSize[1] + 'px');
+
+    // Check for 'x' keydown
+    listenKey();
+
+    return false;
+  };
+
+  imgPreload.src = objLink.href;
+
+}
+
+
+
+// initLightbox()
+// Function runs on window load, going through link tags looking for
+// rel="lightbox".  These links receive onclick events that enable the lightbox
+// display for their targets.  The function also inserts html markup at the top
+// of the page which will be used as a container for the overlay pattern and
+// the inline image.
+function initLightbox() {
+
+  if (!document.getElementsByTagName) { return; }
+  var anchors = document.getElementsByTagName("a");
+
+  // loop through all anchor tags
+  for (var i = 0; i < anchors.length; i++) {
+    var anchor = anchors[i];
+    var relAttribute = String(anchor.getAttribute("rel"));
+
+    if (anchor.getAttribute("href") && relAttribute.toLowerCase().match("lightbox")) {
+      $(anchor).click(function(e) { showLightbox(this); if (e.preventDefault) { e.preventDefault(); } return false; });
+    }
+  }
+
+  // the rest of this code inserts html at the top of the page that looks like
+  // this:
+  // <div id="lightbox2-overlay">
+  //  <a href="#" onclick="hideLightbox(); return false;"><img id="loadingImage" /></a>
+  // </div>
+  // <div id="lightbox">
+  //  <a href="#" onclick="hideLightbox(); return false;" title="Click anywhere to close image">
+  //   <img id="closeButton" />
+  //   <img id="lightboxImage" />
+  //  </a>
+  //  <div id="lightboxDetails">
+  //   <div id="lightboxCaption"></div>
+  //   <div id="keyboardMsg"></div>
+  //  </div>
+  // </div>
+
+  var objBody = document.getElementsByTagName("body").item(0);
+
+  // create overlay div and hardcode some functional styles (aesthetic styles are in CSS file)
+  var objOverlay = document.createElement("div");
+  objOverlay.setAttribute('id', 'lightbox2-overlay');
+  objOverlay.onclick = function () { hideLightbox(); return false; };
+  objOverlay.style.display = 'none';
+  objOverlay.style.position = 'absolute';
+  objOverlay.style.top = '0';
+  objOverlay.style.left = '0';
+  objOverlay.style.zIndex = '90';
+  objOverlay.style.width = '100%';
+  objBody.insertBefore(objOverlay, objBody.firstChild);
+
+  var arrayPageSize = getPageSize();
+  var arrayPageScroll = getPageScroll();
+
+  // create loader image
+  var objLoadingImage = document.createElement("span");
+  objLoadingImage.setAttribute('id', 'loadingImage');
+  objOverlay.appendChild(objLoadingImage);
+
+  // create lightbox div, same note about styles as above
+  var objLightbox = document.createElement("div");
+  objLightbox.setAttribute('id', 'lightbox');
+  objLightbox.style.display = 'none';
+  objLightbox.style.position = 'absolute';
+  objLightbox.style.zIndex = '100';
+  objBody.insertBefore(objLightbox, objOverlay.nextSibling);
+
+  // create link
+  var objLink = document.createElement("a");
+  objLink.setAttribute('href', '#');
+  objLink.setAttribute('title', 'Click to close');
+  objLink.onclick = function () { hideLightbox(); return false; };
+  objLightbox.appendChild(objLink);
+
+  // create close button image
+  var objCloseButton = document.createElement("span");
+  objCloseButton.setAttribute('id', 'closeButton');
+  objLink.appendChild(objCloseButton);
+
+  // create image
+  var objImage = document.createElement("img");
+  objImage.setAttribute('id', 'lightboxImage');
+  objLink.appendChild(objImage);
+
+  // create details div, a container for the caption and keyboard message
+  var objLightboxDetails = document.createElement("div");
+  objLightboxDetails.setAttribute('id', 'lightboxDetails');
+  objLightbox.appendChild(objLightboxDetails);
+
+  // create caption
+  var objCaption = document.createElement("div");
+  objCaption.setAttribute('id', 'lightboxCaption');
+  objCaption.style.display = 'none';
+  objLightboxDetails.appendChild(objCaption);
+
+  // create keyboard message
+  var settings = Drupal.settings.lightbox2;
+  var objKeyboardMsg = document.createElement("div");
+  objKeyboardMsg.setAttribute('id', 'keyboardMsg');
+  objKeyboardMsg.innerHTML = settings.lite_press_x_close;
+  objLightboxDetails.appendChild(objKeyboardMsg);
+}
+
+Drupal.behaviors.initLightbox2 = {
+  attach: function(context) {
+    initLightbox();
+  }
+};
+
+//End jQuery block
+}(jQuery));

+ 37 - 0
sites/all/modules/lightbox2/js/lightbox_modal.js

@@ -0,0 +1,37 @@
+(function ($) {
+
+function lightbox2_login() {
+
+  $("a[href*='/user/login'], a[href*='?q=user/login']").each(function() {
+    $(this).attr({
+      href: this.href.replace(/user\/login?/,"user/login/lightbox2"),
+      rel: 'lightmodal[|width:250px; height:210px;]'
+    });
+    $(this).addClass('lightmodal-login');
+  });
+}
+
+function lightbox2_contact() {
+  $("a[href$='/contact'], a[href$='?q=contact']").each(function() {
+    if (!this.href.match('admin/build/contact')) {
+      $(this).attr({
+        href: this.href.replace(/contact?/,"contact/lightbox2"),
+        rel: 'lightmodal[|width:450px; height:450px;]'
+      });
+      $(this).addClass('lightmodal-contact');
+    }
+  });
+}
+
+Drupal.behaviors.initLightboxModal = {
+  attach: function(context, settings) {
+    if (settings.lightbox2.enable_login) {
+      lightbox2_login();
+    }
+    if (settings.lightbox2.enable_contact) {
+     lightbox2_contact();
+    }
+  }
+};
+//End jQuery block
+}(jQuery));

File diff suppressed because it is too large
+ 21 - 0
sites/all/modules/lightbox2/js/lightbox_video.js


+ 4221 - 0
sites/all/modules/lightbox2/js/prototype.js

@@ -0,0 +1,4221 @@
+/*  Prototype JavaScript framework, version 1.6.0.2
+ *  (c) 2005-2008 Sam Stephenson
+ *
+ *  Prototype is freely distributable under the terms of an MIT-style license.
+ *  For details, see the Prototype web site: http://www.prototypejs.org/
+ *
+ *--------------------------------------------------------------------------*/
+
+var Prototype = {
+  Version: '1.6.0.2',
+
+  Browser: {
+    IE:     !!(window.attachEvent && !window.opera),
+    Opera:  !!window.opera,
+    WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
+    Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
+    MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
+  },
+
+  BrowserFeatures: {
+    XPath: !!document.evaluate,
+    ElementExtensions: !!window.HTMLElement,
+    SpecificElementExtensions:
+      document.createElement('div').__proto__ &&
+      document.createElement('div').__proto__ !==
+        document.createElement('form').__proto__
+  },
+
+  ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
+  JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
+
+  emptyFunction: function() { },
+  K: function(x) { return x }
+};
+
+if (Prototype.Browser.MobileSafari)
+  Prototype.BrowserFeatures.SpecificElementExtensions = false;
+
+
+/* Based on Alex Arnell's inheritance implementation. */
+var Class = {
+  create: function() {
+    var parent = null, properties = $A(arguments);
+    if (Object.isFunction(properties[0]))
+      parent = properties.shift();
+
+    function klass() {
+      this.initialize.apply(this, arguments);
+    }
+
+    Object.extend(klass, Class.Methods);
+    klass.superclass = parent;
+    klass.subclasses = [];
+
+    if (parent) {
+      var subclass = function() { };
+      subclass.prototype = parent.prototype;
+      klass.prototype = new subclass;
+      parent.subclasses.push(klass);
+    }
+
+    for (var i = 0; i < properties.length; i++)
+      klass.addMethods(properties[i]);
+
+    if (!klass.prototype.initialize)
+      klass.prototype.initialize = Prototype.emptyFunction;
+
+    klass.prototype.constructor = klass;
+
+    return klass;
+  }
+};
+
+Class.Methods = {
+  addMethods: function(source) {
+    var ancestor   = this.superclass && this.superclass.prototype;
+    var properties = Object.keys(source);
+
+    if (!Object.keys({ toString: true }).length)
+      properties.push("toString", "valueOf");
+
+    for (var i = 0, length = properties.length; i < length; i++) {
+      var property = properties[i], value = source[property];
+      if (ancestor && Object.isFunction(value) &&
+          value.argumentNames().first() == "$super") {
+        var method = value, value = Object.extend((function(m) {
+          return function() { return ancestor[m].apply(this, arguments) };
+        })(property).wrap(method), {
+          valueOf:  function() { return method },
+          toString: function() { return method.toString() }
+        });
+      }
+      this.prototype[property] = value;
+    }
+
+    return this;
+  }
+};
+
+var Abstract = { };
+
+Object.extend = function(destination, source) {
+  for (var property in source)
+    destination[property] = source[property];
+  return destination;
+};
+
+Object.extend(Object, {
+  inspect: function(object) {
+    try {
+      if (Object.isUndefined(object)) return 'undefined';
+      if (object === null) return 'null';
+      return object.inspect ? object.inspect() : String(object);
+    } catch (e) {
+      if (e instanceof RangeError) return '...';
+      throw e;
+    }
+  },
+
+  toJSON: function(object) {
+    var type = typeof object;
+    switch (type) {
+      case 'undefined':
+      case 'function':
+      case 'unknown': return;
+      case 'boolean': return object.toString();
+    }
+
+    if (object === null) return 'null';
+    if (object.toJSON) return object.toJSON();
+    if (Object.isElement(object)) return;
+
+    var results = [];
+    for (var property in object) {
+      var value = Object.toJSON(object[property]);
+      if (!Object.isUndefined(value))
+        results.push(property.toJSON() + ': ' + value);
+    }
+
+    return '{' + results.join(', ') + '}';
+  },
+
+  toQueryString: function(object) {
+    return $H(object).toQueryString();
+  },
+
+  toHTML: function(object) {
+    return object && object.toHTML ? object.toHTML() : String.interpret(object);
+  },
+
+  keys: function(object) {
+    var keys = [];
+    for (var property in object)
+      keys.push(property);
+    return keys;
+  },
+
+  values: function(object) {
+    var values = [];
+    for (var property in object)
+      values.push(object[property]);
+    return values;
+  },
+
+  clone: function(object) {
+    return Object.extend({ }, object);
+  },
+
+  isElement: function(object) {
+    return object && object.nodeType == 1;
+  },
+
+  isArray: function(object) {
+    return object != null && typeof object == "object" &&
+      'splice' in object && 'join' in object;
+  },
+
+  isHash: function(object) {
+    return object instanceof Hash;
+  },
+
+  isFunction: function(object) {
+    return typeof object == "function";
+  },
+
+  isString: function(object) {
+    return typeof object == "string";
+  },
+
+  isNumber: function(object) {
+    return typeof object == "number";
+  },
+
+  isUndefined: function(object) {
+    return typeof object == "undefined";
+  }
+});
+
+Object.extend(Function.prototype, {
+  argumentNames: function() {
+    var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");
+    return names.length == 1 && !names[0] ? [] : names;
+  },
+
+  bind: function() {
+    if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
+    var __method = this, args = $A(arguments), object = args.shift();
+    return function() {
+      return __method.apply(object, args.concat($A(arguments)));
+    }
+  },
+
+  bindAsEventListener: function() {
+    var __method = this, args = $A(arguments), object = args.shift();
+    return function(event) {
+      return __method.apply(object, [event || window.event].concat(args));
+    }
+  },
+
+  curry: function() {
+    if (!arguments.length) return this;
+    var __method = this, args = $A(arguments);
+    return function() {
+      return __method.apply(this, args.concat($A(arguments)));
+    }
+  },
+
+  delay: function() {
+    var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
+    return window.setTimeout(function() {
+      return __method.apply(__method, args);
+    }, timeout);
+  },
+
+  wrap: function(wrapper) {
+    var __method = this;
+    return function() {
+      return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
+    }
+  },
+
+  methodize: function() {
+    if (this._methodized) return this._methodized;
+    var __method = this;
+    return this._methodized = function() {
+      return __method.apply(null, [this].concat($A(arguments)));
+    };
+  }
+});
+
+Function.prototype.defer = Function.prototype.delay.curry(0.01);
+
+Date.prototype.toJSON = function() {
+  return '"' + this.getUTCFullYear() + '-' +
+    (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
+    this.getUTCDate().toPaddedString(2) + 'T' +
+    this.getUTCHours().toPaddedString(2) + ':' +
+    this.getUTCMinutes().toPaddedString(2) + ':' +
+    this.getUTCSeconds().toPaddedString(2) + 'Z"';
+};
+
+var Try = {
+  these: function() {
+    var returnValue;
+
+    for (var i = 0, length = arguments.length; i < length; i++) {
+      var lambda = arguments[i];
+      try {
+        returnValue = lambda();
+        break;
+      } catch (e) { }
+    }
+
+    return returnValue;
+  }
+};
+
+RegExp.prototype.match = RegExp.prototype.test;
+
+RegExp.escape = function(str) {
+  return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
+};
+
+/*--------------------------------------------------------------------------*/
+
+var PeriodicalExecuter = Class.create({
+  initialize: function(callback, frequency) {
+    this.callback = callback;
+    this.frequency = frequency;
+    this.currentlyExecuting = false;
+
+    this.registerCallback();
+  },
+
+  registerCallback: function() {
+    this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+  },
+
+  execute: function() {
+    this.callback(this);
+  },
+
+  stop: function() {
+    if (!this.timer) return;
+    clearInterval(this.timer);
+    this.timer = null;
+  },
+
+  onTimerEvent: function() {
+    if (!this.currentlyExecuting) {
+      try {
+        this.currentlyExecuting = true;
+        this.execute();
+      } finally {
+        this.currentlyExecuting = false;
+      }
+    }
+  }
+});
+Object.extend(String, {
+  interpret: function(value) {
+    return value == null ? '' : String(value);
+  },
+  specialChar: {
+    '\b': '\\b',
+    '\t': '\\t',
+    '\n': '\\n',
+    '\f': '\\f',
+    '\r': '\\r',
+    '\\': '\\\\'
+  }
+});
+
+Object.extend(String.prototype, {
+  gsub: function(pattern, replacement) {
+    var result = '', source = this, match;
+    replacement = arguments.callee.prepareReplacement(replacement);
+
+    while (source.length > 0) {
+      if (match = source.match(pattern)) {
+        result += source.slice(0, match.index);
+        result += String.interpret(replacement(match));
+        source  = source.slice(match.index + match[0].length);
+      } else {
+        result += source, source = '';
+      }
+    }
+    return result;
+  },
+
+  sub: function(pattern, replacement, count) {
+    replacement = this.gsub.prepareReplacement(replacement);
+    count = Object.isUndefined(count) ? 1 : count;
+
+    return this.gsub(pattern, function(match) {
+      if (--count < 0) return match[0];
+      return replacement(match);
+    });
+  },
+
+  scan: function(pattern, iterator) {
+    this.gsub(pattern, iterator);
+    return String(this);
+  },
+
+  truncate: function(length, truncation) {
+    length = length || 30;
+    truncation = Object.isUndefined(truncation) ? '...' : truncation;
+    return this.length > length ?
+      this.slice(0, length - truncation.length) + truncation : String(this);
+  },
+
+  strip: function() {
+    return this.replace(/^\s+/, '').replace(/\s+$/, '');
+  },
+
+  stripTags: function() {
+    return this.replace(/<\/?[^>]+>/gi, '');
+  },
+
+  stripScripts: function() {
+    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
+  },
+
+  extractScripts: function() {
+    var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
+    var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
+    return (this.match(matchAll) || []).map(function(scriptTag) {
+      return (scriptTag.match(matchOne) || ['', ''])[1];
+    });
+  },
+
+  evalScripts: function() {
+    return this.extractScripts().map(function(script) { return eval(script) });
+  },
+
+  escapeHTML: function() {
+    var self = arguments.callee;
+    self.text.data = this;
+    return self.div.innerHTML;
+  },
+
+  unescapeHTML: function() {
+    var div = new Element('div');
+    div.innerHTML = this.stripTags();
+    return div.childNodes[0] ? (div.childNodes.length > 1 ?
+      $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
+      div.childNodes[0].nodeValue) : '';
+  },
+
+  toQueryParams: function(separator) {
+    var match = this.strip().match(/([^?#]*)(#.*)?$/);
+    if (!match) return { };
+
+    return match[1].split(separator || '&').inject({ }, function(hash, pair) {
+      if ((pair = pair.split('='))[0]) {
+        var key = decodeURIComponent(pair.shift());
+        var value = pair.length > 1 ? pair.join('=') : pair[0];
+        if (value != undefined) value = decodeURIComponent(value);
+
+        if (key in hash) {
+          if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
+          hash[key].push(value);
+        }
+        else hash[key] = value;
+      }
+      return hash;
+    });
+  },
+
+  toArray: function() {
+    return this.split('');
+  },
+
+  succ: function() {
+    return this.slice(0, this.length - 1) +
+      String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
+  },
+
+  times: function(count) {
+    return count < 1 ? '' : new Array(count + 1).join(this);
+  },
+
+  camelize: function() {
+    var parts = this.split('-'), len = parts.length;
+    if (len == 1) return parts[0];
+
+    var camelized = this.charAt(0) == '-'
+      ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
+      : parts[0];
+
+    for (var i = 1; i < len; i++)
+      camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
+
+    return camelized;
+  },
+
+  capitalize: function() {
+    return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
+  },
+
+  underscore: function() {
+    return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
+  },
+
+  dasherize: function() {
+    return this.gsub(/_/,'-');
+  },
+
+  inspect: function(useDoubleQuotes) {
+    var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
+      var character = String.specialChar[match[0]];
+      return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
+    });
+    if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
+    return "'" + escapedString.replace(/'/g, '\\\'') + "'";
+  },
+
+  toJSON: function() {
+    return this.inspect(true);
+  },
+
+  unfilterJSON: function(filter) {
+    return this.sub(filter || Prototype.JSONFilter, '#{1}');
+  },
+
+  isJSON: function() {
+    var str = this;
+    if (str.blank()) return false;
+    str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
+    return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
+  },
+
+  evalJSON: function(sanitize) {
+    var json = this.unfilterJSON();
+    try {
+      if (!sanitize || json.isJSON()) return eval('(' + json + ')');
+    } catch (e) { }
+    throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
+  },
+
+  include: function(pattern) {
+    return this.indexOf(pattern) > -1;
+  },
+
+  startsWith: function(pattern) {
+    return this.indexOf(pattern) === 0;
+  },
+
+  endsWith: function(pattern) {
+    var d = this.length - pattern.length;
+    return d >= 0 && this.lastIndexOf(pattern) === d;
+  },
+
+  empty: function() {
+    return this == '';
+  },
+
+  blank: function() {
+    return /^\s*$/.test(this);
+  },
+
+  interpolate: function(object, pattern) {
+    return new Template(this, pattern).evaluate(object);
+  }
+});
+
+if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
+  escapeHTML: function() {
+    return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
+  },
+  unescapeHTML: function() {
+    return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
+  }
+});
+
+String.prototype.gsub.prepareReplacement = function(replacement) {
+  if (Object.isFunction(replacement)) return replacement;
+  var template = new Template(replacement);
+  return function(match) { return template.evaluate(match) };
+};
+
+String.prototype.parseQuery = String.prototype.toQueryParams;
+
+Object.extend(String.prototype.escapeHTML, {
+  div:  document.createElement('div'),
+  text: document.createTextNode('')
+});
+
+with (String.prototype.escapeHTML) div.appendChild(text);
+
+var Template = Class.create({
+  initialize: function(template, pattern) {
+    this.template = template.toString();
+    this.pattern = pattern || Template.Pattern;
+  },
+
+  evaluate: function(object) {
+    if (Object.isFunction(object.toTemplateReplacements))
+      object = object.toTemplateReplacements();
+
+    return this.template.gsub(this.pattern, function(match) {
+      if (object == null) return '';
+
+      var before = match[1] || '';
+      if (before == '\\') return match[2];
+
+      var ctx = object, expr = match[3];
+      var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
+      match = pattern.exec(expr);
+      if (match == null) return before;
+
+      while (match != null) {
+        var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
+        ctx = ctx[comp];
+        if (null == ctx || '' == match[3]) break;
+        expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
+        match = pattern.exec(expr);
+      }
+
+      return before + String.interpret(ctx);
+    });
+  }
+});
+Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
+
+var $break = { };
+
+var Enumerable = {
+  each: function(iterator, context) {
+    var index = 0;
+    iterator = iterator.bind(context);
+    try {
+      this._each(function(value) {
+        iterator(value, index++);
+      });
+    } catch (e) {
+      if (e != $break) throw e;
+    }
+    return this;
+  },
+
+  eachSlice: function(number, iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var index = -number, slices = [], array = this.toArray();
+    while ((index += number) < array.length)
+      slices.push(array.slice(index, index+number));
+    return slices.collect(iterator, context);
+  },
+
+  all: function(iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var result = true;
+    this.each(function(value, index) {
+      result = result && !!iterator(value, index);
+      if (!result) throw $break;
+    });
+    return result;
+  },
+
+  any: function(iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var result = false;
+    this.each(function(value, index) {
+      if (result = !!iterator(value, index))
+        throw $break;
+    });
+    return result;
+  },
+
+  collect: function(iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var results = [];
+    this.each(function(value, index) {
+      results.push(iterator(value, index));
+    });
+    return results;
+  },
+
+  detect: function(iterator, context) {
+    iterator = iterator.bind(context);
+    var result;
+    this.each(function(value, index) {
+      if (iterator(value, index)) {
+        result = value;
+        throw $break;
+      }
+    });
+    return result;
+  },
+
+  findAll: function(iterator, context) {
+    iterator = iterator.bind(context);
+    var results = [];
+    this.each(function(value, index) {
+      if (iterator(value, index))
+        results.push(value);
+    });
+    return results;
+  },
+
+  grep: function(filter, iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var results = [];
+
+    if (Object.isString(filter))
+      filter = new RegExp(filter);
+
+    this.each(function(value, index) {
+      if (filter.match(value))
+        results.push(iterator(value, index));
+    });
+    return results;
+  },
+
+  include: function(object) {
+    if (Object.isFunction(this.indexOf))
+      if (this.indexOf(object) != -1) return true;
+
+    var found = false;
+    this.each(function(value) {
+      if (value == object) {
+        found = true;
+        throw $break;
+      }
+    });
+    return found;
+  },
+
+  inGroupsOf: function(number, fillWith) {
+    fillWith = Object.isUndefined(fillWith) ? null : fillWith;
+    return this.eachSlice(number, function(slice) {
+      while(slice.length < number) slice.push(fillWith);
+      return slice;
+    });
+  },
+
+  inject: function(memo, iterator, context) {
+    iterator = iterator.bind(context);
+    this.each(function(value, index) {
+      memo = iterator(memo, value, index);
+    });
+    return memo;
+  },
+
+  invoke: function(method) {
+    var args = $A(arguments).slice(1);
+    return this.map(function(value) {
+      return value[method].apply(value, args);
+    });
+  },
+
+  max: function(iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var result;
+    this.each(function(value, index) {
+      value = iterator(value, index);
+      if (result == null || value >= result)
+        result = value;
+    });
+    return result;
+  },
+
+  min: function(iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var result;
+    this.each(function(value, index) {
+      value = iterator(value, index);
+      if (result == null || value < result)
+        result = value;
+    });
+    return result;
+  },
+
+  partition: function(iterator, context) {
+    iterator = iterator ? iterator.bind(context) : Prototype.K;
+    var trues = [], falses = [];
+    this.each(function(value, index) {
+      (iterator(value, index) ?
+        trues : falses).push(value);
+    });
+    return [trues, falses];
+  },
+
+  pluck: function(property) {
+    var results = [];
+    this.each(function(value) {
+      results.push(value[property]);
+    });
+    return results;
+  },
+
+  reject: function(iterator, context) {
+    iterator = iterator.bind(context);
+    var results = [];
+    this.each(function(value, index) {
+      if (!iterator(value, index))
+        results.push(value);
+    });
+    return results;
+  },
+
+  sortBy: function(iterator, context) {
+    iterator = iterator.bind(context);
+    return this.map(function(value, index) {
+      return {value: value, criteria: iterator(value, index)};
+    }).sort(function(left, right) {
+      var a = left.criteria, b = right.criteria;
+      return a < b ? -1 : a > b ? 1 : 0;
+    }).pluck('value');
+  },
+
+  toArray: function() {
+    return this.map();
+  },
+
+  zip: function() {
+    var iterator = Prototype.K, args = $A(arguments);
+    if (Object.isFunction(args.last()))
+      iterator = args.pop();
+
+    var collections = [this].concat(args).map($A);
+    return this.map(function(value, index) {
+      return iterator(collections.pluck(index));
+    });
+  },
+
+  size: function() {
+    return this.toArray().length;
+  },
+
+  inspect: function() {
+    return '#<Enumerable:' + this.toArray().inspect() + '>';
+  }
+};
+
+Object.extend(Enumerable, {
+  map:     Enumerable.collect,
+  find:    Enumerable.detect,
+  select:  Enumerable.findAll,
+  filter:  Enumerable.findAll,
+  member:  Enumerable.include,
+  entries: Enumerable.toArray,
+  every:   Enumerable.all,
+  some:    Enumerable.any
+});
+function $A(iterable) {
+  if (!iterable) return [];
+  if (iterable.toArray) return iterable.toArray();
+  var length = iterable.length || 0, results = new Array(length);
+  while (length--) results[length] = iterable[length];
+  return results;
+}
+
+if (Prototype.Browser.WebKit) {
+  $A = function(iterable) {
+    if (!iterable) return [];
+    if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
+        iterable.toArray) return iterable.toArray();
+    var length = iterable.length || 0, results = new Array(length);
+    while (length--) results[length] = iterable[length];
+    return results;
+  };
+}
+
+Array.from = $A;
+
+Object.extend(Array.prototype, Enumerable);
+
+if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;
+
+Object.extend(Array.prototype, {
+  _each: function(iterator) {
+    for (var i = 0, length = this.length; i < length; i++)
+      iterator(this[i]);
+  },
+
+  clear: function() {
+    this.length = 0;
+    return this;
+  },
+
+  first: function() {
+    return this[0];
+  },
+
+  last: function() {
+    return this[this.length - 1];
+  },
+
+  compact: function() {
+    return this.select(function(value) {
+      return value != null;
+    });
+  },
+
+  flatten: function() {
+    return this.inject([], function(array, value) {
+      return array.concat(Object.isArray(value) ?
+        value.flatten() : [value]);
+    });
+  },
+
+  without: function() {
+    var values = $A(arguments);
+    return this.select(function(value) {
+      return !values.include(value);
+    });
+  },
+
+  reverse: function(inline) {
+    return (inline !== false ? this : this.toArray())._reverse();
+  },
+
+  reduce: function() {
+    return this.length > 1 ? this : this[0];
+  },
+
+  uniq: function(sorted) {
+    return this.inject([], function(array, value, index) {
+      if (0 == index || (sorted ? array.last() != value : !array.include(value)))
+        array.push(value);
+      return array;
+    });
+  },
+
+  intersect: function(array) {
+    return this.uniq().findAll(function(item) {
+      return array.detect(function(value) { return item === value });
+    });
+  },
+
+  clone: function() {
+    return [].concat(this);
+  },
+
+  size: function() {
+    return this.length;
+  },
+
+  inspect: function() {
+    return '[' + this.map(Object.inspect).join(', ') + ']';
+  },
+
+  toJSON: function() {
+    var results = [];
+    this.each(function(object) {
+      var value = Object.toJSON(object);
+      if (!Object.isUndefined(value)) results.push(value);
+    });
+    return '[' + results.join(', ') + ']';
+  }
+});
+
+// use native browser JS 1.6 implementation if available
+if (Object.isFunction(Array.prototype.forEach))
+  Array.prototype._each = Array.prototype.forEach;
+
+if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
+  i || (i = 0);
+  var length = this.length;
+  if (i < 0) i = length + i;
+  for (; i < length; i++)
+    if (this[i] === item) return i;
+  return -1;
+};
+
+if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
+  i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
+  var n = this.slice(0, i).reverse().indexOf(item);
+  return (n < 0) ? n : i - n - 1;
+};
+
+Array.prototype.toArray = Array.prototype.clone;
+
+function $w(string) {
+  if (!Object.isString(string)) return [];
+  string = string.strip();
+  return string ? string.split(/\s+/) : [];
+}
+
+if (Prototype.Browser.Opera){
+  Array.prototype.concat = function() {
+    var array = [];
+    for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
+    for (var i = 0, length = arguments.length; i < length; i++) {
+      if (Object.isArray(arguments[i])) {
+        for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
+          array.push(arguments[i][j]);
+      } else {
+        array.push(arguments[i]);
+      }
+    }
+    return array;
+  };
+}
+Object.extend(Number.prototype, {
+  toColorPart: function() {
+    return this.toPaddedString(2, 16);
+  },
+
+  succ: function() {
+    return this + 1;
+  },
+
+  times: function(iterator) {
+    $R(0, this, true).each(iterator);
+    return this;
+  },
+
+  toPaddedString: function(length, radix) {
+    var string = this.toString(radix || 10);
+    return '0'.times(length - string.length) + string;
+  },
+
+  toJSON: function() {
+    return isFinite(this) ? this.toString() : 'null';
+  }
+});
+
+$w('abs round ceil floor').each(function(method){
+  Number.prototype[method] = Math[method].methodize();
+});
+function $H(object) {
+  return new Hash(object);
+};
+
+var Hash = Class.create(Enumerable, (function() {
+
+  function toQueryPair(key, value) {
+    if (Object.isUndefined(value)) return key;
+    return key + '=' + encodeURIComponent(String.interpret(value));
+  }
+
+  return {
+    initialize: function(object) {
+      this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
+    },
+
+    _each: function(iterator) {
+      for (var key in this._object) {
+        var value = this._object[key], pair = [key, value];
+        pair.key = key;
+        pair.value = value;
+        iterator(pair);
+      }
+    },
+
+    set: function(key, value) {
+      return this._object[key] = value;
+    },
+
+    get: function(key) {
+      return this._object[key];
+    },
+
+    unset: function(key) {
+      var value = this._object[key];
+      delete this._object[key];
+      return value;
+    },
+
+    toObject: function() {
+      return Object.clone(this._object);
+    },
+
+    keys: function() {
+      return this.pluck('key');
+    },
+
+    values: function() {
+      return this.pluck('value');
+    },
+
+    index: function(value) {
+      var match = this.detect(function(pair) {
+        return pair.value === value;
+      });
+      return match && match.key;
+    },
+
+    merge: function(object) {
+      return this.clone().update(object);
+    },
+
+    update: function(object) {
+      return new Hash(object).inject(this, function(result, pair) {
+        result.set(pair.key, pair.value);
+        return result;
+      });
+    },
+
+    toQueryString: function() {
+      return this.map(function(pair) {
+        var key = encodeURIComponent(pair.key), values = pair.value;
+
+        if (values && typeof values == 'object') {
+          if (Object.isArray(values))
+            return values.map(toQueryPair.curry(key)).join('&');
+        }
+        return toQueryPair(key, values);
+      }).join('&');
+    },
+
+    inspect: function() {
+      return '#<Hash:{' + this.map(function(pair) {
+        return pair.map(Object.inspect).join(': ');
+      }).join(', ') + '}>';
+    },
+
+    toJSON: function() {
+      return Object.toJSON(this.toObject());
+    },
+
+    clone: function() {
+      return new Hash(this);
+    }
+  }
+})());
+
+Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
+Hash.from = $H;
+var ObjectRange = Class.create(Enumerable, {
+  initialize: function(start, end, exclusive) {
+    this.start = start;
+    this.end = end;
+    this.exclusive = exclusive;
+  },
+
+  _each: function(iterator) {
+    var value = this.start;
+    while (this.include(value)) {
+      iterator(value);
+      value = value.succ();
+    }
+  },
+
+  include: function(value) {
+    if (value < this.start)
+      return false;
+    if (this.exclusive)
+      return value < this.end;
+    return value <= this.end;
+  }
+});
+
+var $R = function(start, end, exclusive) {
+  return new ObjectRange(start, end, exclusive);
+};
+
+var Ajax = {
+  getTransport: function() {
+    return Try.these(
+      function() {return new XMLHttpRequest()},
+      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
+      function() {return new ActiveXObject('Microsoft.XMLHTTP')}
+    ) || false;
+  },
+
+  activeRequestCount: 0
+};
+
+Ajax.Responders = {
+  responders: [],
+
+  _each: function(iterator) {
+    this.responders._each(iterator);
+  },
+
+  register: function(responder) {
+    if (!this.include(responder))
+      this.responders.push(responder);
+  },
+
+  unregister: function(responder) {
+    this.responders = this.responders.without(responder);
+  },
+
+  dispatch: function(callback, request, transport, json) {
+    this.each(function(responder) {
+      if (Object.isFunction(responder[callback])) {
+        try {
+          responder[callback].apply(responder, [request, transport, json]);
+        } catch (e) { }
+      }
+    });
+  }
+};
+
+Object.extend(Ajax.Responders, Enumerable);
+
+Ajax.Responders.register({
+  onCreate:   function() { Ajax.activeRequestCount++ },
+  onComplete: function() { Ajax.activeRequestCount-- }
+});
+
+Ajax.Base = Class.create({
+  initialize: function(options) {
+    this.options = {
+      method:       'post',
+      asynchronous: true,
+      contentType:  'application/x-www-form-urlencoded',
+      encoding:     'UTF-8',
+      parameters:   '',
+      evalJSON:     true,
+      evalJS:       true
+    };
+    Object.extend(this.options, options || { });
+
+    this.options.method = this.options.method.toLowerCase();
+
+    if (Object.isString(this.options.parameters))
+      this.options.parameters = this.options.parameters.toQueryParams();
+    else if (Object.isHash(this.options.parameters))
+      this.options.parameters = this.options.parameters.toObject();
+  }
+});
+
+Ajax.Request = Class.create(Ajax.Base, {
+  _complete: false,
+
+  initialize: function($super, url, options) {
+    $super(options);
+    this.transport = Ajax.getTransport();
+    this.request(url);
+  },
+
+  request: function(url) {
+    this.url = url;
+    this.method = this.options.method;
+    var params = Object.clone(this.options.parameters);
+
+    if (!['get', 'post'].include(this.method)) {
+      // simulate other verbs over post
+      params['_method'] = this.method;
+      this.method = 'post';
+    }
+
+    this.parameters = params;
+
+    if (params = Object.toQueryString(params)) {
+      // when GET, append parameters to URL
+      if (this.method == 'get')
+        this.url += (this.url.include('?') ? '&' : '?') + params;
+      else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
+        params += '&_=';
+    }
+
+    try {
+      var response = new Ajax.Response(this);
+      if (this.options.onCreate) this.options.onCreate(response);
+      Ajax.Responders.dispatch('onCreate', this, response);
+
+      this.transport.open(this.method.toUpperCase(), this.url,
+        this.options.asynchronous);
+
+      if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
+
+      this.transport.onreadystatechange = this.onStateChange.bind(this);
+      this.setRequestHeaders();
+
+      this.body = this.method == 'post' ? (this.options.postBody || params) : null;
+      this.transport.send(this.body);
+
+      /* Force Firefox to handle ready state 4 for synchronous requests */
+      if (!this.options.asynchronous && this.transport.overrideMimeType)
+        this.onStateChange();
+
+    }
+    catch (e) {
+      this.dispatchException(e);
+    }
+  },
+
+  onStateChange: function() {
+    var readyState = this.transport.readyState;
+    if (readyState > 1 && !((readyState == 4) && this._complete))
+      this.respondToReadyState(this.transport.readyState);
+  },
+
+  setRequestHeaders: function() {
+    var headers = {
+      'X-Requested-With': 'XMLHttpRequest',
+      'X-Prototype-Version': Prototype.Version,
+      'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
+    };
+
+    if (this.method == 'post') {
+      headers['Content-type'] = this.options.contentType +
+        (this.options.encoding ? '; charset=' + this.options.encoding : '');
+
+      /* Force "Connection: close" for older Mozilla browsers to work
+       * around a bug where XMLHttpRequest sends an incorrect
+       * Content-length header. See Mozilla Bugzilla #246651.
+       */
+      if (this.transport.overrideMimeType &&
+          (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
+            headers['Connection'] = 'close';
+    }
+
+    // user-defined headers
+    if (typeof this.options.requestHeaders == 'object') {
+      var extras = this.options.requestHeaders;
+
+      if (Object.isFunction(extras.push))
+        for (var i = 0, length = extras.length; i < length; i += 2)
+          headers[extras[i]] = extras[i+1];
+      else
+        $H(extras).each(function(pair) { headers[pair.key] = pair.value });
+    }
+
+    for (var name in headers)
+      this.transport.setRequestHeader(name, headers[name]);
+  },
+
+  success: function() {
+    var status = this.getStatus();
+    return !status || (status >= 200 && status < 300);
+  },
+
+  getStatus: function() {
+    try {
+      return this.transport.status || 0;
+    } catch (e) { return 0 }
+  },
+
+  respondToReadyState: function(readyState) {
+    var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
+
+    if (state == 'Complete') {
+      try {
+        this._complete = true;
+        (this.options['on' + response.status]
+         || this.options['on' + (this.success() ? 'Success' : 'Failure')]
+         || Prototype.emptyFunction)(response, response.headerJSON);
+      } catch (e) {
+        this.dispatchException(e);
+      }
+
+      var contentType = response.getHeader('Content-type');
+      if (this.options.evalJS == 'force'
+          || (this.options.evalJS && this.isSameOrigin() && contentType
+          && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
+        this.evalResponse();
+    }
+
+    try {
+      (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
+      Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
+    } catch (e) {
+      this.dispatchException(e);
+    }
+
+    if (state == 'Complete') {
+      // avoid memory leak in MSIE: clean up
+      this.transport.onreadystatechange = Prototype.emptyFunction;
+    }
+  },
+
+  isSameOrigin: function() {
+    var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
+    return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
+      protocol: location.protocol,
+      domain: document.domain,
+      port: location.port ? ':' + location.port : ''
+    }));
+  },
+
+  getHeader: function(name) {
+    try {
+      return this.transport.getResponseHeader(name) || null;
+    } catch (e) { return null }
+  },
+
+  evalResponse: function() {
+    try {
+      return eval((this.transport.responseText || '').unfilterJSON());
+    } catch (e) {
+      this.dispatchException(e);
+    }
+  },
+
+  dispatchException: function(exception) {
+    (this.options.onException || Prototype.emptyFunction)(this, exception);
+    Ajax.Responders.dispatch('onException', this, exception);
+  }
+});
+
+Ajax.Request.Events =
+  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
+
+Ajax.Response = Class.create({
+  initialize: function(request){
+    this.request = request;
+    var transport  = this.transport  = request.transport,
+        readyState = this.readyState = transport.readyState;
+
+    if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
+      this.status       = this.getStatus();
+      this.statusText   = this.getStatusText();
+      this.responseText = String.interpret(transport.responseText);
+      this.headerJSON   = this._getHeaderJSON();
+    }
+
+    if(readyState == 4) {
+      var xml = transport.responseXML;
+      this.responseXML  = Object.isUndefined(xml) ? null : xml;
+      this.responseJSON = this._getResponseJSON();
+    }
+  },
+
+  status:      0,
+  statusText: '',
+
+  getStatus: Ajax.Request.prototype.getStatus,
+
+  getStatusText: function() {
+    try {
+      return this.transport.statusText || '';
+    } catch (e) { return '' }
+  },
+
+  getHeader: Ajax.Request.prototype.getHeader,
+
+  getAllHeaders: function() {
+    try {
+      return this.getAllResponseHeaders();
+    } catch (e) { return null }
+  },
+
+  getResponseHeader: function(name) {
+    return this.transport.getResponseHeader(name);
+  },
+
+  getAllResponseHeaders: function() {
+    return this.transport.getAllResponseHeaders();
+  },
+
+  _getHeaderJSON: function() {
+    var json = this.getHeader('X-JSON');
+    if (!json) return null;
+    json = decodeURIComponent(escape(json));
+    try {
+      return json.evalJSON(this.request.options.sanitizeJSON ||
+        !this.request.isSameOrigin());
+    } catch (e) {
+      this.request.dispatchException(e);
+    }
+  },
+
+  _getResponseJSON: function() {
+    var options = this.request.options;
+    if (!options.evalJSON || (options.evalJSON != 'force' &&
+      !(this.getHeader('Content-type') || '').include('application/json')) ||
+        this.responseText.blank())
+          return null;
+    try {
+      return this.responseText.evalJSON(options.sanitizeJSON ||
+        !this.request.isSameOrigin());
+    } catch (e) {
+      this.request.dispatchException(e);
+    }
+  }
+});
+
+Ajax.Updater = Class.create(Ajax.Request, {
+  initialize: function($super, container, url, options) {
+    this.container = {
+      success: (container.success || container),
+      failure: (container.failure || (container.success ? null : container))
+    };
+
+    options = Object.clone(options);
+    var onComplete = options.onComplete;
+    options.onComplete = (function(response, json) {
+      this.updateContent(response.responseText);
+      if (Object.isFunction(onComplete)) onComplete(response, json);
+    }).bind(this);
+
+    $super(url, options);
+  },
+
+  updateContent: function(responseText) {
+    var receiver = this.container[this.success() ? 'success' : 'failure'],
+        options = this.options;
+
+    if (!options.evalScripts) responseText = responseText.stripScripts();
+
+    if (receiver = $(receiver)) {
+      if (options.insertion) {
+        if (Object.isString(options.insertion)) {
+          var insertion = { }; insertion[options.insertion] = responseText;
+          receiver.insert(insertion);
+        }
+        else options.insertion(receiver, responseText);
+      }
+      else receiver.update(responseText);
+    }
+  }
+});
+
+Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
+  initialize: function($super, container, url, options) {
+    $super(options);
+    this.onComplete = this.options.onComplete;
+
+    this.frequency = (this.options.frequency || 2);
+    this.decay = (this.options.decay || 1);
+
+    this.updater = { };
+    this.container = container;
+    this.url = url;
+
+    this.start();
+  },
+
+  start: function() {
+    this.options.onComplete = this.updateComplete.bind(this);
+    this.onTimerEvent();
+  },
+
+  stop: function() {
+    this.updater.options.onComplete = undefined;
+    clearTimeout(this.timer);
+    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
+  },
+
+  updateComplete: function(response) {
+    if (this.options.decay) {
+      this.decay = (response.responseText == this.lastText ?
+        this.decay * this.options.decay : 1);
+
+      this.lastText = response.responseText;
+    }
+    this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
+  },
+
+  onTimerEvent: function() {
+    this.updater = new Ajax.Updater(this.container, this.url, this.options);
+  }
+});
+function $(element) {
+  if (arguments.length > 1) {
+    for (var i = 0, elements = [], length = arguments.length; i < length; i++)
+      elements.push($(arguments[i]));
+    return elements;
+  }
+  if (Object.isString(element))
+    element = document.getElementById(element);
+  return Element.extend(element);
+}
+
+if (Prototype.BrowserFeatures.XPath) {
+  document._getElementsByXPath = function(expression, parentElement) {
+    var results = [];
+    var query = document.evaluate(expression, $(parentElement) || document,
+      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+    for (var i = 0, length = query.snapshotLength; i < length; i++)
+      results.push(Element.extend(query.snapshotItem(i)));
+    return results;
+  };
+}
+
+/*--------------------------------------------------------------------------*/
+
+if (!window.Node) var Node = { };
+
+if (!Node.ELEMENT_NODE) {
+  // DOM level 2 ECMAScript Language Binding
+  Object.extend(Node, {
+    ELEMENT_NODE: 1,
+    ATTRIBUTE_NODE: 2,
+    TEXT_NODE: 3,
+    CDATA_SECTION_NODE: 4,
+    ENTITY_REFERENCE_NODE: 5,
+    ENTITY_NODE: 6,
+    PROCESSING_INSTRUCTION_NODE: 7,
+    COMMENT_NODE: 8,
+    DOCUMENT_NODE: 9,
+    DOCUMENT_TYPE_NODE: 10,
+    DOCUMENT_FRAGMENT_NODE: 11,
+    NOTATION_NODE: 12
+  });
+}
+
+(function() {
+  var element = this.Element;
+  this.Element = function(tagName, attributes) {
+    attributes = attributes || { };
+    tagName = tagName.toLowerCase();
+    var cache = Element.cache;
+    if (Prototype.Browser.IE && attributes.name) {
+      tagName = '<' + tagName + ' name="' + attributes.name + '">';
+      delete attributes.name;
+      return Element.writeAttribute(document.createElement(tagName), attributes);
+    }
+    if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
+    return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
+  };
+  Object.extend(this.Element, element || { });
+}).call(window);
+
+Element.cache = { };
+
+Element.Methods = {
+  visible: function(element) {
+    return $(element).style.display != 'none';
+  },
+
+  toggle: function(element) {
+    element = $(element);
+    Element[Element.visible(element) ? 'hide' : 'show'](element);
+    return element;
+  },
+
+  hide: function(element) {
+    $(element).style.display = 'none';
+    return element;
+  },
+
+  show: function(element) {
+    $(element).style.display = '';
+    return element;
+  },
+
+  remove: function(element) {
+    element = $(element);
+    element.parentNode.removeChild(element);
+    return element;
+  },
+
+  update: function(element, content) {
+    element = $(element);
+    if (content && content.toElement) content = content.toElement();
+    if (Object.isElement(content)) return element.update().insert(content);
+    content = Object.toHTML(content);
+    element.innerHTML = content.stripScripts();
+    content.evalScripts.bind(content).defer();
+    return element;
+  },
+
+  replace: function(element, content) {
+    element = $(element);
+    if (content && content.toElement) content = content.toElement();
+    else if (!Object.isElement(content)) {
+      content = Object.toHTML(content);
+      var range = element.ownerDocument.createRange();
+      range.selectNode(element);
+      content.evalScripts.bind(content).defer();
+      content = range.createContextualFragment(content.stripScripts());
+    }
+    element.parentNode.replaceChild(content, element);
+    return element;
+  },
+
+  insert: function(element, insertions) {
+    element = $(element);
+
+    if (Object.isString(insertions) || Object.isNumber(insertions) ||
+        Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
+          insertions = {bottom:insertions};
+
+    var content, insert, tagName, childNodes;
+
+    for (var position in insertions) {
+      content  = insertions[position];
+      position = position.toLowerCase();
+      insert = Element._insertionTranslations[position];
+
+      if (content && content.toElement) content = content.toElement();
+      if (Object.isElement(content)) {
+        insert(element, content);
+        continue;
+      }
+
+      content = Object.toHTML(content);
+
+      tagName = ((position == 'before' || position == 'after')
+        ? element.parentNode : element).tagName.toUpperCase();
+
+      childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
+
+      if (position == 'top' || position == 'after') childNodes.reverse();
+      childNodes.each(insert.curry(element));
+
+      content.evalScripts.bind(content).defer();
+    }
+
+    return element;
+  },
+
+  wrap: function(element, wrapper, attributes) {
+    element = $(element);
+    if (Object.isElement(wrapper))
+      $(wrapper).writeAttribute(attributes || { });
+    else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
+    else wrapper = new Element('div', wrapper);
+    if (element.parentNode)
+      element.parentNode.replaceChild(wrapper, element);
+    wrapper.appendChild(element);
+    return wrapper;
+  },
+
+  inspect: function(element) {
+    element = $(element);
+    var result = '<' + element.tagName.toLowerCase();
+    $H({'id': 'id', 'className': 'class'}).each(function(pair) {
+      var property = pair.first(), attribute = pair.last();
+      var value = (element[property] || '').toString();
+      if (value) result += ' ' + attribute + '=' + value.inspect(true);
+    });
+    return result + '>';
+  },
+
+  recursivelyCollect: function(element, property) {
+    element = $(element);
+    var elements = [];
+    while (element = element[property])
+      if (element.nodeType == 1)
+        elements.push(Element.extend(element));
+    return elements;
+  },
+
+  ancestors: function(element) {
+    return $(element).recursivelyCollect('parentNode');
+  },
+
+  descendants: function(element) {
+    return $(element).select("*");
+  },
+
+  firstDescendant: function(element) {
+    element = $(element).firstChild;
+    while (element && element.nodeType != 1) element = element.nextSibling;
+    return $(element);
+  },
+
+  immediateDescendants: function(element) {
+    if (!(element = $(element).firstChild)) return [];
+    while (element && element.nodeType != 1) element = element.nextSibling;
+    if (element) return [element].concat($(element).nextSiblings());
+    return [];
+  },
+
+  previousSiblings: function(element) {
+    return $(element).recursivelyCollect('previousSibling');
+  },
+
+  nextSiblings: function(element) {
+    return $(element).recursivelyCollect('nextSibling');
+  },
+
+  siblings: function(element) {
+    element = $(element);
+    return element.previousSiblings().reverse().concat(element.nextSiblings());
+  },
+
+  match: function(element, selector) {
+    if (Object.isString(selector))
+      selector = new Selector(selector);
+    return selector.match($(element));
+  },
+
+  up: function(element, expression, index) {
+    element = $(element);
+    if (arguments.length == 1) return $(element.parentNode);
+    var ancestors = element.ancestors();
+    return Object.isNumber(expression) ? ancestors[expression] :
+      Selector.findElement(ancestors, expression, index);
+  },
+
+  down: function(element, expression, index) {
+    element = $(element);
+    if (arguments.length == 1) return element.firstDescendant();
+    return Object.isNumber(expression) ? element.descendants()[expression] :
+      element.select(expression)[index || 0];
+  },
+
+  previous: function(element, expression, index) {
+    element = $(element);
+    if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
+    var previousSiblings = element.previousSiblings();
+    return Object.isNumber(expression) ? previousSiblings[expression] :
+      Selector.findElement(previousSiblings, expression, index);
+  },
+
+  next: function(element, expression, index) {
+    element = $(element);
+    if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
+    var nextSiblings = element.nextSiblings();
+    return Object.isNumber(expression) ? nextSiblings[expression] :
+      Selector.findElement(nextSiblings, expression, index);
+  },
+
+  select: function() {
+    var args = $A(arguments), element = $(args.shift());
+    return Selector.findChildElements(element, args);
+  },
+
+  adjacent: function() {
+    var args = $A(arguments), element = $(args.shift());
+    return Selector.findChildElements(element.parentNode, args).without(element);
+  },
+
+  identify: function(element) {
+    element = $(element);
+    var id = element.readAttribute('id'), self = arguments.callee;
+    if (id) return id;
+    do { id = 'anonymous_element_' + self.counter++ } while ($(id));
+    element.writeAttribute('id', id);
+    return id;
+  },
+
+  readAttribute: function(element, name) {
+    element = $(element);
+    if (Prototype.Browser.IE) {
+      var t = Element._attributeTranslations.read;
+      if (t.values[name]) return t.values[name](element, name);
+      if (t.names[name]) name = t.names[name];
+      if (name.include(':')) {
+        return (!element.attributes || !element.attributes[name]) ? null :
+         element.attributes[name].value;
+      }
+    }
+    return element.getAttribute(name);
+  },
+
+  writeAttribute: function(element, name, value) {
+    element = $(element);
+    var attributes = { }, t = Element._attributeTranslations.write;
+
+    if (typeof name == 'object') attributes = name;
+    else attributes[name] = Object.isUndefined(value) ? true : value;
+
+    for (var attr in attributes) {
+      name = t.names[attr] || attr;
+      value = attributes[attr];
+      if (t.values[attr]) name = t.values[attr](element, value);
+      if (value === false || value === null)
+        element.removeAttribute(name);
+      else if (value === true)
+        element.setAttribute(name, name);
+      else element.setAttribute(name, value);
+    }
+    return element;
+  },
+
+  getHeight: function(element) {
+    return $(element).getDimensions().height;
+  },
+
+  getWidth: function(element) {
+    return $(element).getDimensions().width;
+  },
+
+  classNames: function(element) {
+    return new Element.ClassNames(element);
+  },
+
+  hasClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    var elementClassName = element.className;
+    return (elementClassName.length > 0 && (elementClassName == className ||
+      new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
+  },
+
+  addClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    if (!element.hasClassName(className))
+      element.className += (element.className ? ' ' : '') + className;
+    return element;
+  },
+
+  removeClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    element.className = element.className.replace(
+      new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
+    return element;
+  },
+
+  toggleClassName: function(element, className) {
+    if (!(element = $(element))) return;
+    return element[element.hasClassName(className) ?
+      'removeClassName' : 'addClassName'](className);
+  },
+
+  // removes whitespace-only text node children
+  cleanWhitespace: function(element) {
+    element = $(element);
+    var node = element.firstChild;
+    while (node) {
+      var nextNode = node.nextSibling;
+      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
+        element.removeChild(node);
+      node = nextNode;
+    }
+    return element;
+  },
+
+  empty: function(element) {
+    return $(element).innerHTML.blank();
+  },
+
+  descendantOf: function(element, ancestor) {
+    element = $(element), ancestor = $(ancestor);
+    var originalAncestor = ancestor;
+
+    if (element.compareDocumentPosition)
+      return (element.compareDocumentPosition(ancestor) & 8) === 8;
+
+    if (element.sourceIndex && !Prototype.Browser.Opera) {
+      var e = element.sourceIndex, a = ancestor.sourceIndex,
+       nextAncestor = ancestor.nextSibling;
+      if (!nextAncestor) {
+        do { ancestor = ancestor.parentNode; }
+        while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode);
+      }
+      if (nextAncestor && nextAncestor.sourceIndex)
+       return (e > a && e < nextAncestor.sourceIndex);
+    }
+
+    while (element = element.parentNode)
+      if (element == originalAncestor) return true;
+    return false;
+  },
+
+  scrollTo: function(element) {
+    element = $(element);
+    var pos = element.cumulativeOffset();
+    window.scrollTo(pos[0], pos[1]);
+    return element;
+  },
+
+  getStyle: function(element, style) {
+    element = $(element);
+    style = style == 'float' ? 'cssFloat' : style.camelize();
+    var value = element.style[style];
+    if (!value) {
+      var css = document.defaultView.getComputedStyle(element, null);
+      value = css ? css[style] : null;
+    }
+    if (style == 'opacity') return value ? parseFloat(value) : 1.0;
+    return value == 'auto' ? null : value;
+  },
+
+  getOpacity: function(element) {
+    return $(element).getStyle('opacity');
+  },
+
+  setStyle: function(element, styles) {
+    element = $(element);
+    var elementStyle = element.style, match;
+    if (Object.isString(styles)) {
+      element.style.cssText += ';' + styles;
+      return styles.include('opacity') ?
+        element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
+    }
+    for (var property in styles)
+      if (property == 'opacity') element.setOpacity(styles[property]);
+      else
+        elementStyle[(property == 'float' || property == 'cssFloat') ?
+          (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
+            property] = styles[property];
+
+    return element;
+  },
+
+  setOpacity: function(element, value) {
+    element = $(element);
+    element.style.opacity = (value == 1 || value === '') ? '' :
+      (value < 0.00001) ? 0 : value;
+    return element;
+  },
+
+  getDimensions: function(element) {
+    element = $(element);
+    var display = $(element).getStyle('display');
+    if (display != 'none' && display != null) // Safari bug
+      return {width: element.offsetWidth, height: element.offsetHeight};
+
+    // All *Width and *Height properties give 0 on elements with display none,
+    // so enable the element temporarily
+    var els = element.style;
+    var originalVisibility = els.visibility;
+    var originalPosition = els.position;
+    var originalDisplay = els.display;
+    els.visibility = 'hidden';
+    els.position = 'absolute';
+    els.display = 'block';
+    var originalWidth = element.clientWidth;
+    var originalHeight = element.clientHeight;
+    els.display = originalDisplay;
+    els.position = originalPosition;
+    els.visibility = originalVisibility;
+    return {width: originalWidth, height: originalHeight};
+  },
+
+  makePositioned: function(element) {
+    element = $(element);
+    var pos = Element.getStyle(element, 'position');
+    if (pos == 'static' || !pos) {
+      element._madePositioned = true;
+      element.style.position = 'relative';
+      // Opera returns the offset relative to the positioning context, when an
+      // element is position relative but top and left have not been defined
+      if (window.opera) {
+        element.style.top = 0;
+        element.style.left = 0;
+      }
+    }
+    return element;
+  },
+
+  undoPositioned: function(element) {
+    element = $(element);
+    if (element._madePositioned) {
+      element._madePositioned = undefined;
+      element.style.position =
+        element.style.top =
+        element.style.left =
+        element.style.bottom =
+        element.style.right = '';
+    }
+    return element;
+  },
+
+  makeClipping: function(element) {
+    element = $(element);
+    if (element._overflow) return element;
+    element._overflow = Element.getStyle(element, 'overflow') || 'auto';
+    if (element._overflow !== 'hidden')
+      element.style.overflow = 'hidden';
+    return element;
+  },
+
+  undoClipping: function(element) {
+    element = $(element);
+    if (!element._overflow) return element;
+    element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
+    element._overflow = null;
+    return element;
+  },
+
+  cumulativeOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      element = element.offsetParent;
+    } while (element);
+    return Element._returnOffset(valueL, valueT);
+  },
+
+  positionedOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      element = element.offsetParent;
+      if (element) {
+        if (element.tagName == 'BODY') break;
+        var p = Element.getStyle(element, 'position');
+        if (p !== 'static') break;
+      }
+    } while (element);
+    return Element._returnOffset(valueL, valueT);
+  },
+
+  absolutize: function(element) {
+    element = $(element);
+    if (element.getStyle('position') == 'absolute') return;
+    // Position.prepare(); // To be done manually by Scripty when it needs it.
+
+    var offsets = element.positionedOffset();
+    var top     = offsets[1];
+    var left    = offsets[0];
+    var width   = element.clientWidth;
+    var height  = element.clientHeight;
+
+    element._originalLeft   = left - parseFloat(element.style.left  || 0);
+    element._originalTop    = top  - parseFloat(element.style.top || 0);
+    element._originalWidth  = element.style.width;
+    element._originalHeight = element.style.height;
+
+    element.style.position = 'absolute';
+    element.style.top    = top + 'px';
+    element.style.left   = left + 'px';
+    element.style.width  = width + 'px';
+    element.style.height = height + 'px';
+    return element;
+  },
+
+  relativize: function(element) {
+    element = $(element);
+    if (element.getStyle('position') == 'relative') return;
+    // Position.prepare(); // To be done manually by Scripty when it needs it.
+
+    element.style.position = 'relative';
+    var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
+    var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
+
+    element.style.top    = top + 'px';
+    element.style.left   = left + 'px';
+    element.style.height = element._originalHeight;
+    element.style.width  = element._originalWidth;
+    return element;
+  },
+
+  cumulativeScrollOffset: function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.scrollTop  || 0;
+      valueL += element.scrollLeft || 0;
+      element = element.parentNode;
+    } while (element);
+    return Element._returnOffset(valueL, valueT);
+  },
+
+  getOffsetParent: function(element) {
+    if (element.offsetParent) return $(element.offsetParent);
+    if (element == document.body) return $(element);
+
+    while ((element = element.parentNode) && element != document.body)
+      if (Element.getStyle(element, 'position') != 'static')
+        return $(element);
+
+    return $(document.body);
+  },
+
+  viewportOffset: function(forElement) {
+    var valueT = 0, valueL = 0;
+
+    var element = forElement;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+
+      // Safari fix
+      if (element.offsetParent == document.body &&
+        Element.getStyle(element, 'position') == 'absolute') break;
+
+    } while (element = element.offsetParent);
+
+    element = forElement;
+    do {
+      if (!Prototype.Browser.Opera || element.tagName == 'BODY') {
+        valueT -= element.scrollTop  || 0;
+        valueL -= element.scrollLeft || 0;
+      }
+    } while (element = element.parentNode);
+
+    return Element._returnOffset(valueL, valueT);
+  },
+
+  clonePosition: function(element, source) {
+    var options = Object.extend({
+      setLeft:    true,
+      setTop:     true,
+      setWidth:   true,
+      setHeight:  true,
+      offsetTop:  0,
+      offsetLeft: 0
+    }, arguments[2] || { });
+
+    // find page position of source
+    source = $(source);
+    var p = source.viewportOffset();
+
+    // find coordinate system to use
+    element = $(element);
+    var delta = [0, 0];
+    var parent = null;
+    // delta [0,0] will do fine with position: fixed elements,
+    // position:absolute needs offsetParent deltas
+    if (Element.getStyle(element, 'position') == 'absolute') {
+      parent = element.getOffsetParent();
+      delta = parent.viewportOffset();
+    }
+
+    // correct by body offsets (fixes Safari)
+    if (parent == document.body) {
+      delta[0] -= document.body.offsetLeft;
+      delta[1] -= document.body.offsetTop;
+    }
+
+    // set position
+    if (options.setLeft)   element.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
+    if (options.setTop)    element.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
+    if (options.setWidth)  element.style.width = source.offsetWidth + 'px';
+    if (options.setHeight) element.style.height = source.offsetHeight + 'px';
+    return element;
+  }
+};
+
+Element.Methods.identify.counter = 1;
+
+Object.extend(Element.Methods, {
+  getElementsBySelector: Element.Methods.select,
+  childElements: Element.Methods.immediateDescendants
+});
+
+Element._attributeTranslations = {
+  write: {
+    names: {
+      className: 'class',
+      htmlFor:   'for'
+    },
+    values: { }
+  }
+};
+
+if (Prototype.Browser.Opera) {
+  Element.Methods.getStyle = Element.Methods.getStyle.wrap(
+    function(proceed, element, style) {
+      switch (style) {
+        case 'left': case 'top': case 'right': case 'bottom':
+          if (proceed(element, 'position') === 'static') return null;
+        case 'height': case 'width':
+          // returns '0px' for hidden elements; we want it to return null
+          if (!Element.visible(element)) return null;
+
+          // returns the border-box dimensions rather than the content-box
+          // dimensions, so we subtract padding and borders from the value
+          var dim = parseInt(proceed(element, style), 10);
+
+          if (dim !== element['offset' + style.capitalize()])
+            return dim + 'px';
+
+          var properties;
+          if (style === 'height') {
+            properties = ['border-top-width', 'padding-top',
+             'padding-bottom', 'border-bottom-width'];
+          }
+          else {
+            properties = ['border-left-width', 'padding-left',
+             'padding-right', 'border-right-width'];
+          }
+          return properties.inject(dim, function(memo, property) {
+            var val = proceed(element, property);
+            return val === null ? memo : memo - parseInt(val, 10);
+          }) + 'px';
+        default: return proceed(element, style);
+      }
+    }
+  );
+
+  Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
+    function(proceed, element, attribute) {
+      if (attribute === 'title') return element.title;
+      return proceed(element, attribute);
+    }
+  );
+}
+
+else if (Prototype.Browser.IE) {
+  // IE doesn't report offsets correctly for static elements, so we change them
+  // to "relative" to get the values, then change them back.
+  Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
+    function(proceed, element) {
+      element = $(element);
+      var position = element.getStyle('position');
+      if (position !== 'static') return proceed(element);
+      element.setStyle({ position: 'relative' });
+      var value = proceed(element);
+      element.setStyle({ position: position });
+      return value;
+    }
+  );
+
+  $w('positionedOffset viewportOffset').each(function(method) {
+    Element.Methods[method] = Element.Methods[method].wrap(
+      function(proceed, element) {
+        element = $(element);
+        var position = element.getStyle('position');
+        if (position !== 'static') return proceed(element);
+        // Trigger hasLayout on the offset parent so that IE6 reports
+        // accurate offsetTop and offsetLeft values for position: fixed.
+        var offsetParent = element.getOffsetParent();
+        if (offsetParent && offsetParent.getStyle('position') === 'fixed')
+          offsetParent.setStyle({ zoom: 1 });
+        element.setStyle({ position: 'relative' });
+        var value = proceed(element);
+        element.setStyle({ position: position });
+        return value;
+      }
+    );
+  });
+
+  Element.Methods.getStyle = function(element, style) {
+    element = $(element);
+    style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
+    var value = element.style[style];
+    if (!value && element.currentStyle) value = element.currentStyle[style];
+
+    if (style == 'opacity') {
+      if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
+        if (value[1]) return parseFloat(value[1]) / 100;
+      return 1.0;
+    }
+
+    if (value == 'auto') {
+      if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
+        return element['offset' + style.capitalize()] + 'px';
+      return null;
+    }
+    return value;
+  };
+
+  Element.Methods.setOpacity = function(element, value) {
+    function stripAlpha(filter){
+      return filter.replace(/alpha\([^\)]*\)/gi,'');
+    }
+    element = $(element);
+    var currentStyle = element.currentStyle;
+    if ((currentStyle && !currentStyle.hasLayout) ||
+      (!currentStyle && element.style.zoom == 'normal'))
+        element.style.zoom = 1;
+
+    var filter = element.getStyle('filter'), style = element.style;
+    if (value == 1 || value === '') {
+      (filter = stripAlpha(filter)) ?
+        style.filter = filter : style.removeAttribute('filter');
+      return element;
+    } else if (value < 0.00001) value = 0;
+    style.filter = stripAlpha(filter) +
+      'alpha(opacity=' + (value * 100) + ')';
+    return element;
+  };
+
+  Element._attributeTranslations = {
+    read: {
+      names: {
+        'class': 'className',
+        'for':   'htmlFor'
+      },
+      values: {
+        _getAttr: function(element, attribute) {
+          return element.getAttribute(attribute, 2);
+        },
+        _getAttrNode: function(element, attribute) {
+          var node = element.getAttributeNode(attribute);
+          return node ? node.value : "";
+        },
+        _getEv: function(element, attribute) {
+          attribute = element.getAttribute(attribute);
+          return attribute ? attribute.toString().slice(23, -2) : null;
+        },
+        _flag: function(element, attribute) {
+          return $(element).hasAttribute(attribute) ? attribute : null;
+        },
+        style: function(element) {
+          return element.style.cssText.toLowerCase();
+        },
+        title: function(element) {
+          return element.title;
+        }
+      }
+    }
+  };
+
+  Element._attributeTranslations.write = {
+    names: Object.extend({
+      cellpadding: 'cellPadding',
+      cellspacing: 'cellSpacing'
+    }, Element._attributeTranslations.read.names),
+    values: {
+      checked: function(element, value) {
+        element.checked = !!value;
+      },
+
+      style: function(element, value) {
+        element.style.cssText = value ? value : '';
+      }
+    }
+  };
+
+  Element._attributeTranslations.has = {};
+
+  $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
+      'encType maxLength readOnly longDesc').each(function(attr) {
+    Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
+    Element._attributeTranslations.has[attr.toLowerCase()] = attr;
+  });
+
+  (function(v) {
+    Object.extend(v, {
+      href:        v._getAttr,
+      src:         v._getAttr,
+      type:        v._getAttr,
+      action:      v._getAttrNode,
+      disabled:    v._flag,
+      checked:     v._flag,
+      readonly:    v._flag,
+      multiple:    v._flag,
+      onload:      v._getEv,
+      onunload:    v._getEv,
+      onclick:     v._getEv,
+      ondblclick:  v._getEv,
+      onmousedown: v._getEv,
+      onmouseup:   v._getEv,
+      onmouseover: v._getEv,
+      onmousemove: v._getEv,
+      onmouseout:  v._getEv,
+      onfocus:     v._getEv,
+      onblur:      v._getEv,
+      onkeypress:  v._getEv,
+      onkeydown:   v._getEv,
+      onkeyup:     v._getEv,
+      onsubmit:    v._getEv,
+      onreset:     v._getEv,
+      onselect:    v._getEv,
+      onchange:    v._getEv
+    });
+  })(Element._attributeTranslations.read.values);
+}
+
+else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
+  Element.Methods.setOpacity = function(element, value) {
+    element = $(element);
+    element.style.opacity = (value == 1) ? 0.999999 :
+      (value === '') ? '' : (value < 0.00001) ? 0 : value;
+    return element;
+  };
+}
+
+else if (Prototype.Browser.WebKit) {
+  Element.Methods.setOpacity = function(element, value) {
+    element = $(element);
+    element.style.opacity = (value == 1 || value === '') ? '' :
+      (value < 0.00001) ? 0 : value;
+
+    if (value == 1)
+      if(element.tagName == 'IMG' && element.width) {
+        element.width++; element.width--;
+      } else try {
+        var n = document.createTextNode(' ');
+        element.appendChild(n);
+        element.removeChild(n);
+      } catch (e) { }
+
+    return element;
+  };
+
+  // Safari returns margins on body which is incorrect if the child is absolutely
+  // positioned.  For performance reasons, redefine Element#cumulativeOffset for
+  // KHTML/WebKit only.
+  Element.Methods.cumulativeOffset = function(element) {
+    var valueT = 0, valueL = 0;
+    do {
+      valueT += element.offsetTop  || 0;
+      valueL += element.offsetLeft || 0;
+      if (element.offsetParent == document.body)
+        if (Element.getStyle(element, 'position') == 'absolute') break;
+
+      element = element.offsetParent;
+    } while (element);
+
+    return Element._returnOffset(valueL, valueT);
+  };
+}
+
+if (Prototype.Browser.IE || Prototype.Browser.Opera) {
+  // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
+  Element.Methods.update = function(element, content) {
+    element = $(element);
+
+    if (content && content.toElement) content = content.toElement();
+    if (Object.isElement(content)) return element.update().insert(content);
+
+    content = Object.toHTML(content);
+    var tagName = element.tagName.toUpperCase();
+
+    if (tagName in Element._insertionTranslations.tags) {
+      $A(element.childNodes).each(function(node) { element.removeChild(node) });
+      Element._getContentFromAnonymousElement(tagName, content.stripScripts())
+        .each(function(node) { element.appendChild(node) });
+    }
+    else element.innerHTML = content.stripScripts();
+
+    content.evalScripts.bind(content).defer();
+    return element;
+  };
+}
+
+if ('outerHTML' in document.createElement('div')) {
+  Element.Methods.replace = function(element, content) {
+    element = $(element);
+
+    if (content && content.toElement) content = content.toElement();
+    if (Object.isElement(content)) {
+      element.parentNode.replaceChild(content, element);
+      return element;
+    }
+
+    content = Object.toHTML(content);
+    var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
+
+    if (Element._insertionTranslations.tags[tagName]) {
+      var nextSibling = element.next();
+      var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
+      parent.removeChild(element);
+      if (nextSibling)
+        fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
+      else
+        fragments.each(function(node) { parent.appendChild(node) });
+    }
+    else element.outerHTML = content.stripScripts();
+
+    content.evalScripts.bind(content).defer();
+    return element;
+  };
+}
+
+Element._returnOffset = function(l, t) {
+  var result = [l, t];
+  result.left = l;
+  result.top = t;
+  return result;
+};
+
+Element._getContentFromAnonymousElement = function(tagName, html) {
+  var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
+  if (t) {
+    div.innerHTML = t[0] + html + t[1];
+    t[2].times(function() { div = div.firstChild });
+  } else div.innerHTML = html;
+  return $A(div.childNodes);
+};
+
+Element._insertionTranslations = {
+  before: function(element, node) {
+    element.parentNode.insertBefore(node, element);
+  },
+  top: function(element, node) {
+    element.insertBefore(node, element.firstChild);
+  },
+  bottom: function(element, node) {
+    element.appendChild(node);
+  },
+  after: function(element, node) {
+    element.parentNode.insertBefore(node, element.nextSibling);
+  },
+  tags: {
+    TABLE:  ['<table>',                '</table>',                   1],
+    TBODY:  ['<table><tbody>',         '</tbody></table>',           2],
+    TR:     ['<table><tbody><tr>',     '</tr></tbody></table>',      3],
+    TD:     ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
+    SELECT: ['<select>',               '</select>',                  1]
+  }
+};
+
+(function() {
+  Object.extend(this.tags, {
+    THEAD: this.tags.TBODY,
+    TFOOT: this.tags.TBODY,
+    TH:    this.tags.TD
+  });
+}).call(Element._insertionTranslations);
+
+Element.Methods.Simulated = {
+  hasAttribute: function(element, attribute) {
+    attribute = Element._attributeTranslations.has[attribute] || attribute;
+    var node = $(element).getAttributeNode(attribute);
+    return node && node.specified;
+  }
+};
+
+Element.Methods.ByTag = { };
+
+Object.extend(Element, Element.Methods);
+
+if (!Prototype.BrowserFeatures.ElementExtensions &&
+    document.createElement('div').__proto__) {
+  window.HTMLElement = { };
+  window.HTMLElement.prototype = document.createElement('div').__proto__;
+  Prototype.BrowserFeatures.ElementExtensions = true;
+}
+
+Element.extend = (function() {
+  if (Prototype.BrowserFeatures.SpecificElementExtensions)
+    return Prototype.K;
+
+  var Methods = { }, ByTag = Element.Methods.ByTag;
+
+  var extend = Object.extend(function(element) {
+    if (!element || element._extendedByPrototype ||
+        element.nodeType != 1 || element == window) return element;
+
+    var methods = Object.clone(Methods),
+      tagName = element.tagName, property, value;
+
+    // extend methods for specific tags
+    if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
+
+    for (property in methods) {
+      value = methods[property];
+      if (Object.isFunction(value) && !(property in element))
+        element[property] = value.methodize();
+    }
+
+    element._extendedByPrototype = Prototype.emptyFunction;
+    return element;
+
+  }, {
+    refresh: function() {
+      // extend methods for all tags (Safari doesn't need this)
+      if (!Prototype.BrowserFeatures.ElementExtensions) {
+        Object.extend(Methods, Element.Methods);
+        Object.extend(Methods, Element.Methods.Simulated);
+      }
+    }
+  });
+
+  extend.refresh();
+  return extend;
+})();
+
+Element.hasAttribute = function(element, attribute) {
+  if (element.hasAttribute) return element.hasAttribute(attribute);
+  return Element.Methods.Simulated.hasAttribute(element, attribute);
+};
+
+Element.addMethods = function(methods) {
+  var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
+
+  if (!methods) {
+    Object.extend(Form, Form.Methods);
+    Object.extend(Form.Element, Form.Element.Methods);
+    Object.extend(Element.Methods.ByTag, {
+      "FORM":     Object.clone(Form.Methods),
+      "INPUT":    Object.clone(Form.Element.Methods),
+      "SELECT":   Object.clone(Form.Element.Methods),
+      "TEXTAREA": Object.clone(Form.Element.Methods)
+    });
+  }
+
+  if (arguments.length == 2) {
+    var tagName = methods;
+    methods = arguments[1];
+  }
+
+  if (!tagName) Object.extend(Element.Methods, methods || { });
+  else {
+    if (Object.isArray(tagName)) tagName.each(extend);
+    else extend(tagName);
+  }
+
+  function extend(tagName) {
+    tagName = tagName.toUpperCase();
+    if (!Element.Methods.ByTag[tagName])
+      Element.Methods.ByTag[tagName] = { };
+    Object.extend(Element.Methods.ByTag[tagName], methods);
+  }
+
+  function copy(methods, destination, onlyIfAbsent) {
+    onlyIfAbsent = onlyIfAbsent || false;
+    for (var property in methods) {
+      var value = methods[property];
+      if (!Object.isFunction(value)) continue;
+      if (!onlyIfAbsent || !(property in destination))
+        destination[property] = value.methodize();
+    }
+  }
+
+  function findDOMClass(tagName) {
+    var klass;
+    var trans = {
+      "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
+      "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
+      "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
+      "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
+      "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
+      "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
+      "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
+      "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
+      "FrameSet", "IFRAME": "IFrame"
+    };
+    if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
+    if (window[klass]) return window[klass];
+    klass = 'HTML' + tagName + 'Element';
+    if (window[klass]) return window[klass];
+    klass = 'HTML' + tagName.capitalize() + 'Element';
+    if (window[klass]) return window[klass];
+
+    window[klass] = { };
+    window[klass].prototype = document.createElement(tagName).__proto__;
+    return window[klass];
+  }
+
+  if (F.ElementExtensions) {
+    copy(Element.Methods, HTMLElement.prototype);
+    copy(Element.Methods.Simulated, HTMLElement.prototype, true);
+  }
+
+  if (F.SpecificElementExtensions) {
+    for (var tag in Element.Methods.ByTag) {
+      var klass = findDOMClass(tag);
+      if (Object.isUndefined(klass)) continue;
+      copy(T[tag], klass.prototype);
+    }
+  }
+
+  Object.extend(Element, Element.Methods);
+  delete Element.ByTag;
+
+  if (Element.extend.refresh) Element.extend.refresh();
+  Element.cache = { };
+};
+
+document.viewport = {
+  getDimensions: function() {
+    var dimensions = { };
+    var B = Prototype.Browser;
+    $w('width height').each(function(d) {
+      var D = d.capitalize();
+      dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] :
+        (B.Opera) ? document.body['client' + D] : document.documentElement['client' + D];
+    });
+    return dimensions;
+  },
+
+  getWidth: function() {
+    return this.getDimensions().width;
+  },
+
+  getHeight: function() {
+    return this.getDimensions().height;
+  },
+
+  getScrollOffsets: function() {
+    return Element._returnOffset(
+      window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
+      window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
+  }
+};
+/* Portions of the Selector class are derived from Jack Slocum’s DomQuery,
+ * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
+ * license.  Please see http://www.yui-ext.com/ for more information. */
+
+var Selector = Class.create({
+  initialize: function(expression) {
+    this.expression = expression.strip();
+    this.compileMatcher();
+  },
+
+  shouldUseXPath: function() {
+    if (!Prototype.BrowserFeatures.XPath) return false;
+
+    var e = this.expression;
+
+    // Safari 3 chokes on :*-of-type and :empty
+    if (Prototype.Browser.WebKit &&
+     (e.include("-of-type") || e.include(":empty")))
+      return false;
+
+    // XPath can't do namespaced attributes, nor can it read
+    // the "checked" property from DOM nodes
+    if ((/(\[[\w-]*?:|:checked)/).test(this.expression))
+      return false;
+
+    return true;
+  },
+
+  compileMatcher: function() {
+    if (this.shouldUseXPath())
+      return this.compileXPathMatcher();
+
+    var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
+        c = Selector.criteria, le, p, m;
+
+    if (Selector._cache[e]) {
+      this.matcher = Selector._cache[e];
+      return;
+    }
+
+    this.matcher = ["this.matcher = function(root) {",
+                    "var r = root, h = Selector.handlers, c = false, n;"];
+
+    while (e && le != e && (/\S/).test(e)) {
+      le = e;
+      for (var i in ps) {
+        p = ps[i];
+        if (m = e.match(p)) {
+          this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
+    	      new Template(c[i]).evaluate(m));
+          e = e.replace(m[0], '');
+          break;
+        }
+      }
+    }
+
+    this.matcher.push("return h.unique(n);\n}");
+    eval(this.matcher.join('\n'));
+    Selector._cache[this.expression] = this.matcher;
+  },
+
+  compileXPathMatcher: function() {
+    var e = this.expression, ps = Selector.patterns,
+        x = Selector.xpath, le, m;
+
+    if (Selector._cache[e]) {
+      this.xpath = Selector._cache[e]; return;
+    }
+
+    this.matcher = ['.//*'];
+    while (e && le != e && (/\S/).test(e)) {
+      le = e;
+      for (var i in ps) {
+        if (m = e.match(ps[i])) {
+          this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
+            new Template(x[i]).evaluate(m));
+          e = e.replace(m[0], '');
+          break;
+        }
+      }
+    }
+
+    this.xpath = this.matcher.join('');
+    Selector._cache[this.expression] = this.xpath;
+  },
+
+  findElements: function(root) {
+    root = root || document;
+    if (this.xpath) return document._getElementsByXPath(this.xpath, root);
+    return this.matcher(root);
+  },
+
+  match: function(element) {
+    this.tokens = [];
+
+    var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
+    var le, p, m;
+
+    while (e && le !== e && (/\S/).test(e)) {
+      le = e;
+      for (var i in ps) {
+        p = ps[i];
+        if (m = e.match(p)) {
+          // use the Selector.assertions methods unless the selector
+          // is too complex.
+          if (as[i]) {
+            this.tokens.push([i, Object.clone(m)]);
+            e = e.replace(m[0], '');
+          } else {
+            // reluctantly do a document-wide search
+            // and look for a match in the array
+            return this.findElements(document).include(element);
+          }
+        }
+      }
+    }
+
+    var match = true, name, matches;
+    for (var i = 0, token; token = this.tokens[i]; i++) {
+      name = token[0], matches = token[1];
+      if (!Selector.assertions[name](element, matches)) {
+        match = false; break;
+      }
+    }
+
+    return match;
+  },
+
+  toString: function() {
+    return this.expression;
+  },
+
+  inspect: function() {
+    return "#<Selector:" + this.expression.inspect() + ">";
+  }
+});
+
+Object.extend(Selector, {
+  _cache: { },
+
+  xpath: {
+    descendant:   "//*",
+    child:        "/*",
+    adjacent:     "/following-sibling::*[1]",
+    laterSibling: '/following-sibling::*',
+    tagName:      function(m) {
+      if (m[1] == '*') return '';
+      return "[local-name()='" + m[1].toLowerCase() +
+             "' or local-name()='" + m[1].toUpperCase() + "']";
+    },
+    className:    "[contains(concat(' ', @class, ' '), ' #{1} ')]",
+    id:           "[@id='#{1}']",
+    attrPresence: function(m) {
+      m[1] = m[1].toLowerCase();
+      return new Template("[@#{1}]").evaluate(m);
+    },
+    attr: function(m) {
+      m[1] = m[1].toLowerCase();
+      m[3] = m[5] || m[6];
+      return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
+    },
+    pseudo: function(m) {
+      var h = Selector.xpath.pseudos[m[1]];
+      if (!h) return '';
+      if (Object.isFunction(h)) return h(m);
+      return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
+    },
+    operators: {
+      '=':  "[@#{1}='#{3}']",
+      '!=': "[@#{1}!='#{3}']",
+      '^=': "[starts-with(@#{1}, '#{3}')]",
+      '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
+      '*=': "[contains(@#{1}, '#{3}')]",
+      '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
+      '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
+    },
+    pseudos: {
+      'first-child': '[not(preceding-sibling::*)]',
+      'last-child':  '[not(following-sibling::*)]',
+      'only-child':  '[not(preceding-sibling::* or following-sibling::*)]',
+      'empty':       "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",
+      'checked':     "[@checked]",
+      'disabled':    "[@disabled]",
+      'enabled':     "[not(@disabled)]",
+      'not': function(m) {
+        var e = m[6], p = Selector.patterns,
+            x = Selector.xpath, le, v;
+
+        var exclusion = [];
+        while (e && le != e && (/\S/).test(e)) {
+          le = e;
+          for (var i in p) {
+            if (m = e.match(p[i])) {
+              v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
+              exclusion.push("(" + v.substring(1, v.length - 1) + ")");
+              e = e.replace(m[0], '');
+              break;
+            }
+          }
+        }
+        return "[not(" + exclusion.join(" and ") + ")]";
+      },
+      'nth-child':      function(m) {
+        return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
+      },
+      'nth-last-child': function(m) {
+        return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
+      },
+      'nth-of-type':    function(m) {
+        return Selector.xpath.pseudos.nth("position() ", m);
+      },
+      'nth-last-of-type': function(m) {
+        return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
+      },
+      'first-of-type':  function(m) {
+        m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
+      },
+      'last-of-type':   function(m) {
+        m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
+      },
+      'only-of-type':   function(m) {
+        var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
+      },
+      nth: function(fragment, m) {
+        var mm, formula = m[6], predicate;
+        if (formula == 'even') formula = '2n+0';
+        if (formula == 'odd')  formula = '2n+1';
+        if (mm = formula.match(/^(\d+)$/)) // digit only
+          return '[' + fragment + "= " + mm[1] + ']';
+        if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
+          if (mm[1] == "-") mm[1] = -1;
+          var a = mm[1] ? Number(mm[1]) : 1;
+          var b = mm[2] ? Number(mm[2]) : 0;
+          predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
+          "((#{fragment} - #{b}) div #{a} >= 0)]";
+          return new Template(predicate).evaluate({
+            fragment: fragment, a: a, b: b });
+        }
+      }
+    }
+  },
+
+  criteria: {
+    tagName:      'n = h.tagName(n, r, "#{1}", c);      c = false;',
+    className:    'n = h.className(n, r, "#{1}", c);    c = false;',
+    id:           'n = h.id(n, r, "#{1}", c);           c = false;',
+    attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
+    attr: function(m) {
+      m[3] = (m[5] || m[6]);
+      return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
+    },
+    pseudo: function(m) {
+      if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
+      return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
+    },
+    descendant:   'c = "descendant";',
+    child:        'c = "child";',
+    adjacent:     'c = "adjacent";',
+    laterSibling: 'c = "laterSibling";'
+  },
+
+  patterns: {
+    // combinators must be listed first
+    // (and descendant needs to be last combinator)
+    laterSibling: /^\s*~\s*/,
+    child:        /^\s*>\s*/,
+    adjacent:     /^\s*\+\s*/,
+    descendant:   /^\s/,
+
+    // selectors follow
+    tagName:      /^\s*(\*|[\w\-]+)(\b|$)?/,
+    id:           /^#([\w\-\*]+)(\b|$)/,
+    className:    /^\.([\w\-\*]+)(\b|$)/,
+    pseudo:
+/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
+    attrPresence: /^\[([\w]+)\]/,
+    attr:         /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
+  },
+
+  // for Selector.match and Element#match
+  assertions: {
+    tagName: function(element, matches) {
+      return matches[1].toUpperCase() == element.tagName.toUpperCase();
+    },
+
+    className: function(element, matches) {
+      return Element.hasClassName(element, matches[1]);
+    },
+
+    id: function(element, matches) {
+      return element.id === matches[1];
+    },
+
+    attrPresence: function(element, matches) {
+      return Element.hasAttribute(element, matches[1]);
+    },
+
+    attr: function(element, matches) {
+      var nodeValue = Element.readAttribute(element, matches[1]);
+      return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
+    }
+  },
+
+  handlers: {
+    // UTILITY FUNCTIONS
+    // joins two collections
+    concat: function(a, b) {
+      for (var i = 0, node; node = b[i]; i++)
+        a.push(node);
+      return a;
+    },
+
+    // marks an array of nodes for counting
+    mark: function(nodes) {
+      var _true = Prototype.emptyFunction;
+      for (var i = 0, node; node = nodes[i]; i++)
+        node._countedByPrototype = _true;
+      return nodes;
+    },
+
+    unmark: function(nodes) {
+      for (var i = 0, node; node = nodes[i]; i++)
+        node._countedByPrototype = undefined;
+      return nodes;
+    },
+
+    // mark each child node with its position (for nth calls)
+    // "ofType" flag indicates whether we're indexing for nth-of-type
+    // rather than nth-child
+    index: function(parentNode, reverse, ofType) {
+      parentNode._countedByPrototype = Prototype.emptyFunction;
+      if (reverse) {
+        for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
+          var node = nodes[i];
+          if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
+        }
+      } else {
+        for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
+          if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
+      }
+    },
+
+    // filters out duplicates and extends all nodes
+    unique: function(nodes) {
+      if (nodes.length == 0) return nodes;
+      var results = [], n;
+      for (var i = 0, l = nodes.length; i < l; i++)
+        if (!(n = nodes[i])._countedByPrototype) {
+          n._countedByPrototype = Prototype.emptyFunction;
+          results.push(Element.extend(n));
+        }
+      return Selector.handlers.unmark(results);
+    },
+
+    // COMBINATOR FUNCTIONS
+    descendant: function(nodes) {
+      var h = Selector.handlers;
+      for (var i = 0, results = [], node; node = nodes[i]; i++)
+        h.concat(results, node.getElementsByTagName('*'));
+      return results;
+    },
+
+    child: function(nodes) {
+      var h = Selector.handlers;
+      for (var i = 0, results = [], node; node = nodes[i]; i++) {
+        for (var j = 0, child; child = node.childNodes[j]; j++)
+          if (child.nodeType == 1 && child.tagName != '!') results.push(child);
+      }
+      return results;
+    },
+
+    adjacent: function(nodes) {
+      for (var i = 0, results = [], node; node = nodes[i]; i++) {
+        var next = this.nextElementSibling(node);
+        if (next) results.push(next);
+      }
+      return results;
+    },
+
+    laterSibling: function(nodes) {
+      var h = Selector.handlers;
+      for (var i = 0, results = [], node; node = nodes[i]; i++)
+        h.concat(results, Element.nextSiblings(node));
+      return results;
+    },
+
+    nextElementSibling: function(node) {
+      while (node = node.nextSibling)
+	      if (node.nodeType == 1) return node;
+      return null;
+    },
+
+    previousElementSibling: function(node) {
+      while (node = node.previousSibling)
+        if (node.nodeType == 1) return node;
+      return null;
+    },
+
+    // TOKEN FUNCTIONS
+    tagName: function(nodes, root, tagName, combinator) {
+      var uTagName = tagName.toUpperCase();
+      var results = [], h = Selector.handlers;
+      if (nodes) {
+        if (combinator) {
+          // fastlane for ordinary descendant combinators
+          if (combinator == "descendant") {
+            for (var i = 0, node; node = nodes[i]; i++)
+              h.concat(results, node.getElementsByTagName(tagName));
+            return results;
+          } else nodes = this[combinator](nodes);
+          if (tagName == "*") return nodes;
+        }
+        for (var i = 0, node; node = nodes[i]; i++)
+          if (node.tagName.toUpperCase() === uTagName) results.push(node);
+        return results;
+      } else return root.getElementsByTagName(tagName);
+    },
+
+    id: function(nodes, root, id, combinator) {
+      var targetNode = $(id), h = Selector.handlers;
+      if (!targetNode) return [];
+      if (!nodes && root == document) return [targetNode];
+      if (nodes) {
+        if (combinator) {
+          if (combinator == 'child') {
+            for (var i = 0, node; node = nodes[i]; i++)
+              if (targetNode.parentNode == node) return [targetNode];
+          } else if (combinator == 'descendant') {
+            for (var i = 0, node; node = nodes[i]; i++)
+              if (Element.descendantOf(targetNode, node)) return [targetNode];
+          } else if (combinator == 'adjacent') {
+            for (var i = 0, node; node = nodes[i]; i++)
+              if (Selector.handlers.previousElementSibling(targetNode) == node)
+                return [targetNode];
+          } else nodes = h[combinator](nodes);
+        }
+        for (var i = 0, node; node = nodes[i]; i++)
+          if (node == targetNode) return [targetNode];
+        return [];
+      }
+      return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
+    },
+
+    className: function(nodes, root, className, combinator) {
+      if (nodes && combinator) nodes = this[combinator](nodes);
+      return Selector.handlers.byClassName(nodes, root, className);
+    },
+
+    byClassName: function(nodes, root, className) {
+      if (!nodes) nodes = Selector.handlers.descendant([root]);
+      var needle = ' ' + className + ' ';
+      for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
+        nodeClassName = node.className;
+        if (nodeClassName.length == 0) continue;
+        if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
+          results.push(node);
+      }
+      return results;
+    },
+
+    attrPresence: function(nodes, root, attr, combinator) {
+      if (!nodes) nodes = root.getElementsByTagName("*");
+      if (nodes && combinator) nodes = this[combinator](nodes);
+      var results = [];
+      for (var i = 0, node; node = nodes[i]; i++)
+        if (Element.hasAttribute(node, attr)) results.push(node);
+      return results;
+    },
+
+    attr: function(nodes, root, attr, value, operator, combinator) {
+      if (!nodes) nodes = root.getElementsByTagName("*");
+      if (nodes && combinator) nodes = this[combinator](nodes);
+      var handler = Selector.operators[operator], results = [];
+      for (var i = 0, node; node = nodes[i]; i++) {
+        var nodeValue = Element.readAttribute(node, attr);
+        if (nodeValue === null) continue;
+        if (handler(nodeValue, value)) results.push(node);
+      }
+      return results;
+    },
+
+    pseudo: function(nodes, name, value, root, combinator) {
+      if (nodes && combinator) nodes = this[combinator](nodes);
+      if (!nodes) nodes = root.getElementsByTagName("*");
+      return Selector.pseudos[name](nodes, value, root);
+    }
+  },
+
+  pseudos: {
+    'first-child': function(nodes, value, root) {
+      for (var i = 0, results = [], node; node = nodes[i]; i++) {
+        if (Selector.handlers.previousElementSibling(node)) continue;
+          results.push(node);
+      }
+      return results;
+    },
+    'last-child': function(nodes, value, root) {
+      for (var i = 0, results = [], node; node = nodes[i]; i++) {
+        if (Selector.handlers.nextElementSibling(node)) continue;
+          results.push(node);
+      }
+      return results;
+    },
+    'only-child': function(nodes, value, root) {
+      var h = Selector.handlers;
+      for (var i = 0, results = [], node; node = nodes[i]; i++)
+        if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
+          results.push(node);
+      return results;
+    },
+    'nth-child':        function(nodes, formula, root) {
+      return Selector.pseudos.nth(nodes, formula, root);
+    },
+    'nth-last-child':   function(nodes, formula, root) {
+      return Selector.pseudos.nth(nodes, formula, root, true);
+    },
+    'nth-of-type':      function(nodes, formula, root) {
+      return Selector.pseudos.nth(nodes, formula, root, false, true);
+    },
+    'nth-last-of-type': function(nodes, formula, root) {
+      return Selector.pseudos.nth(nodes, formula, root, true, true);
+    },
+    'first-of-type':    function(nodes, formula, root) {
+      return Selector.pseudos.nth(nodes, "1", root, false, true);
+    },
+    'last-of-type':     function(nodes, formula, root) {
+      return Selector.pseudos.nth(nodes, "1", root, true, true);
+    },
+    'only-of-type':     function(nodes, formula, root) {
+      var p = Selector.pseudos;
+      return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
+    },
+
+    // handles the an+b logic
+    getIndices: function(a, b, total) {
+      if (a == 0) return b > 0 ? [b] : [];
+      return $R(1, total).inject([], function(memo, i) {
+        if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
+        return memo;
+      });
+    },
+
+    // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
+    nth: function(nodes, formula, root, reverse, ofType) {
+      if (nodes.length == 0) return [];
+      if (formula == 'even') formula = '2n+0';
+      if (formula == 'odd')  formula = '2n+1';
+      var h = Selector.handlers, results = [], indexed = [], m;
+      h.mark(nodes);
+      for (var i = 0, node; node = nodes[i]; i++) {
+        if (!node.parentNode._countedByPrototype) {
+          h.index(node.parentNode, reverse, ofType);
+          indexed.push(node.parentNode);
+        }
+      }
+      if (formula.match(/^\d+$/)) { // just a number
+        formula = Number(formula);
+        for (var i = 0, node; node = nodes[i]; i++)
+          if (node.nodeIndex == formula) results.push(node);
+      } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
+        if (m[1] == "-") m[1] = -1;
+        var a = m[1] ? Number(m[1]) : 1;
+        var b = m[2] ? Number(m[2]) : 0;
+        var indices = Selector.pseudos.getIndices(a, b, nodes.length);
+        for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
+          for (var j = 0; j < l; j++)
+            if (node.nodeIndex == indices[j]) results.push(node);
+        }
+      }
+      h.unmark(nodes);
+      h.unmark(indexed);
+      return results;
+    },
+
+    'empty': function(nodes, value, root) {
+      for (var i = 0, results = [], node; node = nodes[i]; i++) {
+        // IE treats comments as element nodes
+        if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue;
+        results.push(node);
+      }
+      return results;
+    },
+
+    'not': function(nodes, selector, root) {
+      var h = Selector.handlers, selectorType, m;
+      var exclusions = new Selector(selector).findElements(root);
+      h.mark(exclusions);
+      for (var i = 0, results = [], node; node = nodes[i]; i++)
+        if (!node._countedByPrototype) results.push(node);
+      h.unmark(exclusions);
+      return results;
+    },
+
+    'enabled': function(nodes, value, root) {
+      for (var i = 0, results = [], node; node = nodes[i]; i++)
+        if (!node.disabled) results.push(node);
+      return results;
+    },
+
+    'disabled': function(nodes, value, root) {
+      for (var i = 0, results = [], node; node = nodes[i]; i++)
+        if (node.disabled) results.push(node);
+      return results;
+    },
+
+    'checked': function(nodes, value, root) {
+      for (var i = 0, results = [], node; node = nodes[i]; i++)
+        if (node.checked) results.push(node);
+      return results;
+    }
+  },
+
+  operators: {
+    '=':  function(nv, v) { return nv == v; },
+    '!=': function(nv, v) { return nv != v; },
+    '^=': function(nv, v) { return nv.startsWith(v); },
+    '$=': function(nv, v) { return nv.endsWith(v); },
+    '*=': function(nv, v) { return nv.include(v); },
+    '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
+    '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
+  },
+
+  split: function(expression) {
+    var expressions = [];
+    expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
+      expressions.push(m[1].strip());
+    });
+    return expressions;
+  },
+
+  matchElements: function(elements, expression) {
+    var matches = $$(expression), h = Selector.handlers;
+    h.mark(matches);
+    for (var i = 0, results = [], element; element = elements[i]; i++)
+      if (element._countedByPrototype) results.push(element);
+    h.unmark(matches);
+    return results;
+  },
+
+  findElement: function(elements, expression, index) {
+    if (Object.isNumber(expression)) {
+      index = expression; expression = false;
+    }
+    return Selector.matchElements(elements, expression || '*')[index || 0];
+  },
+
+  findChildElements: function(element, expressions) {
+    expressions = Selector.split(expressions.join(','));
+    var results = [], h = Selector.handlers;
+    for (var i = 0, l = expressions.length, selector; i < l; i++) {
+      selector = new Selector(expressions[i].strip());
+      h.concat(results, selector.findElements(element));
+    }
+    return (l > 1) ? h.unique(results) : results;
+  }
+});
+
+if (Prototype.Browser.IE) {
+  Object.extend(Selector.handlers, {
+    // IE returns comment nodes on getElementsByTagName("*").
+    // Filter them out.
+    concat: function(a, b) {
+      for (var i = 0, node; node = b[i]; i++)
+        if (node.tagName !== "!") a.push(node);
+      return a;
+    },
+
+    // IE improperly serializes _countedByPrototype in (inner|outer)HTML.
+    unmark: function(nodes) {
+      for (var i = 0, node; node = nodes[i]; i++)
+        node.removeAttribute('_countedByPrototype');
+      return nodes;
+    }
+  });
+}
+
+function $$() {
+  return Selector.findChildElements(document, $A(arguments));
+}
+var Form = {
+  reset: function(form) {
+    $(form).reset();
+    return form;
+  },
+
+  serializeElements: function(elements, options) {
+    if (typeof options != 'object') options = { hash: !!options };
+    else if (Object.isUndefined(options.hash)) options.hash = true;
+    var key, value, submitted = false, submit = options.submit;
+
+    var data = elements.inject({ }, function(result, element) {
+      if (!element.disabled && element.name) {
+        key = element.name; value = $(element).getValue();
+        if (value != null && (element.type != 'submit' || (!submitted &&
+            submit !== false && (!submit || key == submit) && (submitted = true)))) {
+          if (key in result) {
+            // a key is already present; construct an array of values
+            if (!Object.isArray(result[key])) result[key] = [result[key]];
+            result[key].push(value);
+          }
+          else result[key] = value;
+        }
+      }
+      return result;
+    });
+
+    return options.hash ? data : Object.toQueryString(data);
+  }
+};
+
+Form.Methods = {
+  serialize: function(form, options) {
+    return Form.serializeElements(Form.getElements(form), options);
+  },
+
+  getElements: function(form) {
+    return $A($(form).getElementsByTagName('*')).inject([],
+      function(elements, child) {
+        if (Form.Element.Serializers[child.tagName.toLowerCase()])
+          elements.push(Element.extend(child));
+        return elements;
+      }
+    );
+  },
+
+  getInputs: function(form, typeName, name) {
+    form = $(form);
+    var inputs = form.getElementsByTagName('input');
+
+    if (!typeName && !name) return $A(inputs).map(Element.extend);
+
+    for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
+      var input = inputs[i];
+      if ((typeName && input.type != typeName) || (name && input.name != name))
+        continue;
+      matchingInputs.push(Element.extend(input));
+    }
+
+    return matchingInputs;
+  },
+
+  disable: function(form) {
+    form = $(form);
+    Form.getElements(form).invoke('disable');
+    return form;
+  },
+
+  enable: function(form) {
+    form = $(form);
+    Form.getElements(form).invoke('enable');
+    return form;
+  },
+
+  findFirstElement: function(form) {
+    var elements = $(form).getElements().findAll(function(element) {
+      return 'hidden' != element.type && !element.disabled;
+    });
+    var firstByIndex = elements.findAll(function(element) {
+      return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
+    }).sortBy(function(element) { return element.tabIndex }).first();
+
+    return firstByIndex ? firstByIndex : elements.find(function(element) {
+      return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
+    });
+  },
+
+  focusFirstElement: function(form) {
+    form = $(form);
+    form.findFirstElement().activate();
+    return form;
+  },
+
+  request: function(form, options) {
+    form = $(form), options = Object.clone(options || { });
+
+    var params = options.parameters, action = form.readAttribute('action') || '';
+    if (action.blank()) action = window.location.href;
+    options.parameters = form.serialize(true);
+
+    if (params) {
+      if (Object.isString(params)) params = params.toQueryParams();
+      Object.extend(options.parameters, params);
+    }
+
+    if (form.hasAttribute('method') && !options.method)
+      options.method = form.method;
+
+    return new Ajax.Request(action, options);
+  }
+};
+
+/*--------------------------------------------------------------------------*/
+
+Form.Element = {
+  focus: function(element) {
+    $(element).focus();
+    return element;
+  },
+
+  select: function(element) {
+    $(element).select();
+    return element;
+  }
+};
+
+Form.Element.Methods = {
+  serialize: function(element) {
+    element = $(element);
+    if (!element.disabled && element.name) {
+      var value = element.getValue();
+      if (value != undefined) {
+        var pair = { };
+        pair[element.name] = value;
+        return Object.toQueryString(pair);
+      }
+    }
+    return '';
+  },
+
+  getValue: function(element) {
+    element = $(element);
+    var method = element.tagName.toLowerCase();
+    return Form.Element.Serializers[method](element);
+  },
+
+  setValue: function(element, value) {
+    element = $(element);
+    var method = element.tagName.toLowerCase();
+    Form.Element.Serializers[method](element, value);
+    return element;
+  },
+
+  clear: function(element) {
+    $(element).value = '';
+    return element;
+  },
+
+  present: function(element) {
+    return $(element).value != '';
+  },
+
+  activate: function(element) {
+    element = $(element);
+    try {
+      element.focus();
+      if (element.select && (element.tagName.toLowerCase() != 'input' ||
+          !['button', 'reset', 'submit'].include(element.type)))
+        element.select();
+    } catch (e) { }
+    return element;
+  },
+
+  disable: function(element) {
+    element = $(element);
+    element.blur();
+    element.disabled = true;
+    return element;
+  },
+
+  enable: function(element) {
+    element = $(element);
+    element.disabled = false;
+    return element;
+  }
+};
+
+/*--------------------------------------------------------------------------*/
+
+var Field = Form.Element;
+var $F = Form.Element.Methods.getValue;
+
+/*--------------------------------------------------------------------------*/
+
+Form.Element.Serializers = {
+  input: function(element, value) {
+    switch (element.type.toLowerCase()) {
+      case 'checkbox':
+      case 'radio':
+        return Form.Element.Serializers.inputSelector(element, value);
+      default:
+        return Form.Element.Serializers.textarea(element, value);
+    }
+  },
+
+  inputSelector: function(element, value) {
+    if (Object.isUndefined(value)) return element.checked ? element.value : null;
+    else element.checked = !!value;
+  },
+
+  textarea: function(element, value) {
+    if (Object.isUndefined(value)) return element.value;
+    else element.value = value;
+  },
+
+  select: function(element, index) {
+    if (Object.isUndefined(index))
+      return this[element.type == 'select-one' ?
+        'selectOne' : 'selectMany'](element);
+    else {
+      var opt, value, single = !Object.isArray(index);
+      for (var i = 0, length = element.length; i < length; i++) {
+        opt = element.options[i];
+        value = this.optionValue(opt);
+        if (single) {
+          if (value == index) {
+            opt.selected = true;
+            return;
+          }
+        }
+        else opt.selected = index.include(value);
+      }
+    }
+  },
+
+  selectOne: function(element) {
+    var index = element.selectedIndex;
+    return index >= 0 ? this.optionValue(element.options[index]) : null;
+  },
+
+  selectMany: function(element) {
+    var values, length = element.length;
+    if (!length) return null;
+
+    for (var i = 0, values = []; i < length; i++) {
+      var opt = element.options[i];
+      if (opt.selected) values.push(this.optionValue(opt));
+    }
+    return values;
+  },
+
+  optionValue: function(opt) {
+    // extend element because hasAttribute may not be native
+    return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
+  }
+};
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
+  initialize: function($super, element, frequency, callback) {
+    $super(callback, frequency);
+    this.element   = $(element);
+    this.lastValue = this.getValue();
+  },
+
+  execute: function() {
+    var value = this.getValue();
+    if (Object.isString(this.lastValue) && Object.isString(value) ?
+        this.lastValue != value : String(this.lastValue) != String(value)) {
+      this.callback(this.element, value);
+      this.lastValue = value;
+    }
+  }
+});
+
+Form.Element.Observer = Class.create(Abstract.TimedObserver, {
+  getValue: function() {
+    return Form.Element.getValue(this.element);
+  }
+});
+
+Form.Observer = Class.create(Abstract.TimedObserver, {
+  getValue: function() {
+    return Form.serialize(this.element);
+  }
+});
+
+/*--------------------------------------------------------------------------*/
+
+Abstract.EventObserver = Class.create({
+  initialize: function(element, callback) {
+    this.element  = $(element);
+    this.callback = callback;
+
+    this.lastValue = this.getValue();
+    if (this.element.tagName.toLowerCase() == 'form')
+      this.registerFormCallbacks();
+    else
+      this.registerCallback(this.element);
+  },
+
+  onElementEvent: function() {
+    var value = this.getValue();
+    if (this.lastValue != value) {
+      this.callback(this.element, value);
+      this.lastValue = value;
+    }
+  },
+
+  registerFormCallbacks: function() {
+    Form.getElements(this.element).each(this.registerCallback, this);
+  },
+
+  registerCallback: function(element) {
+    if (element.type) {
+      switch (element.type.toLowerCase()) {
+        case 'checkbox':
+        case 'radio':
+          Event.observe(element, 'click', this.onElementEvent.bind(this));
+          break;
+        default:
+          Event.observe(element, 'change', this.onElementEvent.bind(this));
+          break;
+      }
+    }
+  }
+});
+
+Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
+  getValue: function() {
+    return Form.Element.getValue(this.element);
+  }
+});
+
+Form.EventObserver = Class.create(Abstract.EventObserver, {
+  getValue: function() {
+    return Form.serialize(this.element);
+  }
+});
+if (!window.Event) var Event = { };
+
+Object.extend(Event, {
+  KEY_BACKSPACE: 8,
+  KEY_TAB:       9,
+  KEY_RETURN:   13,
+  KEY_ESC:      27,
+  KEY_LEFT:     37,
+  KEY_UP:       38,
+  KEY_RIGHT:    39,
+  KEY_DOWN:     40,
+  KEY_DELETE:   46,
+  KEY_HOME:     36,
+  KEY_END:      35,
+  KEY_PAGEUP:   33,
+  KEY_PAGEDOWN: 34,
+  KEY_INSERT:   45,
+
+  cache: { },
+
+  relatedTarget: function(event) {
+    var element;
+    switch(event.type) {
+      case 'mouseover': element = event.fromElement; break;
+      case 'mouseout':  element = event.toElement;   break;
+      default: return null;
+    }
+    return Element.extend(element);
+  }
+});
+
+Event.Methods = (function() {
+  var isButton;
+
+  if (Prototype.Browser.IE) {
+    var buttonMap = { 0: 1, 1: 4, 2: 2 };
+    isButton = function(event, code) {
+      return event.button == buttonMap[code];
+    };
+
+  } else if (Prototype.Browser.WebKit) {
+    isButton = function(event, code) {
+      switch (code) {
+        case 0: return event.which == 1 && !event.metaKey;
+        case 1: return event.which == 1 && event.metaKey;
+        default: return false;
+      }
+    };
+
+  } else {
+    isButton = function(event, code) {
+      return event.which ? (event.which === code + 1) : (event.button === code);
+    };
+  }
+
+  return {
+    isLeftClick:   function(event) { return isButton(event, 0) },
+    isMiddleClick: function(event) { return isButton(event, 1) },
+    isRightClick:  function(event) { return isButton(event, 2) },
+
+    element: function(event) {
+      var node = Event.extend(event).target;
+      return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node);
+    },
+
+    findElement: function(event, expression) {
+      var element = Event.element(event);
+      if (!expression) return element;
+      var elements = [element].concat(element.ancestors());
+      return Selector.findElement(elements, expression, 0);
+    },
+
+    pointer: function(event) {
+      return {
+        x: event.pageX || (event.clientX +
+          (document.documentElement.scrollLeft || document.body.scrollLeft)),
+        y: event.pageY || (event.clientY +
+          (document.documentElement.scrollTop || document.body.scrollTop))
+      };
+    },
+
+    pointerX: function(event) { return Event.pointer(event).x },
+    pointerY: function(event) { return Event.pointer(event).y },
+
+    stop: function(event) {
+      Event.extend(event);
+      event.preventDefault();
+      event.stopPropagation();
+      event.stopped = true;
+    }
+  };
+})();
+
+Event.extend = (function() {
+  var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
+    m[name] = Event.Methods[name].methodize();
+    return m;
+  });
+
+  if (Prototype.Browser.IE) {
+    Object.extend(methods, {
+      stopPropagation: function() { this.cancelBubble = true },
+      preventDefault:  function() { this.returnValue = false },
+      inspect: function() { return "[object Event]" }
+    });
+
+    return function(event) {
+      if (!event) return false;
+      if (event._extendedByPrototype) return event;
+
+      event._extendedByPrototype = Prototype.emptyFunction;
+      var pointer = Event.pointer(event);
+      Object.extend(event, {
+        target: event.srcElement,
+        relatedTarget: Event.relatedTarget(event),
+        pageX:  pointer.x,
+        pageY:  pointer.y
+      });
+      return Object.extend(event, methods);
+    };
+
+  } else {
+    Event.prototype = Event.prototype || document.createEvent("HTMLEvents").__proto__;
+    Object.extend(Event.prototype, methods);
+    return Prototype.K;
+  }
+})();
+
+Object.extend(Event, (function() {
+  var cache = Event.cache;
+
+  function getEventID(element) {
+    if (element._prototypeEventID) return element._prototypeEventID[0];
+    arguments.callee.id = arguments.callee.id || 1;
+    return element._prototypeEventID = [++arguments.callee.id];
+  }
+
+  function getDOMEventName(eventName) {
+    if (eventName && eventName.include(':')) return "dataavailable";
+    return eventName;
+  }
+
+  function getCacheForID(id) {
+    return cache[id] = cache[id] || { };
+  }
+
+  function getWrappersForEventName(id, eventName) {
+    var c = getCacheForID(id);
+    return c[eventName] = c[eventName] || [];
+  }
+
+  function createWrapper(element, eventName, handler) {
+    var id = getEventID(element);
+    var c = getWrappersForEventName(id, eventName);
+    if (c.pluck("handler").include(handler)) return false;
+
+    var wrapper = function(event) {
+      if (!Event || !Event.extend ||
+        (event.eventName && event.eventName != eventName))
+          return false;
+
+      Event.extend(event);
+      handler.call(element, event);
+    };
+
+    wrapper.handler = handler;
+    c.push(wrapper);
+    return wrapper;
+  }
+
+  function findWrapper(id, eventName, handler) {
+    var c = getWrappersForEventName(id, eventName);
+    return c.find(function(wrapper) { return wrapper.handler == handler });
+  }
+
+  function destroyWrapper(id, eventName, handler) {
+    var c = getCacheForID(id);
+    if (!c[eventName]) return false;
+    c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
+  }
+
+  function destroyCache() {
+    for (var id in cache)
+      for (var eventName in cache[id])
+        cache[id][eventName] = null;
+  }
+
+  if (window.attachEvent) {
+    window.attachEvent("onunload", destroyCache);
+  }
+
+  return {
+    observe: function(element, eventName, handler) {
+      element = $(element);
+      var name = getDOMEventName(eventName);
+
+      var wrapper = createWrapper(element, eventName, handler);
+      if (!wrapper) return element;
+
+      if (element.addEventListener) {
+        element.addEventListener(name, wrapper, false);
+      } else {
+        element.attachEvent("on" + name, wrapper);
+      }
+
+      return element;
+    },
+
+    stopObserving: function(element, eventName, handler) {
+      element = $(element);
+      var id = getEventID(element), name = getDOMEventName(eventName);
+
+      if (!handler && eventName) {
+        getWrappersForEventName(id, eventName).each(function(wrapper) {
+          element.stopObserving(eventName, wrapper.handler);
+        });
+        return element;
+
+      } else if (!eventName) {
+        Object.keys(getCacheForID(id)).each(function(eventName) {
+          element.stopObserving(eventName);
+        });
+        return element;
+      }
+
+      var wrapper = findWrapper(id, eventName, handler);
+      if (!wrapper) return element;
+
+      if (element.removeEventListener) {
+        element.removeEventListener(name, wrapper, false);
+      } else {
+        element.detachEvent("on" + name, wrapper);
+      }
+
+      destroyWrapper(id, eventName, handler);
+
+      return element;
+    },
+
+    fire: function(element, eventName, memo) {
+      element = $(element);
+      if (element == document && document.createEvent && !element.dispatchEvent)
+        element = document.documentElement;
+
+      var event;
+      if (document.createEvent) {
+        event = document.createEvent("HTMLEvents");
+        event.initEvent("dataavailable", true, true);
+      } else {
+        event = document.createEventObject();
+        event.eventType = "ondataavailable";
+      }
+
+      event.eventName = eventName;
+      event.memo = memo || { };
+
+      if (document.createEvent) {
+        element.dispatchEvent(event);
+      } else {
+        element.fireEvent(event.eventType, event);
+      }
+
+      return Event.extend(event);
+    }
+  };
+})());
+
+Object.extend(Event, Event.Methods);
+
+Element.addMethods({
+  fire:          Event.fire,
+  observe:       Event.observe,
+  stopObserving: Event.stopObserving
+});
+
+Object.extend(document, {
+  fire:          Element.Methods.fire.methodize(),
+  observe:       Element.Methods.observe.methodize(),
+  stopObserving: Element.Methods.stopObserving.methodize(),
+  loaded:        false
+});
+
+(function() {
+  /* Support for the DOMContentLoaded event is based on work by Dan Webb,
+     Matthias Miller, Dean Edwards and John Resig. */
+
+  var timer;
+
+  function fireContentLoadedEvent() {
+    if (document.loaded) return;
+    if (timer) window.clearInterval(timer);
+    document.fire("dom:loaded");
+    document.loaded = true;
+  }
+
+  if (document.addEventListener) {
+    if (Prototype.Browser.WebKit) {
+      timer = window.setInterval(function() {
+        if (/loaded|complete/.test(document.readyState))
+          fireContentLoadedEvent();
+      }, 0);
+
+      Event.observe(window, "load", fireContentLoadedEvent);
+
+    } else {
+      document.addEventListener("DOMContentLoaded",
+        fireContentLoadedEvent, false);
+    }
+
+  } else {
+    document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
+    $("__onDOMContentLoaded").onreadystatechange = function() {
+      if (this.readyState == "complete") {
+        this.onreadystatechange = null;
+        fireContentLoadedEvent();
+      }
+    };
+  }
+})();
+/*------------------------------- DEPRECATED -------------------------------*/
+
+Hash.toQueryString = Object.toQueryString;
+
+var Toggle = { display: Element.toggle };
+
+Element.Methods.childOf = Element.Methods.descendantOf;
+
+var Insertion = {
+  Before: function(element, content) {
+    return Element.insert(element, {before:content});
+  },
+
+  Top: function(element, content) {
+    return Element.insert(element, {top:content});
+  },
+
+  Bottom: function(element, content) {
+    return Element.insert(element, {bottom:content});
+  },
+
+  After: function(element, content) {
+    return Element.insert(element, {after:content});
+  }
+};
+
+var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
+
+// This should be moved to script.aculo.us; notice the deprecated methods
+// further below, that map to the newer Element methods.
+var Position = {
+  // set to true if needed, warning: firefox performance problems
+  // NOT neeeded for page scrolling, only if draggable contained in
+  // scrollable elements
+  includeScrollOffsets: false,
+
+  // must be called before calling withinIncludingScrolloffset, every time the
+  // page is scrolled
+  prepare: function() {
+    this.deltaX =  window.pageXOffset
+                || document.documentElement.scrollLeft
+                || document.body.scrollLeft
+                || 0;
+    this.deltaY =  window.pageYOffset
+                || document.documentElement.scrollTop
+                || document.body.scrollTop
+                || 0;
+  },
+
+  // caches x/y coordinate pair to use with overlap
+  within: function(element, x, y) {
+    if (this.includeScrollOffsets)
+      return this.withinIncludingScrolloffsets(element, x, y);
+    this.xcomp = x;
+    this.ycomp = y;
+    this.offset = Element.cumulativeOffset(element);
+
+    return (y >= this.offset[1] &&
+            y <  this.offset[1] + element.offsetHeight &&
+            x >= this.offset[0] &&
+            x <  this.offset[0] + element.offsetWidth);
+  },
+
+  withinIncludingScrolloffsets: function(element, x, y) {
+    var offsetcache = Element.cumulativeScrollOffset(element);
+
+    this.xcomp = x + offsetcache[0] - this.deltaX;
+    this.ycomp = y + offsetcache[1] - this.deltaY;
+    this.offset = Element.cumulativeOffset(element);
+
+    return (this.ycomp >= this.offset[1] &&
+            this.ycomp <  this.offset[1] + element.offsetHeight &&
+            this.xcomp >= this.offset[0] &&
+            this.xcomp <  this.offset[0] + element.offsetWidth);
+  },
+
+  // within must be called directly before
+  overlap: function(mode, element) {
+    if (!mode) return 0;
+    if (mode == 'vertical')
+      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
+        element.offsetHeight;
+    if (mode == 'horizontal')
+      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
+        element.offsetWidth;
+  },
+
+  // Deprecation layer -- use newer Element methods now (1.5.2).
+
+  cumulativeOffset: Element.Methods.cumulativeOffset,
+
+  positionedOffset: Element.Methods.positionedOffset,
+
+  absolutize: function(element) {
+    Position.prepare();
+    return Element.absolutize(element);
+  },
+
+  relativize: function(element) {
+    Position.prepare();
+    return Element.relativize(element);
+  },
+
+  realOffset: Element.Methods.cumulativeScrollOffset,
+
+  offsetParent: Element.Methods.getOffsetParent,
+
+  page: Element.Methods.viewportOffset,
+
+  clone: function(source, target, options) {
+    options = options || { };
+    return Element.clonePosition(target, source, options);
+  }
+};
+
+/*--------------------------------------------------------------------------*/
+
+if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
+  function iter(name) {
+    return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
+  }
+
+  instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
+  function(element, className) {
+    className = className.toString().strip();
+    var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
+    return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
+  } : function(element, className) {
+    className = className.toString().strip();
+    var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
+    if (!classNames && !className) return elements;
+
+    var nodes = $(element).getElementsByTagName('*');
+    className = ' ' + className + ' ';
+
+    for (var i = 0, child, cn; child = nodes[i]; i++) {
+      if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
+          (classNames && classNames.all(function(name) {
+            return !name.toString().blank() && cn.include(' ' + name + ' ');
+          }))))
+        elements.push(Element.extend(child));
+    }
+    return elements;
+  };
+
+  return function(className, parentElement) {
+    return $(parentElement || document.body).getElementsByClassName(className);
+  };
+}(Element.Methods);
+
+/*--------------------------------------------------------------------------*/
+
+Element.ClassNames = Class.create();
+Element.ClassNames.prototype = {
+  initialize: function(element) {
+    this.element = $(element);
+  },
+
+  _each: function(iterator) {
+    this.element.className.split(/\s+/).select(function(name) {
+      return name.length > 0;
+    })._each(iterator);
+  },
+
+  set: function(className) {
+    this.element.className = className;
+  },
+
+  add: function(classNameToAdd) {
+    if (this.include(classNameToAdd)) return;
+    this.set($A(this).concat(classNameToAdd).join(' '));
+  },
+
+  remove: function(classNameToRemove) {
+    if (!this.include(classNameToRemove)) return;
+    this.set($A(this).without(classNameToRemove).join(' '));
+  },
+
+  toString: function() {
+    return $A(this).join(' ');
+  }
+};
+
+Object.extend(Element.ClassNames.prototype, Enumerable);
+
+/*--------------------------------------------------------------------------*/
+
+Element.addMethods();

+ 58 - 0
sites/all/modules/lightbox2/js/scriptaculous.js

@@ -0,0 +1,58 @@
+// script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// 
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+var Scriptaculous = {
+  Version: '1.8.1',
+  require: function(libraryName) {
+    // inserting via DOM fails in Safari 2.0, so brute force approach
+    document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
+  },
+  REQUIRED_PROTOTYPE: '1.6.0',
+  load: function() {
+    function convertVersionString(versionString){
+      var r = versionString.split('.');
+      return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
+    }
+ 
+    if((typeof Prototype=='undefined') || 
+       (typeof Element == 'undefined') || 
+       (typeof Element.Methods=='undefined') ||
+       (convertVersionString(Prototype.Version) < 
+        convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
+       throw("script.aculo.us requires the Prototype JavaScript framework >= " +
+        Scriptaculous.REQUIRED_PROTOTYPE);
+    
+    $A(document.getElementsByTagName("script")).findAll( function(s) {
+      return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
+    }).each( function(s) {
+      var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
+      var includes = s.src.match(/\?.*load=([a-z,]*)/);
+      (includes ? includes[1] : 'builder,effects').split(',').each(
+       function(include) { Scriptaculous.require(path+include+'.js') });
+    });
+  }
+}
+
+Scriptaculous.load();

+ 27 - 0
sites/all/modules/lightbox2/lightbox2-insert-image.tpl.php

@@ -0,0 +1,27 @@
+<?php
+// $Id: lightbox2-insert-image.tpl.php,v 1.1.2.2 2010/09/22 10:16:30 snpower Exp $
+
+/**
+ * @file
+ * Template file for Lightbox2 content inserted via the Insert module.
+ *
+ * Available variables:
+ * - $item: The complete item being inserted.
+ * - $url: The URL to the image.
+ * - $linkurl: The URL to the image being linked to.
+ * - $class: A set of classes assigned to this image (if any).
+ * - $image_preset_name: The ImageCache preset being used for the image.
+ * - $link_preset_name: The ImageCache preset being used for the linked to image.
+ * - $download_link: The download original link.
+ *
+ * Note that ALT and Title fields should not be filled in here, instead they
+ * should use placeholders that will be updated through JavaScript when the
+ * image is inserted.
+ *
+ * Available placeholders:
+ * - __alt__: The ALT text, intended for use in the <img> tag.
+ * - __title__: The Title text, intended for use in the <img> tag.
+ * - __description__: A description of the image, sometimes used as a caption.
+ */
+?>
+<a rel="lightbox[group1][__description__<?php print $download_link ?>]" href="<?php print $linkurl ?>"><img src="<?php print $url ?>" alt="__alt__" title="__title__" class="imagecache-<?php print $image_preset_name ?><?php print $class ? ' ' . $class : '' ?>" /></a>

+ 943 - 0
sites/all/modules/lightbox2/lightbox2.admin.inc

@@ -0,0 +1,943 @@
+<?php
+// $Id: lightbox2.admin.inc,v 1.1.2.38 2010/09/24 08:41:02 snpower Exp $
+
+/**
+ * @file
+ * Administrative page callbacks for the lightbox2 module.
+ */
+
+/**
+ * The default lightbox2 settings page.
+ */
+function lightbox2_settings_page($op = NULL) {
+  $output = drupal_get_form('lightbox2_general_settings_form');
+  return $output;
+}
+
+/**
+ * General configuration form for controlling the lightbox behaviour.
+ */
+function lightbox2_general_settings_form() {
+
+  // Add the javascript which disables / enables form elements.
+  drupal_add_js(drupal_get_path('module', 'lightbox2') . '/js/lightbox2.js', 'module');
+
+  // Enable translation of default strings for potx.
+  $default_strings = array(t('View Image Details'), t('Image !current of !total'), t('Page !current of !total'), t('Video !current of !total'), t('Download Original'));
+
+  // Define Lightbox2 layout fieldset.
+  /* --------------------------------- */
+  $form['layout_fieldset'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Layout settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+  );
+
+  // Define Lightbox2 Lite fieldset.
+  /* ------------------------------- */
+  $use_lite = variable_get('lightbox2_lite', FALSE);
+  $form['layout_fieldset']['lightbox2_lite_options'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Lightbox2 lite'),
+    '#collapsible' => TRUE,
+    '#collapsed' => !$use_lite,
+  );
+
+  // Add checkbox for Lightbox2 Lite.
+  $form['layout_fieldset']['lightbox2_lite_options']['lightbox2_lite']  = array(
+    '#type' => 'checkbox',
+    '#title' => t('Use lightbox2 lite'),
+    '#description' => t('Checking this box will enable Lightbox2 Lite and will disable all of the automatic image URL re-formatting features.  It also disables all grouping features.'),
+    '#default_value' => $use_lite,
+  );
+
+
+  // Add checkbox for alternative layout.
+  $form['layout_fieldset']['lightbox2_use_alt_layout'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Use alternative layout'),
+    '#description' => t('Enabling this option alters the layout of the lightbox elements. In the alternative layout the navigational links appear under the image with the caption text, instead of being overlayed on the image itself.  This doesn\'t apply when using Lightbox Lite.'),
+    '#default_value' => variable_get('lightbox2_use_alt_layout', FALSE),
+  );
+
+  // Add checkbox for force navigation display.
+  $form['layout_fieldset']['lightbox2_force_show_nav'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Force visibility of navigation links'),
+    '#description' => t('When viewing grouped images, the navigational links to the next and previous images are only displayed when you hover over the image.  Checking this box forces these links to be displayed all the time.'),
+    '#default_value' => variable_get('lightbox2_force_show_nav', FALSE),
+  );
+
+  // Show caption
+  $form['layout_fieldset']['lightbox2_show_caption'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Show image caption'),
+    '#description' => t('Unset this to always hide the image caption (usually the title).'),
+    '#default_value' => variable_get('lightbox2_show_caption', TRUE),
+  );
+
+  // Add checkbox for "looping through images'.
+  $form['layout_fieldset']['lightbox2_loop_items'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Continuous galleries'),
+    '#description' => t('When viewing grouped images, the Next button on the last image will display the first image, while the Previous button on the first image will display the last image.'),
+    '#default_value' => variable_get('lightbox2_loop_items', FALSE),
+  );
+
+  // Add checkbox for node link target.
+  $form['layout_fieldset']['lightbox2_node_link_target'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Open image page in new window'),
+    '#description' => t('This controls whether the link to the image page underneath the image is opened in a new window or the current window.'),
+    '#default_value' => variable_get('lightbox2_node_link_target', FALSE),
+    '#return_value' => '_blank',
+  );
+
+  // Define Lightbox2 text settings.
+  /* ------------------------------- */
+  $form['lightbox2_text_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Text settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  // Add text box for link text to node.
+  $form['lightbox2_text_settings']['lightbox2_node_link_text'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Text for image page link'),
+    '#description' => t('This is the text that will appear as the link to the image page underneath the image in the lightbox.  Leave this blank for the link not to appear.'),
+    '#default_value' => variable_get('lightbox2_node_link_text', 'View Image Details'),
+  );
+
+  // Add text box for link text to node.
+  $form['lightbox2_text_settings']['lightbox2_download_link_text'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Text for image original link'),
+    '#description' => t('This is the text that will appear as the link to the original file underneath the image in the lightbox.  Leave this blank for the link not to appear.  It will only appear for images uploaded via the "image" or "imagefield" modules.  Users will need the "download original image" permission, but also the "view original images" permission if using the "image" module.'),
+    '#default_value' => variable_get('lightbox2_download_link_text', 'Download Original'),
+  );
+
+  // Add text box for image count for grouping.
+  $form['lightbox2_text_settings']['lightbox2_image_count_str'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Image count text'),
+    '#description' => t('This text is used to display the image count underneath the image in the lightbox when image grouping is enabled.  Use !current as a placeholder for the number of the current image and !total for the total number of images in the group.  For example, "Image !current of !total".  Leave blank for text not to appear.'),
+    '#default_value' => variable_get('lightbox2_image_count_str', 'Image !current of !total'),
+  );
+
+  // Add text box for page count for grouping.
+  $form['lightbox2_text_settings']['lightbox2_page_count_str'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Page count text'),
+    '#description' => t('This text is used to display the page count underneath HTML content displayed in the lightbox when using groups.  Use !current as a placeholder for the number of the current page and !total for the total number of pages in the group.  For example, "Page !current of !total".  Leave blank for text not to appear.'),
+    '#default_value' => variable_get('lightbox2_page_count_str', 'Page !current of !total'),
+  );
+
+  // Add text box for video count for grouping.
+  $form['lightbox2_text_settings']['lightbox2_video_count_str'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Video count text'),
+    '#description' => t('This text is used to display the count underneath video content displayed in the lightbox when using groups.  Use !current as a placeholder for the number of the current video and !total for the total number of videos in the group.  For example, "Video !current of !total".  Leave blank for text not to appear.'),
+    '#default_value' => variable_get('lightbox2_video_count_str', 'Video !current of !total'),
+  );
+
+  // Add text box for video count for grouping.
+  $form['lightbox2_text_settings']['lightbox2_filter_xss_allowed_tags'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Allowed HTML tags'),
+    '#description' => t('A list of comma separated HTML tags which are allowed to be used in the caption text area.'),
+    '#default_value' => variable_get('lightbox2_filter_xss_allowed_tags', 'p, br, a, em, strong, cite, code, ul, ol, li, dl, dt, dd'),
+  );
+
+
+  // Define Lightbox2 zoom fieldset.
+  /* -------------------------------- */
+  $form['zoom_fieldset'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Image resize settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  // Add checkbox for resize image.
+  $form['zoom_fieldset']['lightbox2_disable_resize'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Disable resizing feature'),
+    '#description' => t('By default, when the image being displayed in the lightbox is larger than the browser window, it is resized to fit within the window and a zoom button is provided for users who wish to view the image in its original size.  Checking this box will disable this feature and all images will be displayed without any resizing.'),
+    '#default_value' => variable_get('lightbox2_disable_resize', FALSE),
+  );
+
+  // Add checkbox for zoom image.
+  $form['zoom_fieldset']['lightbox2_disable_zoom'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Disable zoom in / out feature'),
+    '#description' => t('When the image being displayed in the lightbox is resized to fit in the browser window, a "zoom in" button is shown.  This allows the user to zoom in to see the original full size image.  They will then see a "zoom out" button which will allow them to see the smaller resized version.  Checking this box will prevent these buttons from appearing.'),
+    '#default_value' => variable_get('lightbox2_disable_zoom', FALSE),
+  );
+
+  // Define Lightbox2 modal form fieldset.
+  /* -------------------------------------- */
+  $form['modal_form_fieldset'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Modal form settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  // Add checkbox for login support.
+  $form['modal_form_fieldset']['lightbox2_enable_login'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable login support'),
+    '#description' => t('Enabling this option will modify all login links so that the login form appears in a lightbox.'),
+    '#default_value' => variable_get('lightbox2_enable_login', FALSE),
+  );
+
+  // Add checkbox for contact form support.
+  $form['modal_form_fieldset']['lightbox2_enable_contact'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable contact form support'),
+    '#description' => t('Enabling this option will modify all contact links so that the contact form appears in a lightbox.'),
+    '#default_value' => variable_get('lightbox2_enable_contact', FALSE),
+  );
+
+  // Define Lightbox2 video fieldset.
+  /* -------------------------------- */
+  $form['video_fieldset'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Video settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  // Add checkbox for video support.
+  $form['video_fieldset']['lightbox2_enable_video'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable video support'),
+    '#description' => t('By default, video support is disabled in order to reduce the amount of javascript needed.  Checking this box will enable it.'),
+    '#default_value' => variable_get('lightbox2_enable_video', FALSE),
+  );
+
+  // Add textfield for FLV Player path.
+  $form['video_fieldset']['lightbox2_flv_player_path'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Path to FLV Player'),
+    '#description' => t('The path to the FLV player, relative to Drupal root directory. No leading slashes.'),
+    '#default_value' => variable_get('lightbox2_flv_player_path', 'flvplayer.swf'),
+  );
+
+  // Add textfield for FLV Player flashvars.
+  $form['video_fieldset']['lightbox2_flv_player_flashvars'] = array(
+    '#type' => 'textfield',
+    '#title' => t('FLV Player flashvars'),
+    '#description' => t('Flashvars for the FLV Player where supported, e.g. "autoplay=1&playerMode=normal".'),
+    '#default_value' => variable_get('lightbox2_flv_player_flashvars', ''),
+  );
+
+  // Define Lightbox2 page specific settings fieldset.
+  /* ------------------------------------------------ */
+  $form['lightbox2_page_init'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Page specific lightbox2 settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+  // Add radio buttons for the actions to take for the listed pages, i.e.
+  // disable or enable the lightbox functionality.
+  $page_options = array(
+    'page_enable' => t('Load only on the listed pages.'),
+    'page_disable' => t('Load on every page except the listed pages.'),
+  );
+  $form['lightbox2_page_init']['lightbox2_page_init_action'] = array(
+    '#type' => 'radios',
+    '#options' => $page_options,
+    '#title' => t('Enable lightbox2 on specific pages'),
+    '#default_value' => variable_get('lightbox2_page_init_action', 'page_disable'),
+  );
+  // Add text input for list of pages to take specific action on.
+  $form['lightbox2_page_init']['lightbox2_page_list'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Pages'),
+    '#description' => t('List one page per line as Drupal paths.  The * character is a wildcard.  Example paths are "node/add/page" and "node/add/*".  Use &lt;front&gt; to match the front page.'),
+    '#default_value' => variable_get('lightbox2_page_list', ''),
+  );
+
+  // Define grouping settings fieldset.
+  /* ------------------------------------ */
+  $form['group_options'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Group display settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  $group_options = array(
+    0 => t('No grouping'),
+    1 => t('Group by field name'),
+    2 => t('Group by node id'),
+    3 => t('Group by field name and node id'),
+    4 => t('Group all nodes and fields'),
+  );
+
+  $form['group_options']['lightbox2_image_group_node_id'] = array(
+    '#type' => 'select',
+    '#title' => t('Select Imagefield grouping in Views'),
+    '#description' => t('By default, imagefields in views are grouped by the field name they appear in the view in.  You can override that grouping here.'),
+    '#options' => $group_options,
+    '#default_value' => variable_get('lightbox2_image_group_node_id', 1),
+  );
+
+
+  // Define advanced settings fieldset.
+  /* ---------------------------------- */
+  $form['advanced_options'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Advanced settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  // Allow users to decide where javascript should be loaded - header or footer.
+  // Header is recommended so user can click on images before page has finished
+  // loading, but footer is needed for sites in IE which use SWFObject.
+  $form['advanced_options']['lightbox2_js_location'] = array(
+    '#type' => 'select',
+    '#title' => t('Location of javscript'),
+    '#options' => array('header' => t('Header'), 'footer' => t('Footer')),
+    '#description' => t('By default, the lightbox javascript files are loaded in the HTML header.  However, for sites using SWFObject to load their Flash content, the footer setting is recommended to prevent "Operation Aborted" errors in IE.  If using the footer setting, please note that not all themes correctly implement the footer region and may require a small change.'),
+    '#default_value' => variable_get('lightbox2_js_location', 'header'),
+  );
+
+  $form['advanced_options']['lightbox2_disable_close_click'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Click on overlay or lightbox to close it'),
+    '#description' => t('Enable user to close lightbox by clicking on the lightbox itself or the overlay background.'),
+    '#default_value' => variable_get('lightbox2_disable_close_click', TRUE),
+  );
+
+  // Define keyboard shortcuts fieldset.
+  /* ---------------------------------- */
+  $form['advanced_options']['keyboard_shortcuts'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Keyboard shortcuts'),
+    '#description' => t('Configure the keyboard shortcuts for controlling the lightbox.  These options do not apply to the Lightbox2 Lite version, which uses the default "Close keys" (c, x and esc) to close the lightbox.'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  $form['advanced_options']['keyboard_shortcuts']['lightbox2_keys_close'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Close keys'),
+    '#description' => t("A list of keys (or key codes) that a user may use to close the lightbox. Values should be separated by a space. Defaults to 'c x 27' (c, x, or esc)."),
+    '#default_value' => variable_get('lightbox2_keys_close', 'c x 27'),
+  );
+
+  $form['advanced_options']['keyboard_shortcuts']['lightbox2_keys_previous'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Previous keys'),
+    '#description' => t("A list of keys (or key codes) that a user may use to navigate to the previous item in the lightbox. Values should be separated by a space. Defaults to 'p 37' (p or left arrow)."),
+    '#default_value' => variable_get('lightbox2_keys_previous', 'p 37'),
+  );
+
+  $form['advanced_options']['keyboard_shortcuts']['lightbox2_keys_next'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Next keys'),
+    '#description' => t("A list of keys (or key codes) that a user may use to navigate to the next item in the lightbox. Values should be separated by a space. Defaults to 'n 39' (n or right arrow)."),
+    '#default_value' => variable_get('lightbox2_keys_next', 'n 39'),
+  );
+
+  $form['advanced_options']['keyboard_shortcuts']['lightbox2_keys_zoom'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Zoom keys'),
+    '#description' => t("A list of keys (or key codes) that a user may use to zoom in / out of images in the lightbox. Values should be separated by a space. Defaults to 'z'."),
+    '#default_value' => variable_get('lightbox2_keys_zoom', 'z'),
+  );
+
+  $form['advanced_options']['keyboard_shortcuts']['lightbox2_keys_play_pause'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Pause / play keys'),
+    '#description' => t("A list of keys (or key codes) that a user may use to pause / play the lightbox. Values should be separated by a space. Defaults to '32' (spacebar)."),
+    '#default_value' => variable_get('lightbox2_keys_play_pause', '32'),
+  );
+
+
+
+
+  // Define border settings fieldset.
+  /* ---------------------------------- */
+  $form['advanced_options']['skin_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Skin settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  $form['advanced_options']['skin_settings']['lightbox2_border_size'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Border size'),
+    '#size' => 6,
+    '#maxlength' => 6,
+    '#description' => t('Enter the size of the border in pixels to display around the image.'),
+    '#default_value' => variable_get('lightbox2_border_size', 10),
+  );
+
+  $form['advanced_options']['skin_settings']['lightbox2_box_color'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Lightbox color'),
+    '#field_prefix' => '#',
+    '#size' => 6,
+    '#maxlength' => 6,
+    '#description' => t('Enter a hexadecimal color value for the border.  For example <code>fff</code> or <code>ffffff</code> for white).'),
+    '#default_value' => variable_get('lightbox2_box_color', 'fff'),
+  );
+
+  $form['advanced_options']['skin_settings']['lightbox2_font_color'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Font color'),
+    '#field_prefix' => '#',
+    '#size' => 6,
+    '#maxlength' => 6,
+    '#description' => t('Enter a hexadecimal color value for the font.  For example <code>000</code> or <code>000000</code> for black).'),
+    '#default_value' => variable_get('lightbox2_font_color', '000'),
+  );
+
+  $form['advanced_options']['skin_settings']['lightbox2_top_position'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Distance from top'),
+    '#size' => 6,
+    '#maxlength' => 6,
+    '#description' => t('Enter the position of the top of the lightbox in pixels.  Leave blank for automatic calculation.'),
+    '#default_value' => variable_get('lightbox2_top_position', ''),
+  );
+
+
+
+  // Define overlay settings fieldset.
+  /* ---------------------------------- */
+  $form['advanced_options']['overlay_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Overlay settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+  // Add checkbox for overlay opacity.
+  for ($i = 0; $i < 10; $i++) {
+    $opacity_options["0.$i"] = "0.$i";
+  }
+  $opacity_options["1.0"] = "1.0";
+  $form['advanced_options']['overlay_settings']['lightbox2_overlay_opacity'] = array(
+    '#type' => 'select',
+    '#title' => t('Overlay opacity'),
+    '#options' => $opacity_options,
+    '#description' => t('The overlay opacity setting determines how visible the background page is behind the lightbox.  The opacity value can range from 0.0 to 1.0 where 0.0 is 100% transparent and 1.0 is 100% opaque.'),
+    '#default_value' => variable_get('lightbox2_overlay_opacity', 0.8),
+  );
+
+  $form['advanced_options']['overlay_settings']['lightbox2_overlay_color'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Overlay color'),
+    '#field_prefix' => '#',
+    '#size' => 6,
+    '#maxlength' => 6,
+    '#description' => t('Enter a hexadecimal color value for the overlay.  For example <code>000</code> or <code>000000</code> for black).'),
+    '#default_value' => variable_get('lightbox2_overlay_color', '000'),
+  );
+
+
+  // Define animation settings fieldset.
+  /* ----------------------------------- */
+  $form['advanced_options']['animation_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Animation settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+  // Set animation help text.
+  $form['advanced_options']['animation_settings']['animation_options_help'] = array(
+    '#value' => '<p>' . t("These options aren't available when using Lightbox2 Lite.") . '</p>',
+  );
+  $resize_sequence_options = array(
+    t('Simultaneous'),
+    t('Width then height'),
+    t('Height then width'),
+  );
+  $form['advanced_options']['animation_settings']['lightbox2_resize_sequence'] = array(
+    '#type' => 'select',
+    '#title' => t('Resize sequence'),
+    '#options' => $resize_sequence_options,
+    '#description' => t('The sequence to use for the resizing animation.'),
+    '#default_value' => variable_get('lightbox2_resize_sequence', 0),
+  );
+  $form['advanced_options']['animation_settings']['lightbox2_resize_speed'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Resize duration'),
+    '#size' => 5,
+    '#maxlength' => 5,
+    '#description' => t('The duration (in seconds) of the resizing animation.  Enter a value between 0 and 10.'),
+    '#default_value' => variable_get('lightbox2_resize_speed', 0.4),
+  );
+  $form['advanced_options']['animation_settings']['lightbox2_fadein_speed'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Appearance duration'),
+    '#size' => 5,
+    '#maxlength' => 5,
+    '#description' => t('The duration (in seconds) of the lightbox appearance animation.  Enter a positive number less than 10.'),
+    '#default_value' => variable_get('lightbox2_fadein_speed', 0.4),
+  );
+
+
+  $form['advanced_options']['animation_settings']['lightbox2_slidedown_speed'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Caption slide down duration'),
+    '#size' => 5,
+    '#maxlength' => 5,
+    '#description' => t('The duration (in seconds) of the caption sliding-down animation.  Enter a value between 0 and 10.'),
+    '#default_value' => variable_get('lightbox2_slidedown_speed', 0.6),
+  );
+
+  return system_settings_form($form);
+}
+
+/**
+ * Validation function for the general configuration form.
+ *
+ * Ensure that the hex color value submitted is valid and that the speeds are
+ * numeric.
+ */
+function lightbox2_general_settings_form_validate($form, &$form_state) {
+  if ($form_state['values']['op'] == t('Save configuration')) {
+    $border_size = $form_state['values']['lightbox2_border_size'];
+    $box_hex_colour = $form_state['values']['lightbox2_box_color'];
+    $font_hex_colour = $form_state['values']['lightbox2_font_color'];
+    $top_position = $form_state['values']['lightbox2_top_position'];
+    $overlay_hex_colour = $form_state['values']['lightbox2_overlay_color'];
+    $resize_speed = $form_state['values']['lightbox2_resize_speed'];
+    $fadein_speed = $form_state['values']['lightbox2_fadein_speed'];
+    $slide_down_speed = $form_state['values']['lightbox2_slidedown_speed'];
+    $flv_player_path = $form_state['values']['lightbox2_flv_player_path'];
+
+    if (!empty($flv_player_path) && $form_state['values']['lightbox2_enable_video']) {
+      if (strpos($flv_player_path, base_path()) === 0) {
+        $flv_player_path = drupal_substr($flv_player_path, drupal_strlen(base_path()));
+      }
+      if (!file_exists($flv_player_path)) {
+        form_set_error('lightbox2_flv_player_path', t("FLV player path doesn't exist."));
+      }
+    }
+
+    if (!_lightbox2_validate_hex_color($overlay_hex_colour)) {
+      form_set_error('lightbox2_overlay_color', t('You must enter a properly formed hex value.'));
+    }
+
+    if (!$form_state['values']['lightbox2_lite']) {
+      if (!is_numeric($border_size) || $border_size < 0) {
+        form_set_error('lightbox2_border_size', t('You must enter a size greater than 0 pixels.'));
+      }
+
+      if (!_lightbox2_validate_hex_color($box_hex_colour)) {
+        form_set_error('lightbox2_box_color', t('You must enter a properly formed hex value.'));
+      }
+
+      if (!_lightbox2_validate_hex_color($font_hex_colour)) {
+        form_set_error('lightbox2_font_color', t('You must enter a properly formed hex value.'));
+      }
+
+      if (!empty($top_position) && (!is_numeric($top_position) || $top_position < 0)) {
+        form_set_error('lightbox2_top_position', t('You must enter a size greater than 0 pixels.  Leave blank for default positioning.'));
+      }
+
+      if (!is_numeric($resize_speed) || $resize_speed <= 0 || $resize_speed >= 10) {
+        form_set_error('lightbox2_resize_speed', t('You must enter a duration between 0 and 10 seconds.'));
+      }
+
+      if (!is_numeric($fadein_speed) || $fadein_speed < 0 || $fadein_speed >= 10) {
+        form_set_error('lightbox2_fadein_speed', t('You must enter a duration between 0 and 10 seconds.'));
+      }
+
+      if (!is_numeric($slide_down_speed) || $slide_down_speed <= 0 || $slide_down_speed >= 10) {
+        form_set_error('lightbox2_slidedown_speed', t('You must enter a duration between 0 and 10 seconds.'));
+      }
+    }
+  }
+}
+
+/**
+ * Submit function for the general configuration form.
+ */
+function lightbox2_general_settings_form_submit($form, &$form_state) {
+  cache_clear_all();
+}
+
+/**
+ * Configuration form for controlling the slideshow behaviour.
+ */
+function lightbox2_slideshow_settings_form() {
+
+  // Add the javascript which disables / enables form elements.
+  drupal_add_js(drupal_get_path('module', 'lightbox2') . '/js/lightbox2.js', 'module');
+
+  // Set up a hidden variable.
+  $form['lightbox2_lite'] = array(
+    '#type' => 'hidden',
+    '#value' => variable_get('lightbox2_lite', FALSE),
+  );
+
+
+  // Add text box for slideshow interval.
+  $form['lightbox2_slideshow_interval'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Interval seconds'),
+    '#description' => t('The slideshow interval is the length of time in seconds an image is visible before the slideshow shows the next image.'),
+    '#default_value' => variable_get('lightbox2_slideshow_interval', 5),
+    '#size' => 20,
+  );
+
+   // Add checkbox for slideshow automatic start.
+  $form['lightbox2_slideshow_automatic_start'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Automatically start slideshow'),
+    '#description' => t('When enabled the slideshow will automatically start.'),
+    '#default_value' => variable_get('lightbox2_slideshow_automatic_start', TRUE),
+  );
+
+  // Add checkbox for slideshow automatic exit.
+  $form['lightbox2_slideshow_automatic_exit'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Automatically exit slideshow'),
+    '#description' => t('When enabled the lightbox will automatically close after displaying the last image.'),
+    '#default_value' => variable_get('lightbox2_slideshow_automatic_exit', TRUE),
+  );
+
+  // Add checkbox for showing hte play / pause button.
+  $form['lightbox2_slideshow_show_play_pause'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Show play / pause button'),
+    '#description' => t('When enabled, a play / pause button will be shown in the slideshow allowing the user more control over their viewing experience.'),
+    '#default_value' => variable_get('lightbox2_slideshow_show_play_pause', TRUE),
+  );
+
+  // Add checkbox for "pausing on next click".
+  $form['lightbox2_slideshow_pause_on_next_click'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Pause slideshow on "Next Image" click'),
+    '#description' => t('When enabled the slideshow is automatically paused, and the following image shown, when the "Next" button is clicked.'),
+    '#default_value' => variable_get('lightbox2_slideshow_pause_on_next_click', FALSE),
+  );
+
+  // Add checkbox for "pausing on prev click".
+  $form['lightbox2_slideshow_pause_on_previous_click'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Pause slideshow on "Previous Image" click'),
+    '#description' => t('When enabled the slideshow is automatically paused, and the previous image shown, when the "Previous" button is clicked.'),
+    '#default_value' => variable_get('lightbox2_slideshow_pause_on_previous_click', TRUE),
+  );
+
+  // Add checkbox for "looping through slides'.
+  $form['lightbox2_loop_slides'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Continuous loop'),
+    '#description' => t('When enabled the slideshow will automatically start over after displaying the last slide.  This prevents the slideshow from automatically exiting when enabled.'),
+    '#default_value' => variable_get('lightbox2_loop_slides', FALSE),
+  );
+
+  return system_settings_form($form);
+}
+
+/**
+ * Validation function for the slideshow configuration form.
+ *
+ * Ensure that the slideshow interval submitted is numeric.
+ */
+function lightbox2_slideshow_settings_form_validate($form, &$form_state) {
+  if (!is_numeric($form_state['values']['lightbox2_slideshow_interval'])) {
+    form_set_error('lightbox2_slideshow_interval', t('The "interval seconds" value must be numeric.'));
+  }
+}
+
+/**
+ * Configuration form for controlling the iframe behaviour.
+ */
+function lightbox2_iframe_settings_form() {
+
+  // Add the javascript which disables / enables form elements.
+  drupal_add_js(drupal_get_path('module', 'lightbox2') . '/js/lightbox2.js', 'module');
+
+  // Set up a hidden variable.
+  $form['lightbox2_lite'] = array(
+    '#type' => 'hidden',
+    '#value' => variable_get('lightbox2_lite', FALSE),
+  );
+
+
+  // Add text box for iframe width.
+  $form['lightbox2_default_frame_width'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Default width'),
+    '#description' => t('The default width of the iframe in pixels.'),
+    '#default_value' => variable_get('lightbox2_default_frame_width', 600),
+    '#size' => 20,
+  );
+
+  // Add text box for iframe height.
+  $form['lightbox2_default_frame_height'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Default height'),
+    '#description' => t('The default height of the iframe in pixels.'),
+    '#default_value' => variable_get('lightbox2_default_frame_height', 400),
+    '#size' => 20,
+  );
+
+  // Add option for iframe border.
+  $form['lightbox2_frame_border'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable border'),
+    '#description' => t('Enable iframe border.  You can modify the border style in your theme\'s css file using the iframe\'s id "lightboxFrame".'),
+    '#default_value' => variable_get('lightbox2_frame_border', 1),
+  );
+
+  return system_settings_form($form);
+}
+
+/**
+ * Validation function for the iframe configuration form.
+ *
+ * Ensure that the iframe width and height submitted are numeric.
+ */
+function lightbox2_iframe_settings_form_validate($form, &$form_state) {
+  if (!is_numeric($form_state['values']['lightbox2_default_frame_width'])) {
+    form_set_error('lightbox2_slideshow_interval', t('The "default width" value must be numeric.'));
+  }
+  if (!is_numeric($form_state['values']['lightbox2_default_frame_height'])) {
+    form_set_error('lightbox2_slideshow_interval', t('The "default height" value must be numeric.'));
+  }
+}
+
+
+/**
+ * Configuration form the automatic image handling functionality.
+ */
+function lightbox2_auto_image_handling_settings_form() {
+
+  // Add the javascript which disables / enables form elements.
+  drupal_add_js(drupal_get_path('module', 'lightbox2') . '/js/lightbox2.js', 'module');
+
+  // Set up a hidden variable.
+  $form['lightbox2_lite'] = array(
+    '#type' => 'hidden',
+    '#value' => variable_get('lightbox2_lite', FALSE),
+  );
+
+  $automatic_options = array(
+    0 => t('Disabled'),
+    1 => t('Lightbox'),
+    2 => t('Lightbox grouped'),
+    3 => t('Slideshow'),
+    4 => t('HTML content'),
+    5 => t('HTML content grouped'),
+  );
+
+  // Set image node options help text.
+  $form['image_node_options'] = array(
+    '#value' => t('These options allow automatic URL re-formatting of images.  This removes the need for you to add \'rel="lightbox"\' to each image link throughout your site.  You can select which image sizes will trigger the lightbox and configure a list of image CSS classes which should also have their URLs automatically re-formatted.  This feature is not available when using Lightbox2 Lite.'),
+  );
+
+  // Define handler settings fieldset.
+  /* --------------------------------- */
+  $form['handler_options'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Automatic handlers'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+  );
+
+  // Define image nodes settings fieldset.
+  /* ------------------------------------- */
+  $form['handler_options']['image_node_options'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Image node settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  // Add checkbox for image nodes.
+  $form['handler_options']['image_node_options']['lightbox2_image_node']  = array(
+    '#type' => 'select',
+    '#title' => t('Automatic handler for image nodes'),
+    '#options' => $automatic_options,
+    '#description' => t('Choose how URLs for image nodes will be automatically handled.'),
+    '#default_value' => variable_get('lightbox2_image_node', 0),
+  );
+
+  /*
+  // Add drop-down for list of available image sizes.
+  if (module_exists('image')) {
+    $sizes = image_get_sizes();
+    foreach ($sizes as $size_key => $size) {
+      if ($size_key == 'original' or $size_key == '_original')  {
+        $size_key = 'original';
+      }
+      $size_options[$size_key] = $size['label'];
+    }
+    $form['handler_options']['image_node_options']['lightbox2_display_image_size'] = array(
+      '#type' => 'select',
+      '#title' => t('Lightbox image display size'),
+      '#options' => $size_options,
+      '#default_value' => variable_get('lightbox2_display_image_size', 'original'),
+      '#description' => t('Select which image size will be loaded in the lightbox.  This only applies to images uploaded with the Image module.'),
+    );
+
+    $form['handler_options']['image_node_options']['lightbox2_trigger_image_size'] = array(
+      '#type' => 'select',
+      '#multiple' => TRUE,
+      '#title' => t('Image trigger size'),
+      '#options' => $size_options,
+      '#default_value' => variable_get('lightbox2_trigger_image_size', array('thumbnail')),
+      '#description' => t('Select which image size, when clicked on, will automatically trigger the lightbox.  This only applies to images uploaded with the Image module.'),
+    );
+
+  }
+  */
+
+  // Add checkbox for disabling lightbox for gallery lists.
+  $form['handler_options']['image_node_options']['lightbox2_disable_nested_galleries']  = array(
+    '#type' => 'checkbox',
+    '#title' => t('Disable lightbox for gallery lists'),
+    '#description' => t('Checking this box will disable the lightbox for images in gallery lists.  This means it is possible to open a gallery by clicking on the teaser image, but the lightbox will still appear when viewing images within the gallery.  This only applies to image galleries created with the "image gallery" module.'),
+    '#default_value' => variable_get('lightbox2_disable_nested_galleries', TRUE),
+  );
+
+  // Define flickr fieldset.
+  /* ----------------------- */
+  $form['handler_options']['flickr_options'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Flickr images'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+  // Add checkbox for flickr image support.
+  $form['handler_options']['flickr_options']['lightbox2_flickr'] = array(
+    '#type' => 'select',
+    '#title' => t('Automatic handler for Flickr images'),
+    '#options' => $automatic_options,
+    '#description' => t('Choose how URLs for Flickr images will be automatically handled.'),
+    '#default_value' => variable_get('lightbox2_flickr', 0),
+  );
+
+  // Define gallery2 fieldset.
+  /* ------------------------- */
+  $form['handler_options']['gallery2_options'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Gallery2 images'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+  // Add checkbox for gallery2 block image support.
+  $form['handler_options']['gallery2_options']['lightbox2_gallery2_blocks'] = array(
+    '#type' => 'select',
+    '#title' => t('Automatic handler for Gallery2 block images'),
+    '#options' => $automatic_options,
+    '#description' => t('Choose how URLs for images, contained within Gallery2 image blocks, will be automatically handled.'),
+    '#default_value' => variable_get('lightbox2_gallery2_blocks', 0),
+  );
+
+  // Define inline fieldset.
+  /* ----------------------- */
+  $form['handler_options']['inline_options'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Inline module images'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+  // Add checkbox for inline image support.
+  $form['handler_options']['inline_options']['lightbox2_inline'] = array(
+    '#type' => 'select',
+    '#title' => t('Automatic handler for Inline module images'),
+    '#options' => $automatic_options,
+    '#description' => t('Choose how URLs for Inline module images will be automatically handled.'),
+    '#default_value' => variable_get('lightbox2_inline', 0),
+  );
+
+  // Define image assist fieldset.
+  /* ----------------------------- */
+  $form['handler_options']['img_assist_options'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Image Assist images'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+  // Add checkbox for image assist custom size images.
+  $form['handler_options']['img_assist_options']['lightbox2_image_assist_custom'] = array(
+    '#type' => 'select',
+    '#title' => t('Automatic handler for Image Assist custom size images'),
+    '#options' => $automatic_options,
+    '#description' => t('Choose how URLs for custom size images, displayed by the Image Assist module, will be automatically handled.'),
+    '#default_value' => variable_get('lightbox2_image_assist_custom', 0),
+  );
+
+  // Define custom fieldset.
+  /* ----------------------- */
+  $form['handler_options']['custom_options'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Custom class images'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+  // Add checkbox for custom class image support.
+  $form['handler_options']['custom_options']['lightbox2_custom_class_handler'] = array(
+    '#type' => 'select',
+    '#title' => t('Automatic handler for custom class images'),
+    '#options' => $automatic_options,
+    '#description' => t('Choose how URLs for custom class images will be automatically handled.'),
+    '#default_value' => variable_get('lightbox2_custom_class_handler', 0),
+  );
+  // Add text box for custom trigger classes.
+  $form['handler_options']['custom_options']['lightbox2_custom_trigger_classes'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Custom image trigger classes'),
+    '#description' => t('List the image classes which should trigger the lightbox when clicked on.  Put each class on a separate line.'),
+    '#default_value' => variable_get('lightbox2_custom_trigger_classes', ''),
+  );
+
+  // Add checkbox for disabling lightbox for acidfree gallery lists.
+  if (module_exists("acidfree")) {
+    // Define acidfree settings fieldset.
+    /* ---------------------------------- */
+    $form['handler_options']['lightbox2_acidfree_options'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Acidfree settings'),
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+    );
+    $form['handler_options']['lightbox2_acidfree_options']['lightbox2_disable_nested_acidfree_galleries'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Disable lightbox for Acidfree gallery lists'),
+      '#description' => t('Checking this box will disable the lightbox for images in gallery lists.  This means it is possible to open a gallery by clicking on the teaser image, but the lightbox will still appear when viewing images within the gallery.  This only applies to image galleries created with the "acidfree" module.'),
+      '#default_value' => variable_get('lightbox2_disable_nested_acidfree_galleries', TRUE),
+    );
+    // Add checkbox for enabling lightbox for acidfree videos.
+    if (module_exists("video")) {
+      $form['handler_options']['lightbox2_acidfree_options']['lightbox2_enable_acidfree_videos'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Enable lightbox for Acidfree videos'),
+        '#description' => t('Checking this box will enable the display of acidfree videos in a lightbox.  This only applies to videos created by the "video" module and which appear in an acidfree gallery.'),
+        '#default_value' => variable_get('lightbox2_enable_acidfree_videos', FALSE),
+      );
+    }
+  }
+
+  return system_settings_form($form);
+}
+
+/**
+ * Validate a hex color value.
+ *
+ * @param $hex
+ *   The hex color string to validate.
+ * @return
+ *   TRUE if $hex is a valid hex color value.
+ */
+function _lightbox2_validate_hex_color($hex) {
+  return preg_match('!^[a-f0-9]{3}([a-f0-9]{3})?$!i', $hex);
+}
+

+ 632 - 0
sites/all/modules/lightbox2/lightbox2.formatter.inc

@@ -0,0 +1,632 @@
+<?php
+// $Id: lightbox2.formatter.inc,v 1.1.2.30 2010/09/22 10:47:15 snpower Exp $
+
+/**
+ * @file
+ * Lightbox2 formatter hooks and callbacks.
+ */
+
+
+/**
+ * Theme function for displaying the lightbox2 trigger image in an imagefield.
+ *
+ * @param $path
+ *   The path to the image to be displayed.
+ * @param $alt
+ *   The image alternative text.
+ * @param $title
+ *   The image title.
+ * @param $attributes
+ *   An array of image attributes, e.g. class name.
+ * @return
+ *   HTML output for displaying the image.
+ */
+function theme_lightbox2_image($variables) {
+  $path = $variables['path'];
+  $item = $variables['item'];
+  $image_style = $variables['image_style'];
+  $node_id = $variables['node_id'];
+  $field_name = $variables['field_name'];
+
+  if (!$variables["lightbox_style"]) {
+    $path['path'] = file_create_url($item['uri']);
+  }
+  else {
+    $path['path'] = image_style_url($variables["lightbox_style"],  $item['uri']);
+  }
+
+  // Lightbox type
+  $rel = $variables['lightbox_type'];
+
+  // Grouping
+  $rel .= '[';
+  $group = variable_get('lightbox2_image_group_node_id', 1);
+
+  switch ($group) {
+    // No groups
+    case '0':
+      break;
+    // Group by field name
+    case '1':
+      $rel .= $field_name;
+      break;
+    // Group by node id
+    case '2':
+      $rel .= $node_id;
+      break;
+    // Group by field name and node id
+    case '3':
+      $rel .= $field_name . '_' . $node_id;
+      break;
+    // All nodes and fields in same group
+    case '4':
+      $rel .= 'group';
+      break;
+  }
+  $rel .= ']';
+
+  // Title Start
+  $rel .= '[' . $item['title'];
+
+  // Download Link
+  if (user_access('download original image')) {
+    $rel .= '<p><a href="' . file_create_url($item['uri']) . '">' . variable_get('lightbox2_download_link_text', 'Download Original') . '</a></p>';
+  }
+  
+  // Title End
+  $rel .= ']';
+
+  $path['options']['attributes']['rel'] = $rel;
+  $path['options']['attributes']['title'] = $item['title'];
+  
+  return theme('image_formatter', array( 'item' => $item, 'path' => $path, 'image_style' => $image_style ) );
+}
+
+/**
+ * Handler for Lightbox2 display of imagecache + imagefield CCK fields.
+ *
+ * The compact view shows only the first image in a multiple imagefield but
+ * shows all images in the lightbox.
+ *
+ * @param $element
+ *   The CCK field element.
+ * @return
+ *   HTML output for displaying the image and link.
+ */
+/*function theme_lightbox2_formatter_imagefield($variables) {
+  $element = $variables['element'];
+  if (!module_exists("image")) {
+   return;
+  }
+
+  $field_name = $element['#field_name'];
+  $item = $element['#item'];
+  $formatter = $element['#formatter'];
+  $node = node_load($element['#item']['nid']);
+
+  if (strpos($formatter, '__lightbox2__') !== FALSE || strpos($formatter, '__lightshow2__') !== FALSE || strpos($formatter, '__lightframe2__') !== FALSE
+    || strpos($formatter, '__lightbox2_compact__') !== FALSE || strpos($formatter, '__lightshow2_compact__') !== FALSE || strpos($formatter, '__lightframe2_compact__') !== FALSE) {
+    list($tmp, $lightbox_type, $view_preset, $lightbox_preset) = explode('__', $formatter, 4);
+    return lightbox2_imagefield_image_imagecache($field_name, $item, $formatter, $node, $view_preset, $lightbox_preset);
+  }
+}*/
+
+/**
+ * Function to set up the data needed for
+ * theme_imagefield_image_imagecache_lightbox2().
+ *
+ * @param $field_name
+ *   The field name the action is being performed on.
+ * @param $item
+ *   An array, keyed by column, of the data stored for this item in this field.
+ * @param $formatter
+ *   The formatter to use for the field.
+ * @param $node
+ *   The node object.
+ * @param $view_preset
+ *   The imagecache preset to be displayed on the node or in the view.
+ * @param $lightbox_preset
+ *   The imagecache preset to be displayed in the lightbox.
+ * @return
+ *   The themed imagefield + imagecache image and link.
+ */
+/*function lightbox2_imagefield_image_imagecache($variables) {
+  $field_name = $variables['field_name'];
+  $item = $variables['item'];
+  $formatter = $variables['formatter'];
+  $node = $variables['node'];
+  $view_preset = $variables['view_preset'];
+  $lightbox_preset = $variables['lightbox_preset'];
+  // Load file data if missing
+  if (!isset($item['filepath']) && !empty($item['fid'])) {
+    $file = field_file_load($item['fid']);
+    $item = array_merge($item, (array)$file);
+  }
+  elseif (!isset($item['filepath'])) {
+    // No file in field, return.
+    return '';
+  }
+
+  $args['lightbox_preset'] = $lightbox_preset;
+
+  // Check view_preset for existence.
+  $rules = array();
+  if (function_exists('imagecache_presets')) {
+    $presets = imagecache_presets();
+    foreach ($presets as $preset_id => $preset_info) {
+      $rules[$preset_id] = $preset_info['presetname'];
+    }
+  }
+  else {
+    $rules = _imagecache_get_presets();
+  }
+  if ($view_preset == 'link' || $view_preset == 'original' || in_array($view_preset, (array) $rules)) {
+    $rel = 'lightbox';
+    if (strpos($formatter, '__lightshow2__') !== FALSE) {
+      $rel = 'lightshow';
+    }
+    elseif (strpos($formatter, '__lightshow2_compact__') !== FALSE) {
+      $rel = 'lightshow';
+      $args['compact'] = TRUE;
+    }
+    elseif (strpos($formatter, '__lightframe2__') !== FALSE) {
+      $rel = 'lightframe';
+    }
+
+    // Check if this is a compact display.
+    list($tmp, $lightbox_type, $tmp) = explode('__', $formatter, 3);
+    if ($lightbox_type == 'lightbox2_compact') {
+      $args['compact'] = TRUE;
+    }
+    return theme('imagefield_image_imagecache_lightbox2', array( 'view_preset' => $view_preset, 'field_name' => $field_name, 'item' => $item, 'node' => $node, 'rel' => $rel, 'args' => $args ) );
+  }
+}
+
+/**
+ * Generate the HTML output for imagefield + imagecache images so they can be
+ * opened in a lightbox by clicking on the image on the node page or in a view.
+ *
+ * This actually also handles filefields + imagecache images too.
+ *
+ * @param $view_preset
+ *   The imagecache preset to be displayed on the node or in the view.
+ * @param $field_name
+ *   The field name the action is being performed on.
+ * @param $item
+ *   An array, keyed by column, of the data stored for this item in this field.
+ * @param $node
+ *   The node object.
+ * @param $rel
+ *   The type of lightbox to open: lightbox, lightshow or lightframe.
+ * @param $args
+ *   Args may override internal processes: caption, rel_grouping.
+ * @return
+ *   The themed imagefield + imagecache image and link.
+ */
+/*function theme_imagefield_image_imagecache_lightbox2($variables) {
+  $view_preset = $variables['view_preset'];
+  $field_name = $variables['field_name'];
+  $item = $variables['item'];
+  $node = $variables['node'];
+  $rel = $variables['rel'];
+  $args = $variables['args'];
+  if (!isset($args['lightbox_preset'])) {
+    $args['lightbox_preset'] = 'original';
+  }
+  // Can't show current node page in a lightframe on the node page.
+  // Switch instead to show it in a lightbox.
+  $on_image_node = (arg(0) == 'node') && (arg(1) == $node->nid);
+  if ($rel == 'lightframe' && $on_image_node) {
+    $rel = 'lightbox';
+  }
+  $orig_rel = $rel;
+
+  // Unserialize into original - if sourced by views.
+  $item_data = $item['data'];
+  if (is_string($item['data'])) {
+    $item_data = unserialize($item['data']);
+  }
+
+  // Set up the title.
+  $image_title = $item_data['description'];
+  $image_title = (!empty($image_title) ? $image_title : $item_data['title']);
+  $image_title = (!empty($image_title) ? $image_title : $item_data['alt']);
+  if (empty($image_title) || variable_get('lightbox2_imagefield_use_node_title', FALSE)) {
+    $node = node_load($node->nid);
+    $image_title = $node->title;
+  }
+
+  $image_tag_title = '';
+  if (!empty($item_data['title'])) {
+    $image_tag_title = $item_data['title'];
+  }
+
+
+  // Enforce image alt.
+  $image_tag_alt = '';
+  if (!empty($item_data['alt'])) {
+    $image_tag_alt = $item_data['alt'];
+  }
+  elseif (!empty($image_title)) {
+    $image_tag_alt = $image_title;
+  }
+
+  // Set up the caption.
+  $node_links = array();
+  if (!empty($item['nid'])) {
+    $attributes = array();
+    $attributes['id'] = 'lightbox2-node-link-text';
+    $target = variable_get('lightbox2_node_link_target', FALSE);
+    if (!empty($target)) {
+      $attributes['target'] = $target;
+    }
+    $node_link_text = variable_get('lightbox2_node_link_text', 'View Image Details');
+    if (!$on_image_node && !empty($node_link_text)) {
+      $node_links[] = l($node_link_text, 'node/'. $item['nid'], array('attributes' => $attributes));
+    }
+    $download_link_text = check_plain(variable_get('lightbox2_download_link_text', 'Download Original'));
+    if (!empty($download_link_text) && user_access('download original image')) {
+      $node_links[] = l($download_link_text, file_create_url($item['filepath']), array('attributes' => array('target' => '_blank', 'id' => 'lightbox2-download-link-text')));
+    }
+  }
+
+  $caption = $image_title;
+  if (count($node_links)) {
+    $caption .= '<br /><br />'. implode(" - ", $node_links);
+  }
+  if (isset($args['caption'])) {
+    $caption = $args['caption']; // Override caption.
+  }
+
+  if ($orig_rel == 'lightframe') {
+    $frame_width = variable_get('lightbox2_default_frame_width', 600);
+    $frame_height = variable_get('lightbox2_default_frame_height', 400);
+    $frame_size = 'width:'. $frame_width .'px; height:'. $frame_height .'px;';
+    $rel = preg_replace('/\]$/', "|$frame_size]", $rel);
+  }
+
+  // Set up the rel attribute.
+  $full_rel = '';
+  $imagefield_grouping = variable_get('lightbox2_imagefield_group_node_id', 1);
+  if (isset($args['rel_grouping'])) {
+    $full_rel = $rel .'['. $args['rel_grouping'] .']['. $caption .']';
+  }
+  elseif ($imagefield_grouping == 1) {
+    $full_rel = $rel .'['. $field_name .']['. $caption .']';
+  }
+  elseif ($imagefield_grouping == 2 && !empty($item['nid'])) {
+    $full_rel = $rel .'['. $item['nid'] .']['. $caption .']';
+  }
+  elseif ($imagefield_grouping == 3 && !empty($item['nid'])) {
+    $full_rel = $rel .'['. $field_name .'_'. $item['nid'] .']['. $caption .']';
+  }
+  elseif ($imagefield_grouping == 4 ) {
+    $full_rel = $rel .'[allnodes]['. $caption .']';
+  }
+  else {
+    $full_rel = $rel .'[]['. $caption .']';
+  }
+  $class = '';
+  if ($view_preset != 'original') {
+    $class = 'imagecache imagecache-' . $field_name . ' imagecache-' . $view_preset . ' imagecache-' . $field_name . '-' . $view_preset;
+  }
+  $link_attributes = array(
+    'rel' => $full_rel,
+    'class' => 'imagefield imagefield-lightbox2 imagefield-lightbox2-' . $view_preset . ' imagefield-' . $field_name . ' ' . $class,
+  );
+
+  $attributes = array();
+  if (isset($args['compact']) && $item['#delta']) {
+    $image = '';
+  }
+  elseif ($view_preset == 'original') {
+    $image = theme('lightbox2_image', array( 'path' => $item['filepath'], 'alt' => $image_tag_alt, 'title' => $image_tag_title, 'attributes' => $attributes ) );
+  }
+  elseif ($view_preset == 'link') {
+    // Not actually an image, just a text link.
+    $image = variable_get('lightbox2_view_image_text', 'View image');
+  }
+  else {
+     $image = theme('imagecache', array( 'style_name' => $view_preset, 'path' => $item['filepath'], 'alt' => $image_tag_alt, 'title' => $image_tag_title, 'attributes' => $attributes ) );
+  }
+
+  if ($args['lightbox_preset'] == 'node') {
+    $output = l($image, 'node/'. $node->nid .'/lightbox2', array('attributes' => $link_attributes, 'html' => TRUE));
+  }
+  elseif ($args['lightbox_preset'] == 'original') {
+    $output = l($image, file_create_url($item['filepath']), array('attributes' => $link_attributes, 'html' => TRUE));
+  }
+  else {
+    $output = l($image, imagecache_create_url($args['lightbox_preset'], $item['filepath']), array('attributes' => $link_attributes, 'html' => TRUE));
+  }
+  return $output;
+}*/
+
+
+/**
+ * Theme function for the lightbox iframe filefield formatter.
+ *
+ * @param $element
+ *   The CCK field element.
+ * @return
+ *   The themed link to the file, with lightframe support.
+ */
+/*function theme_lightbox2_formatter_filefield_lightframe($variables) {
+  $element = $variables['element'];
+  $file = $element['#item'];
+  $field = content_fields($element['#field_name']);
+  if (!filefield_view_access($field['field_name']) || empty($file['list'])) {
+    return '';
+  }
+  if (empty($file['fid']) || !is_file($file['filepath'])) {
+    return '';
+  }
+  $file = (object)$file;
+  if (!lightbox2_check_filefield_extension($file, $field)) {
+    return '';
+  }
+  drupal_add_css(drupal_get_path('module', 'filefield') .'/filefield.css');
+   return '<div class="filefield-item">'. theme('lightbox2_file_formatter_lightbox2_iframe', array( 'file' => $file, 'field' => $field, 'file_formatter_settings' => NULL ) ) .'</div>';
+}*/
+
+/**
+ * Theme function for the lightbox iframe filefield formatter.
+ *
+ * @param $file
+ *   Filefield file object.
+ * @param $field
+ *   The CCK field the action is being performed on.
+ * @param $file_formatter_settings
+ *   File formatter settings; ignored.
+ * @return
+ *   Themed link to filefield.
+ */
+/*function theme_lightbox2_file_formatter_lightbox2_iframe($variables) {
+  $file = $variables['file'];
+  $field = $varbiables['field'];
+  $file_formatter_settings = $variables['file_formatter_settings'];
+  $path = $file->filepath;
+  $url = file_create_url($path);
+  $icon = theme('file_icon', array( 'file' => $file ) );
+  $file_data = $file->data;
+  if (is_string($file_data)) {
+    $file_data = unserialize($file->data);
+  }
+  $description = $file_data['description'];
+  if (empty($description)) {
+    $description = $file->filename;
+  }
+  $attributes = array();
+  $attributes['id'] = 'lightbox2-node-link-text';
+  $target = variable_get('lightbox2_node_link_target', FALSE);
+  if (!empty($target)) {
+    $attributes['target'] = $target;
+  }
+  $node_link = '';
+  $node_link_text = check_plain(variable_get('lightbox2_node_link_text', 'View Image Details'));
+  if (!empty($node_link_text)) {
+    $node_link .= '<br /><br />'. l($node_link_text, $url, array('attributes' => $attributes));
+  }
+
+  // Only files with supported extensions make it this far, so no need to check here.
+  $link_attributes = array('rel' => 'lightframe[]['. $description . $node_link .']');
+
+  return '<div class="filefield-formatter-lightbox2-iframe">'. $icon . l($description, $url, array('attributes' => $link_attributes)) .'</div>';
+}*/
+
+/**
+ * Generate the HTML output to open embedded cck images in a lightbox.
+ *
+ * @param $element
+ *   The CCK field element.
+ * @return
+ *   The themed link to the embedded image.
+ */
+/*function theme_lightbox2_formatter_emimage($variables) {
+  $element = $variables['element'];
+  $field = content_fields($element['#field_name'], $element['#type_name']);
+  $item = $element['#item'];
+  $formatter = $element['#formatter'];
+  $node = node_load($element['#node']->nid);
+
+  list($tmp, $lightbox_type) = explode('_', $formatter, 2);
+  $field['lightbox_type'] = $lightbox_type;
+  $formatter = "emimage";
+
+  return module_invoke('emfield', 'emfield_field_formatter', $field, $item, $formatter, $node, 'lightbox2');
+}*/
+
+/**
+ * Generate the HTML output to open embedded cck images in a lightbox.
+ *
+ * @param $field
+ *   The CCK field the action is being performed on.
+ * @param $item
+ *   An array, keyed by column, of the data stored for this item in this field.
+ * @param $formatter
+ *   The formatter to use for the field.
+ * @param $node
+ *   The node object.
+ * @param $args
+ *   Args may override internal processes: caption, rel_grouping.
+ * @return
+ *   Themed embedded media field image and link.
+ */
+/*function theme_lightbox2_emimage($variables) {
+  $field = $variables['field'];
+  $item = $variables['item'];
+  $formatter = $variables['formatter'];
+  $node = $variables['node'];
+  $args = $variables['args'];
+
+  $lightbox_type = $field['lightbox_type'];
+
+  if ($item['value'] && $item['provider']) {
+    $rel = 'lightbox';
+    if ($lightbox_type == 'lightshow2') {
+      $rel = 'lightshow';
+    }
+    elseif ($lightbox_type == 'lightframe2') {
+      $rel = 'lightframe';
+    }
+    if ($rel == 'lightframe' && arg(0) == 'node' && arg(1) == $node->nid) {
+      $rel = 'lightbox';
+    }
+    $orig_rel = $rel;
+
+    $code = $item['value'];
+    $width = $field['widget']['thumbnail_width'] == '' ? variable_get('emimage_default_full_width', EMIMAGE_DEFAULT_FULL_WIDTH) : $field['widget']['thumbnail_width'];
+    $height = $field['widget']['thumbnail_height'] == '' ? variable_get('emimage_default_full_height', EMIMAGE_DEFAULT_FULL_HEIGHT) : $field['widget']['thumbnail_height'];
+    $link = $field['widget']['thumbnail_link'] ? $field['widget']['thumbnail_link'] : variable_get('emimage_default_thumbnail_link', EMIMAGE_DEFAULT_THUMBNAIL_LINK);
+    if ($link == EMIMAGE_LINK_CONTENT) {
+      $link = 'node/'. $node->nid;
+    }
+    elseif ($link == EMIMAGE_LINK_PROVIDER) {
+      $link = module_invoke('emfield', 'include_invoke', 'emimage', $item['provider'], 'embedded_link', $code, $item['data']);
+    }
+    else {
+      $link = NULL;
+    }
+    $attributes = array();
+    $attributes['id'] = 'lightbox2-node-link-text';
+    if ($width) {
+      $attributes['width'] = $width;
+    }
+    if ($height) {
+      $attributes['height'] = $height;
+    }
+    $target = variable_get('lightbox2_node_link_target', FALSE);
+    if (!empty($target)) {
+      $attributes['target'] = $target;
+    }
+
+    // Set up the title.
+    $title = module_invoke('emfield', 'include_invoke', 'emimage', $item['provider'], 'image_title', $code, $item['data']);
+
+    // Set up the caption.
+    $node_link = '';
+    $node_link_text = variable_get('lightbox2_node_link_text', 'View Image Details');
+    if (!empty($node_link_text) && !empty($link)) {
+      $node_link = '<br /><br />'. l($node_link_text, $link, array('attributes' => $attributes));
+    }
+    // @TODO original download link possible with emfield?
+
+    $caption = $title . $node_link;
+    if (isset($args['caption'])) {
+      $caption = $args['caption']; // Override caption.
+    }
+
+    // Set up url and image.
+    $url = module_invoke('emfield', 'include_invoke', 'emimage', $item['provider'], 'image_url', $code, $width, $height, "emimage", $field, $item, $node);
+    $image = theme('image', array( 'path' => $url, 'alt' => $title, 'title' => $title, 'attributes' => $attributes, 'getsize' => FALSE ) );
+
+    // Set up full rel attribute.
+    $image_grouping = variable_get('lightbox2_emimage_group_node_id', 1);
+    if ($image_grouping == 1) {
+      $full_rel = $rel .'['. $field['field_name'] .']['. $caption .']';
+    }
+    elseif ($image_grouping == 2 && !empty($node->nid)) {
+      $full_rel = $rel .'['. $node->nid .']['. $caption .']';
+    }
+    elseif ($image_grouping == 3 && !empty($node->nid)) {
+      $full_rel = $rel .'['. $field['field_name'] .'_'. $node->nid .']['. $caption .']';
+    }
+    elseif (isset($args['rel_grouping'])) {
+      $full_rel = $rel .'['. $args['rel_grouping'] .']['. $caption .']';
+    }
+    else {
+      $rel = $full_rel .'[]['. $caption .']';
+    }
+
+    if ($orig_rel != 'lightframe') {
+      $link_attributes = array('rel' => $full_rel);
+      $full_width = $field['widget']['full_width'] == '' ? variable_get('emimage_default_full_width', EMIMAGE_DEFAULT_FULL_WIDTH) : $field['widget']['full_width'];
+      $full_height = $field['widget']['full_height'] == '' ? variable_get('emimage_default_full_height', EMIMAGE_DEFAULT_FULL_HEIGHT) : $field['widget']['full_height'];
+      $full_image_url = module_invoke('emfield', 'include_invoke', 'emimage', $item['provider'], 'image_url', $code, $full_width, $full_height, "emimage", $field, $item, $node);
+      $output = l($image, $full_image_url, array('attributes' => $link_attributes, 'html' => TRUE));
+    }
+    else {
+      $frame_width = variable_get('lightbox2_default_frame_width', 600);
+      $frame_height = variable_get('lightbox2_default_frame_height', 400);
+      $frame_size = 'width:'. $frame_width .'px; height:'. $frame_height .'px;';
+      $full_rel = preg_replace('/\]\[/', "|$frame_size][", $full_rel);
+      $link_attributes = array('rel' => $full_rel);
+      $output = l($image, $link .'/lightbox2', array('attributes' => $link_attributes, 'html' => TRUE));
+    }
+  }
+
+  return $output;
+}*/
+
+/**
+ * Generate the HTML output to open embedded cck videos in a lightbox.
+ *
+ * @param $element
+ *   The CCK field element.
+ * @return
+ *   HTML output for displaying the video and link.
+ */
+/*function theme_lightbox2_formatter_emvideo_lightvideo($variables) {
+  $element = $variables['element'];
+  if (!variable_get('lightbox2_enable_video', FALSE)) {
+    return;
+  }
+  $field = content_fields($element['#field_name'], $element['#type_name']);
+  $item = $element['#item'];
+  $formatter = "emvideo";
+  $node = node_load($element['#node']->nid);
+
+  return module_invoke('emfield', 'emfield_field_formatter', $field, $item, $formatter, $node, 'lightbox2');
+}*/
+
+/**
+ * Generate the HTML output to open embedded cck videos in a lightbox.
+ *
+ * @param $field
+ *   The CCK field the action is being performed on.
+ * @param $item
+ *   An array, keyed by column, of the data stored for this item in this field.
+ * @param $formatter
+ *   The formatter to use for the field.
+ * @param $node
+ *   The node object.
+ * @param $options
+ *   Options array.
+ * @return
+ *   Themed link to the embedded media field video.
+ */
+/*function theme_lightbox2_emvideo($variables) {
+  $field = $variables['field'];
+  $item = $variables['item'];
+  $formatter = $variables['formatter'];
+  $node = $variables['node'];
+  $thumbnail = isset($options['thumbnail']) ? $options['thumbnail'] : theme('emvideo_video_thumbnail', $field, $item, 'video_thumbnail', $node, TRUE, $options);
+  // if options title set use that, otherwise use video title if set in node,
+  // otherwise try node title, then widget thumbnail setting and fallback to
+  // default string.
+  $title = isset($options['title']) ? $options['title'] : (isset($item['data']['emthumb']['emthumb_title']) ? $item['data']['emthumb']['emthumb_title'] : (isset($node->title) ? $node->title : (isset($field['widget']['thumbnail_link_title']) ? $field['widget']['thumbnail_link_title'] : variable_get('emvideo_default_thumbnail_link_title', t('See video')))));
+  
+  $destination = 'video-cck/lightbox2/'. $node->nid .'/'. $field['widget']['video_width'] .'/'. $field['widget']['video_height'] .'/'. $field['field_name'] .'/'. $item['provider'] .'/'. $item['value'];
+  $width = $field['widget']['video_width'] + 20;
+  $height = $field['widget']['video_height'] + 20;
+  if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)) {
+    $width = $field['widget']['video_width'] + 40;
+    $height = $field['widget']['video_height'] + 40;
+  }
+  $rel_full = 'lightframe['. $field['type_name'] . '|width:'. $width .'px; height:'. $height .'px; overflow:visible;]';
+
+  $attributes = array(
+    'attributes' => array(
+      'title' => $title,
+      'class' => $field['type_name'],
+      'rel' => $rel_full,
+    ),
+    'query' => NULL,
+    'fragment' => NULL,
+    'absolute' => FALSE,
+    'html' => TRUE,
+  );
+
+  $output = l($thumbnail, $destination, $attributes);
+  return $output;
+}*/

+ 26 - 0
sites/all/modules/lightbox2/lightbox2.info

@@ -0,0 +1,26 @@
+; $Id: lightbox2.info,v 1. 2011/01/17 11:51:34 snpower Exp $
+name = Lightbox2
+description = Enables Lightbox2 for Drupal
+core = 7.x
+package = User interface
+
+files[] = lightbox2.install
+files[] = lightbox2.module
+files[] = lightbox2.formatter.inc
+files[] = lightbox2.admin.inc
+
+configure = admin/config/user-interface/lightbox2
+
+; Information added by drupal.org packaging script on 2010-09-24
+version = "7.x-dev"
+core = "7.x"
+project = "lightbox2"
+
+
+
+; Information added by drupal.org packaging script on 2011-10-17
+version = "7.x-1.0-beta1"
+core = "7.x"
+project = "lightbox2"
+datestamp = "1318819001"
+

+ 68 - 0
sites/all/modules/lightbox2/lightbox2.insert.inc

@@ -0,0 +1,68 @@
+<?php
+// $Id: lightbox2.insert.inc,v 1.1.2.6 2010/09/22 10:47:15 snpower Exp $
+
+/**
+ * @file
+ * Lightbox2 support for Insert module.
+ */
+
+/**
+ * Implementation of hook_insert_styles().
+ */
+function lightbox2_insert_styles() {
+  $cck_formatters = lightbox2_field_formatter_info();
+  $insert_styles = array();
+  // Reformat CCK formatter ids as Insert style ids.
+  foreach ($cck_formatters as $formatter_id => $formatter_info) {
+    // Currently only the "imagefield--lightbox2" formatters are implemented as styles.
+    if (preg_match('/^imagefield__lightbox2__((?:_(?!_)|[^_])+)__((?:_(?!_)|[^_])+)$/', $formatter_id, $matches)) {
+      $style_id = 'lightbox2--' . $matches[1] . '--' . $matches[2];
+      $insert_styles[$style_id] = $formatter_info;
+    }
+  }
+  return $insert_styles;
+}
+
+/**
+ * Implementation of hook_insert_content().
+ */
+function lightbox2_insert_content($item, $style, $widget) {
+  if (preg_match('/^lightbox2--((?:-(?!-)|[^-])+)--((?:-(?!-)|[^-])+)$/', $style['name'], $matches)) {
+    $image_preset_name = $matches[1];
+    $link_preset_name = $matches[2];
+    return theme('lightbox2_insert_image', $item, $widget, 'view', $image_preset_name, $link_preset_name);
+  }
+  else {
+    return '';
+  }
+}
+
+/**
+ * Theme the content that will be inserted for Lightbox2 presets.
+ */
+function template_preprocess_lightbox2_insert_image(&$vars) {
+  if ($vars['image_preset_name'] != 'original') {
+    $filepath = imagecache_create_path($vars['image_preset_name'], $vars['item']['filepath']);
+  }
+  else {
+    $filepath = $vars['item']['filepath'];
+  }
+  $vars['url'] = insert_create_url($filepath);
+
+  if ($vars['link_preset_name'] != 'original') {
+    $linkpath = imagecache_create_path($vars['link_preset_name'], $vars['item']['filepath']);
+  }
+  else {
+    $linkpath = $vars['item']['filepath'];
+  }
+  $vars['linkurl'] = insert_create_url($linkpath);
+
+  $vars['download_link'] = '';
+  $download_link_text = check_plain(variable_get('lightbox2_download_link_text', 'Download Original'));
+  if (!empty($download_link_text) && user_access('download original image')) {
+    $vars['download_link'] = '<br /><br />' . l($download_link_text, $vars['linkurl'], array('attributes' => array('target' => '_blank', 'id' => 'lightbox2-download-link-text')));
+  }
+
+  $vars['class'] = !empty($vars['widget']['insert_class']) ? $vars['widget']['insert_class'] : '';
+}
+

+ 202 - 0
sites/all/modules/lightbox2/lightbox2.install

@@ -0,0 +1,202 @@
+<?php
+// $Id: lightbox2.install,v 1.1.4.4.2.49 2010/09/22 17:26:19 snpower Exp $
+
+/**
+ * @file
+ * Installation functions for Lightbox2.
+ */
+
+/**
+ * Implementation of hook_install().
+ */
+function lightbox2_install() {
+  module_invoke('content', 'clear_type_cache');
+}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function lightbox2_uninstall() {
+  // Delete the variables we created.
+  variable_del('lightbox2_plus');
+  variable_del('lightbox2G2_filter');
+
+  // Remove the general settings.
+  variable_del('lightbox2_lite');
+  variable_del('lightbox2_use_alt_layout');
+  variable_del('lightbox2_force_show_nav');
+  variable_del('lightbox2_loop_items');
+  variable_del('lightbox2_image_count_str');
+  variable_del('lightbox2_page_count_str');
+  variable_del('lightbox2_video_count_str');
+  variable_del('lightbox2_disable_resize');
+  variable_del('lightbox2_disable_zoom');
+  variable_del('lightbox2_enable_login');
+  variable_del('lightbox2_enable_contact');
+  variable_del('lightbox2_enable_video');
+  variable_del('lightbox2_flv_player_path');
+  variable_del('lightbox2_flv_player_flashvars');
+  variable_del('lightbox2_page_init_action');
+  variable_del('lightbox2_page_list');
+  variable_del('lightbox2_disable_these_urls');
+  variable_del('lightbox2_imagefield_group_node_id');
+  variable_del('lightbox2_imagefield_use_node_title');
+  variable_del('lightbox2_view_image_text');
+  variable_del('lightbox2_image_ncck_group_node_id');
+  variable_del('lightbox2_show_caption');
+  // Advanced settings.
+  variable_del('lightbox2_js_location');
+  variable_del('lightbox2_keys_close');
+  variable_del('lightbox2_keys_previous');
+  variable_del('lightbox2_keys_next');
+  variable_del('lightbox2_keys_zoom');
+  variable_del('lightbox2_keys_play_pause');
+  variable_del('lightbox2_top_position');
+  variable_del('lightbox2_border_size');
+  variable_del('lightbox2_box_color');
+  variable_del('lightbox2_font_color');
+  variable_del('lightbox2_overlay_opacity');
+  variable_del('lightbox2_overlay_color');
+  variable_del('lightbox2_disable_close_click');
+  variable_del('lightbox2_resize_sequence');
+  variable_del('lightbox2_resize_speed');
+  variable_del('lightbox2_fadein_speed');
+  variable_del('lightbox2_slidedown_speed');
+
+  // Remove iframe settings.
+  variable_del('lightbox2_default_frame_width');
+  variable_del('lightbox2_default_frame_height');
+  variable_del('lightbox2_frame_border');
+
+  // Remove slideshow settings.
+  variable_del('lightbox2_slideshow_interval');
+  variable_del('lightbox2_slideshow_automatic_start');
+  variable_del('lightbox2_slideshow_automatic_exit');
+  variable_del('lightbox2_slideshow_show_play_pause');
+  variable_del('lightbox2_slideshow_pause_on_next_click');
+  variable_del('lightbox2_slideshow_pause_on_previous_click');
+  variable_del('lightbox2_loop_slides');
+
+  // Remove the automatic image handling settings.
+  variable_del('lightbox2_image_node');
+  variable_del('lightbox2_display_image_size');
+  variable_del('lightbox2_trigger_image_size');
+  variable_del('lightbox2_disable_nested_galleries');
+  variable_del('lightbox2_flickr');
+  variable_del('lightbox2_gallery2_blocks');
+  variable_del('lightbox2_inline');
+  variable_del('lightbox2_image_assist_custom');
+  variable_del('lightbox2_custom_class_handler');
+  variable_del('lightbox2_custom_trigger_classes');
+  variable_del('lightbox2_node_link_text');
+  variable_del('lightbox2_download_link_text');
+  variable_del('lightbox2_node_link_target');
+  variable_del('lightbox2_show_caption');
+  variable_del('lightbox2_image_group');
+  variable_del('lightbox2_disable_nested_acidfree_galleries');
+  variable_del('lightbox2_acidfree_video');
+}
+
+/**
+ * One of the variables was renamed from 'lightbox2_plus' to 'lightbox2_lite'.
+ *
+ * Should have been created with lightbox2_update_600x() naming convention, but
+ * too late now.
+ */
+function lightbox2_update_1() {
+  $ret = array();
+  $ret[] = update_sql('UPDATE {variable} SET name="lightbox2_lite"
+    WHERE name="lightbox2_plus";');
+
+  return $ret;
+}
+
+/**
+ * 'lightbox2_image_group' variable has been removed and others need to be
+ * updated accordingly.
+ *
+ * Should have been created with lightbox2_update_600x() naming convention, but
+ * too late now.
+ */
+function lightbox2_update_2() {
+  $image_group = variable_get('lightbox2_image_group', TRUE);
+  $image_node = variable_get('lightbox2_image_node', TRUE);
+  $flickr = variable_get('lightbox2_flickr', TRUE);
+  $gallery2 = variable_get('lightbox2_gallery2_blocks', TRUE);
+  $inline = variable_get('lightbox2_inline', TRUE);
+  $image_assist = variable_get('lightbox2_image_assist_custom', TRUE);
+
+  if ($image_group) {
+    if ($image_node) {
+      variable_set('lightbox2_image_node', 2);
+    }
+    if ($flickr) {
+      variable_set('lightbox2_flickr', 2);
+    }
+    if ($gallery2) {
+      variable_set('lightbox2_gallery2_blocks', 2);
+    }
+    if ($inline) {
+      variable_set('lightbox2_inline', 2);
+    }
+    if ($image_assist) {
+      variable_set('lightbox2_image_assist_custom', 2);
+    }
+  }
+  variable_del('lightbox2_image_group');
+
+  return array();
+}
+
+/**
+ * 'lightbox2_disable_these_urls' was renamed to 'lightbox2_page_list'.
+ * 'lightbox2_page_init_action' was also added which determines whether the
+ * lightbox functionality should be enabled or disabled for the page list.
+ * 'lightbox2_disable_zoom' has been replaced by 'lightbox2_disable_resize'.
+ * 'lightbox2_disable_zoom' still exists but has a different meaning.
+ *
+ * Should have been created with lightbox2_update_600x() naming convention, but
+ * too late now.
+ */
+function lightbox2_update_3() {
+  $disabled_urls = variable_get('lightbox2_disable_these_urls', '');
+  variable_set('lightbox2_page_init_action', 'page_disable');
+  variable_set('lightbox2_page_list', $disabled_urls);
+  variable_del('lightbox2_disable_these_urls');
+
+  $disable_zoom = variable_get('lightbox2_disable_zoom', FALSE);
+  variable_set('lightbox2_disable_resize', $disable_zoom);
+  variable_set('lightbox2_disable_zoom', FALSE);
+
+  return array();
+}
+
+function lightbox2_update_6001() {
+  $size = variable_get('lightbox2_display_image_size', 'original');
+  if ($size == '') {
+    variable_set('lightbox2_display_image_size', 'original');
+  }
+  return array();
+}
+
+/**
+ * 'lightbox2_slideshow_pause_on_previous_click' was mis-named as
+ * 'lightbox2_slideshow_pause_on_prev_click'.
+ */
+function lightbox2_update_6002() {
+  $vars = variable_init();
+  if (array_key_exists('lightbox2_slideshow_pause_on_prev_click', $vars)) {
+    $value = $vars['lightbox2_slideshow_pause_on_prev_click'];
+    variable_set('lightbox2_slideshow_pause_on_previous_click', $value);
+    variable_del('lightbox2_slideshow_pause_on_prev_click');
+  }
+  return array();
+}
+
+/**
+ * Menu paths changed.
+ */
+function lightbox2_update_6003() {
+  return array();
+}
+

File diff suppressed because it is too large
+ 76 - 0
sites/all/modules/lightbox2/lightbox2.module


+ 47 - 0
sites/all/modules/lightbox2/lightbox2.views.inc

@@ -0,0 +1,47 @@
+<?php
+// $Id: lightbox2.views.inc,v 1.1.2.1 2009/09/05 09:52:26 snpower Exp $
+
+/**
+ * @file
+ * lightbox2.views.inc
+ */
+
+/**
+ * Implementation of hook_views_data()
+ */
+function lightbox2_views_data() {
+
+  $data['lightbox2']['table']['group'] = t('Lightbox');
+
+  $data['lightbox2']['table']['join'] = array(
+    '#global' => array(),
+  );
+
+  $data['lightbox2']['lightbox2'] = array(
+    'group' => t('Lightbox'),
+    'field' => array(
+      'title' => t('Lightbox trigger'),
+      'help' => t('Provide custom text or link.'),
+      'handler' => 'lightbox2_handler_field_lightbox2',
+    ),
+  );
+
+  return $data;
+}
+
+/**
+ * Implementation of hook_views_handlers() to register all of the basic handlers
+ * views uses.
+ */
+function lightbox2_views_handlers() {
+  return array(
+    'info' => array(
+      'path' => drupal_get_path('module', 'lightbox2'),
+    ),
+    'handlers' => array(
+      'lightbox2_handler_field_lightbox2' => array(
+        'parent' => 'views_handler_field',
+      ),
+    ),
+  );
+}

+ 152 - 0
sites/all/modules/lightbox2/lightbox2_handler_field_lightbox2.inc

@@ -0,0 +1,152 @@
+<?php
+/**
+ * @file
+ * Contain the integration with views
+ * A handler to provide a field that is completely custom by the administrator.
+ *
+ * @ingroup views_field_handlers
+ */
+class lightbox2_handler_field_lightbox2 extends views_handler_field {
+  function query() {
+    // Do nothing, as this handler does not need to do anything to the query itself.
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    $options['trigger_field'] = array('default' => '');
+    $options['popup'] = array('default' => '');
+    $options['caption'] = array('default' => '');
+    $options['rel_group'] = array('default' => TRUE);
+    $options['custom_group'] = array('default' => '');
+    $options['height'] = array('default' => '400px');
+    $options['width'] = array('default' => '600px');
+
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $fields = array('trigger_field' => t('<None>'));
+    foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) {
+      // We only use fields up to this one.  Obviously we can't use this handler
+      // as the trigger handler.
+      if ($field == $this->options['id']) {
+        break;
+      }
+
+      $fields[$field] = $handler->definition['title'];
+    }
+
+    $form['trigger_field'] = array(
+      '#type' => 'select',
+      '#title' => t('Trigger field'),
+      '#description' => t('Select the field that should be turned into the trigger for the lightbox.  Only fields that appear before this one in the field list may be used.'),
+      '#options' => $fields,
+      '#default_value' => $this->options['trigger_field'],
+      '#weight' => -12,
+    );
+
+    $form['popup'] = array(
+      '#type' => 'textarea',
+      '#title' => t('Popup'),
+      '#description' => t('Combine tokens from the "Replacement patterns" below and html to create what the lightbox popup will become.'),
+      '#default_value' => $this->options['popup'],
+      '#weight' => -11,
+    );
+
+    $form['caption'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Caption'),
+      '#description' => t('Combine tokens from the "Replacement patterns" below and html to create the caption shown under the lightbox. Leave empty for no caption.'),
+      '#default_value' => $this->options['caption'],
+      '#weight' => -10,
+    );
+
+    $form['rel_group'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Automatic generated Lightbox group'),
+      '#description' => t('Enable Lightbox grouping using a generated group name for this view.'),
+      '#default_value' => $this->options['rel_group'],
+      '#weight' => -9,
+    );
+
+    $form['custom_group'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Custom Lightbox group'),
+      '#description' => t('Enable Lightbox grouping with a given string as group. Overrides the automatically generated group name above.'),
+      '#default_value' => $this->options['custom_group'],
+      '#weight' => -8,
+    );
+
+    $form['height'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Height'),
+      '#description' => t('Specify the height of the lightbox2 popup window.  Because the content is dynamic, we cannot detect this value automatically.'),
+      '#default_value' => $this->options['height'],
+      '#weight' => -7,
+    );
+
+    $form['width'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Width'),
+      '#description' => t('Specify the width of the lightbox2 popup window.  Because the content is dynamic, we cannot detect this value automatically.'),
+      '#default_value' => $this->options['width'],
+      '#weight' => -6,
+    );
+
+
+
+    // Remove the checkboxs and other irrelevant controls.
+    unset($form['alter']['alter_text']);
+    unset($form['alter']['make_link']);
+    unset($form['alter']['text']);
+    unset($form['alter']['path']);
+    unset($form['alter']['alt']);
+    unset($form['alter']['prefix']);
+    unset($form['alter']['suffix']);
+    unset($form['alter']['text']['#dependency']);
+    unset($form['alter']['text']['#process']);
+  }
+
+  /**
+   * Render the trigger field and its linked popup information.
+   */
+  function render($values) {
+    // We need to have multiple unique IDs, one for each record.
+    static $i = 0;
+
+    static $link;
+
+    if (!empty($this->options['trigger_field'])) {
+
+      // We don't actually use the link, but we need it there for lightbox to function.
+      if (empty($link)) {
+        // Get the path name.
+        $path = isset($_GET['q']) ? $_GET['q'] : '<front>';
+        $link = url($path, array('absolute' => TRUE));
+      }
+
+      // Get the token information and generate the value for the popup and the
+      // caption.
+      $tokens = $this->get_render_tokens($this->options['alter']);
+      $popup = filter_xss_admin($this->options['popup']);
+      $caption = filter_xss_admin($this->options['caption']);
+      $popup = strtr($popup, $tokens);
+      $caption = strtr($caption, $tokens);
+
+      $i++;
+
+      // The outside div is there to hide all of the divs because if the specific lightbox
+      // div is hidden it won't show up as a lightbox.  We also specify a group
+      // in the rel attribute in order to link the whole View together for paging.
+      $group_name = !empty($this->options['custom_group']) ? $this->options['custom_group'] : ($this->options['rel_group'] ? 'lightbox-popup-' . $this->view->name . '-' . implode('/', $this->view->args) : '');
+      return "<a href='$link #lightbox-popup-{$i}'  rel='lightmodal[{$group_name}|width:" . ($this->options['width'] ? $this->options['width'] : '600px') . ';height:' . ($this->options['height'] ? $this->options['height'] : '600px') . "][" . $caption . "]'>" . $tokens["[{$this->options['trigger_field']}]"] . "</a>
+                <div style='display: none;'><div id='lightbox-popup-{$i}' class='lightbox-popup'>$popup</div></div>";
+    }
+    else {
+      return;
+    }
+  }
+}

+ 57 - 0
sites/all/modules/lightbox2/page--node--lightbox2.tpl.php

@@ -0,0 +1,57 @@
+<?php
+// $Id: page-node-lightbox2.tpl.php,v 1.1.2.2 2008/06/11 22:16:38 snpower Exp $
+
+/**
+ * @file
+ * Template file for displaying the node content, associated with an image, in
+ * the lightbox.  It displays it without any sidebars, etc.
+ */
+?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
+  <head>
+    <title><?php print $head_title ?></title>
+    <?php print $head ?>
+    <?php print $styles ?>
+    <?php print $scripts ?>
+    <!--[if lt IE 7]>
+      <?php print phptemplate_get_ie_styles(); ?>
+    <![endif]-->
+  </head>
+  <body>
+
+<!-- Layout -->
+
+    <div id="wrapper">
+    <div id="container" class="clear-block">
+
+
+      <div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner">
+<?php phptemplate_comment_wrapper(NULL, $node->type); ?>
+
+<?php if ($page == 0): ?>
+  <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
+<?php endif; ?>
+
+    <?php print $content ?>
+
+  <div class="clear-block clear">
+    <div class="meta">
+    <?php if ($taxonomy): ?>
+      <div class="terms"><?php print $terms ?></div>
+    <?php endif;?>
+    </div>
+
+    <?php if ($links): ?>
+      <div class="links"><?php print $links; ?></div>
+    <?php endif; ?>
+  </div>
+
+</div>
+</div>
+</div>
+</div>
+</div> <!-- close container -->
+</div> <!-- close wrapper -->
+</body>
+</html>

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