diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 995ab58..1aa4ed5 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,8 +1,3 @@
-6.x-2.6
--------
-* Slides no longer link to their node when using a single node slideshow (but
-  continue to link for nodequeue slideshows).
-
 6.x-2.5
 -------
 * Last release was pretty cocked up. Version number did not get updated.
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..2c095c8
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,274 @@
+GNU GENERAL PUBLIC LICENSE
+
+              Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
+Cambridge, MA 02139, 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 Library 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
diff --git a/arrows.png b/arrows.png
new file mode 100644
index 0000000..55bf116
Binary files /dev/null and b/arrows.png differ
diff --git a/css/fancy_slide.css b/css/fancy_slide.css
index 729b9ad..7cb7a0d 100644
--- a/css/fancy_slide.css
+++ b/css/fancy_slide.css
@@ -3,67 +3,232 @@
  */
  
 .fancy-slide {
-  margin: 0 auto;
+/*margin: 0 auto;*/
   overflow: hidden;
   position: relative;
+  background:#FFF;
+ /* background-image: -moz-linear-gradient(100% 100% 90deg, #B1B1B1, #E8E8E8);
+  background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#E8E8E8), to(#AAA));*/
+  border: 2px solid #F9F9F9;
+  -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
+  -webkit-box-shadow:  0 1px 3px rgba(0,0,0,0.5);
+  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
+  width:100%;
 }
-.fancy-slide ul{
+
+#main-column .fancy-slide,
+#top-page .fancy-slide  {
+	margin-left:-8px;
+}
+.block .fancy-slide ul {
   list-style:none;
+	padding:0;
+	margin:0;
+}
+
+.fancy-slide p {
+	margin:.25em 0;
+	line-height:1.25em;
 }
+
+/* =Description-box*/
+
 .fancy-slide ul li,
-.fancy-slide ul li a {
-  background: none;
-  display: block;
-  margin: 0;
-  padding: 0;
+.block.fancy-slide ul {
+	position:relative;
+	margin:0;
 }
 
-#controller{
-  background-color: #004477;
-  bottom: 0;
-  float:left;
-  padding: 10px;
-  position:absolute;
+.fancy-slide ul li img {
+	float:left;
+}
+
+.fancy-slide .slide-text {
+	background:#fff;
+	background:rgba(255, 255, 255, 0.9);
+	overflow:hidden;
+	z-index:1000;	
+	display:block;	
+	position:absolute;
+	font-size:.85em;
 }
 
-#controller .controls{
-  float:right;
+
+.slide-text-inner {
+	padding:10px;
+	float:left;
+/*	width:92%;
+	height:92%;	*/
 }
 
-#controller span,
-#controller p{
+/*.bottom .slide-text-inner {
+	width:96%;
+	height:96%;
+}*/
+
+.fancy-slide.right .slide-text {
+	border-left: 1px solid #E2E2E2;  
+	width:31%;
+	height:100%;
+	top:0;
+	right:0;
+	float:right;
+	}
+
+.fancy-slide.bottom .slide-text {
+	position:relative;
+	top:auto;
+	bottom:0px;
+	right:0px;
+	width:100%;
+	}
+
+/** VIEW MORE **/
+
+.fancy-slide.bottom .slide-text a.more-link,
+.fancy-slide .slide-text a.more-link,
+.fancy-slide .slide-text a.more-link:active  {
+	background:#484D4B url('../arrows.png') no-repeat right -35px;	
+	padding: 2px 30px 2px 10px;
+	font-weight:bold;
+	text-shadow: rgba(0, 0, 0, 0.246094) 0px -1px 1px;		
+	position:absolute;	
+	bottom:6px;
+	right:1em;
+	top:auto;
+/*	min-width:70px;*/
+	float:left;
+}
+
+.fancy-slide.bottom .slide-text a.more-link {
+	display:inline-block;
+	float:none;
+}
+.fancy-slide .slide-text a.more-link:hover {
+	background-color:#2E3130;
+	color:#fff;
+	}
+
+/* =Controller */
+
+.controller {
+  bottom: 12px;
+  position:absolute;
+}
+.controller .controls {
+  	float:left;
+	clear:both;
+}
+.slide-controller .controller {
+	top:40%;
+}
+.controller img {
+  float:left;
+  display:block;
+  overflow:hidden;
+}
+.controller span,
+.controller p {
   float:left;
   margin:4px 5px 0 0;
 }
-#controller span{
+.controller span {
   color:#fff;
   font-weight:bold;
 }
-#controller p{
-  color:#fff;
+.controller p {
+  	color:#fff;
+	font-size:.85em;
 }
-#controller p.active{
+.controller p.active {
   display:block;
+	float:right;
 }
-#controller p.inactive{
+.controller p.inactive {
   display:none;
 }
-
-#controller a{
-  border:1px solid #3399ff;
+.controller a {
   float:left;
-  margin-right:10px;
+  margin-left:10px;
+  width:3em;
+  height:2em;
+  position:relative;
 }
-#controller a:last-child{
+.controller a:last-child
+ {
   margin-right:0;
 }
-#controller a.active{
+.controller a.active {
   border-color:#fff;
 }
-#controller img{
-  float:left;
-  display:block;
-  width:40px;
-  height:30px;
-  overflow:hidden;
-}
\ No newline at end of file
+
+
+
+/* Shape Controller */
+.fancy-slide .controller.no-thumbnail a,
+.fancy-slide .controller.no-thumbnail a img {
+	border:0;
+	width:12px;
+	height:12px;
+	-moz-transition: all 0.5s ease-in-out;
+	-webkit-transition: all 0.5s ease-in-out;	
+	}
+.fancy-slide .controller.no-thumbnail a {
+	border:2px solid #E2E2E2;
+}	
+.fancy-slide .controller.no-thumbnail a:hover,
+.fancy-slide .controller.no-thumbnail a.active,
+.fancy-slide .controller.thumbnail a.active img,
+.fancy-slide .controller.thumbnail a:hover img  {
+	border:2px solid #fff;
+	-moz-transform:scale(1.2);
+	-webkit-transform:scale(1.2);
+}
+
+/*Thumbnail Controller */
+
+.fancy-slide .controller.thumbnail a img {
+	display:block;
+	width:3em;
+	height:2em;
+	border:2px solid #DEDEDE;
+	-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
+	-moz-transition: all 0.5s ease-in-out;
+	-webkit-transition: all 0.5s ease-in-out;
+}
+
+.fancy-slide .controller.thumbnail a:hover img {
+
+	-moz-transform:scale(1.2);
+	-webkit-transform:scale(1.2);		
+	-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
+	position:absolute;
+	
+	/*right:-0.8em;
+	top:-0.6em;
+	width:4em;
+	height:3em;	
+	z-index:3000;*/
+}	
+
+/* Fancy Slide BOTTOM */
+.fancy-slide.bottom .controller {
+}
+
+
+.fancy-slide.bottom.slide-controller .slide-text {
+	position:relative;
+	}	
+
+/*.fancy-slide.bottom .slide-text h2 {
+	display:inline;
+	max-width:30%;
+	float:left;
+	margin:0 1em 0 0;
+}*/
+
+.fancy-slide.bottom .slide-text p {
+	float:left;
+	width:100%;
+}		
+
diff --git a/fancy-slide.tpl.php b/fancy-slide.tpl.php
index da3fcda..ce372e7 100644
--- a/fancy-slide.tpl.php
+++ b/fancy-slide.tpl.php
@@ -6,7 +6,7 @@
  * Variables:
  */
 ?>
-<div id="fancy-slide-<?php print $sid; ?>" class="fancy-slide" style="<?php print $fancyslide_styles; ?>">
+<div id="fancy-slide-<?php print $sid; ?>" class="fancy-slide <?php print $fancyslide_classes; ?>" style="<?php print $fancyslide_styles; ?>">
   <ul>
     <?php foreach ($slides as $slide): ?>
       <li>
@@ -15,4 +15,4 @@
     <?php endforeach; ?>
   </ul>
   <script type="text/javascript"><?php print $fancyslide_js; ?></script>
-</div>
\ No newline at end of file
+</div>
diff --git a/fancy_slide.admin.inc b/fancy_slide.admin.inc
new file mode 100644
index 0000000..55323e1
--- /dev/null
+++ b/fancy_slide.admin.inc
@@ -0,0 +1,807 @@
+<?php
+/**
+ * @file
+ *    Admin functions for fancy slide
+ */
+
+/**
+ * Add a slideshow to the database.
+ * 
+ * @param $slide array
+ *    A slideshow array. For the format of this array
+ * @see fancy_slide_get()
+ */
+function fancy_slide_add($slide) {
+  // If we're adding a new slideshow, we can't have a sid, because this will
+  // be automatically assigned by the database.
+  if ($slide['sid']) {
+    unset($slide['sid']);
+  }
+  drupal_write_record('fancy_slide', $slide);
+}
+
+/**
+ * Update a slideshow in the database.
+ * 
+ * @param $slide array
+ *    The slideshow to be updated, with the appropriate details. For the format
+ *    of the array, see the documentation for fancy_slide_get.
+ * @see fancy_slide_get()
+ */
+function fancy_slide_update($slide) {
+  drupal_write_record('fancy_slide', $slide, 'sid');
+}
+
+/**
+ * Delete the specified slideshow.
+ * 
+ * @param $sid int
+ *    The ID of the slideshow.
+ */
+function fancy_slide_delete($sid) {
+  db_query("DELETE FROM {fancy_slide} WHERE sid = %d", $sid);
+  drupal_goto('admin/content/fancy-slide/view');
+}
+
+/**
+ * Autocomplete callback for the slideshow node selector.
+ * 
+ * @param $string string
+ *    The part of the node title to autocomplete.
+ */
+function fancy_slide_autocomplete_nid($string) {
+  $matches = array();
+  $types = variable_get('fancy_slide_node_type', 0);
+  $select = "SELECT nid, title FROM {node} WHERE LOWER(title) LIKE LOWER('%%%s%%')";
+  $args = array($string);
+  if ($types) {
+    $select .= ' AND type in (' . db_placeholders($types, 'varchar') . ')';
+    $args = array_merge($args, $types);
+  }
+  $result = db_query_range(
+    $select,
+    $args,
+    0, 10
+  );
+  
+  while ($row = db_fetch_object($result)) {
+    $matches[$row->title] = check_plain($row->title);
+  }
+  
+  print drupal_to_js($matches);
+  exit();
+}
+
+/*
+ * The form for global settings
+ *
+ */
+function fancy_slide_settings_form($form_state) {
+  $form = array();
+
+  $form['validation'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Validation'),
+    '#collapsible' => TRUE,
+  );
+
+  $max_height = variable_get('fancy_slide_max_height', NULL);
+  $form['validation']['max_height'] = array(
+    '#type'          => 'textfield',
+    '#title'         => t('Maximum height'),
+    '#description'   => t('The maximum height in pixels of a slideshow'),
+    '#maxlength'     => 4,
+    '#default_value' => $max_height,
+  );
+
+  $max_width = variable_get('fancy_slide_max_width', NULL);
+  $form['validation']['max_width'] = array(
+    '#type'          => 'textfield',
+    '#title'         => t('Maximum width'),
+    '#description'   => t('The maximum width in pixels of a slideshow'),
+    '#maxlength'     => 4,
+    '#default_value' => $max_width,
+  );
+
+  $form['overrides'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Overrides'),
+    '#collapsible' => TRUE,
+  );
+
+  $presets = variable_get('fancy_slide_presets', array());
+  $form['overrides']['presets'] = array(
+    '#type'          => 'textarea',
+    '#title'         => 'Size presets',
+    '#description'   => 'Define presets here one per line in the form WxHxP if you want users to pick from a fixed set of presets. W = Width, H = height, P = Imagecache preset name.',
+    '#default_value' => implode("\n", $presets),
+    '#size'          => 60,
+  );
+
+  $form['overrides']['imagecache'] = array(
+    '#type'          => 'checkbox',
+    '#title'         => 'Disable imagecache preset selection',
+    '#description'   => 'Turn off imagecache preset selection on the fancy slide edit form',
+    '#default_value' => variable_get('fancy_slide_disable_imagecache', 0),
+  );
+
+  $node_type = variable_get('fancy_slide_node_type', array());
+  foreach (node_get_types() as $type) {
+    $types[$type->type] = $type->name;
+  }
+  $form['overrides']['node_type'] = array(
+    '#type'          => 'checkboxes',
+    '#title'         => t('Node Types'),
+    '#description'   => t('The types of nodes that can be used for slideshows. If none are checked, all will be available.'),
+    '#options'       => $types,
+    '#default_value' => $node_type,
+  );
+
+  $field = variable_get('fancy_slide_field', 'none');
+  $fields = fancy_slide_options_fields();
+  $fields['none'] = 'N/A';
+  $form['overrides']['node_field'] = array(
+    '#type'           => 'select',
+    '#title'          => t('Content field'),
+    '#description'    => t('The field that contains the image. Bear in mind that this is a list of all fields, and not all fields will be on each node type, so you must make sure that you have chosen a field that appears on the type of node you\'re using, otherwise nothing will show up in the slideshow. If you specify a value here, it will override the same option on the main slideshow page.'),
+    '#options'        => $fields,
+    '#default_value'  => $field
+  );
+
+  $orientation = variable_get('fancy_slide_orientation', NULL);
+  $form['overrides']['orientation'] = array(
+    '#type'          => 'radios',
+    '#title'         => t('Fixed Orientation'),
+    '#description'   => t('If orientation is set here, it cannot be set on the edit page'),
+    '#options'       => array(NULL => t('N/A'), '0' => t('Horizontal'), '1' => t('Vertical')),
+    '#default_value' => $orientation,
+  );
+
+  $show_alt = variable_get('fancy_slide_show_alt', TRUE);
+  $form['overrides']['show_alt'] = array(
+    '#type'          => 'checkbox',
+    '#title'         => t('Allow showing alt text in controls'),
+    '#description'   => t('If this is off, users will not be able to choose to see alt text in slideshow controls'),
+    '#default_value' => $show_alt,
+  );
+
+  $form['defaults'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Default values'),
+    '#collapsible' => TRUE,
+  );
+
+  $form['defaults']['delay'] = array(
+    '#type'           => 'textfield',
+    '#title'          => t('Default delay between slides'),
+    '#description'    => t('The time in seconds that each slide should be displayed before advancing to the next. Set this to 0 to prevent the slides from advancing automatically.'),
+    '#maxlength'      => 3,
+    '#size'           => 5,
+    '#default_value'  => variable_get('fancy_slide_default_delay', ''),
+  );
+
+  $form['defaults']['text_overlay'] = array(
+    '#type'           => 'radios',
+    '#title'          => 'Default text overlay',
+    '#description'    => 'Show informational text with the image',
+    '#default_value'  => variable_get('fancy_slide_default_overlay', 0),
+    '#options'        => array(t('None'), t('Bottom'), t('Right')),
+  );
+
+  $form['defaults']['list_style'] = array(
+    '#type'           => 'radios',
+    '#title'          => 'Default list style',
+    '#description'    => 'The style of image list.',
+    '#default_value'  => variable_get('fancy_slide_default_style', 0),
+    '#options'        => array(t('Thumbnail'), t('Shape')),
+  );
+
+  $form['submit'] = array(
+    '#type'   => 'submit',
+    '#value'  => t('Save'),
+  );
+
+  return $form;
+}
+
+function fancy_slide_variable_set($name, $value, $int = TRUE) {
+  if (($int && (intval($value))) || (!$int && $value !== NULL)) {
+    variable_set($name, $value);
+  }
+  else {
+    variable_del($name);
+  }
+}
+
+function fancy_slide_settings_form_validate($form, &$form_state) {
+  if ($form_state['values']['presets']) {
+    foreach (explode("\n", trim($form_state['values']['presets'])) as $line) {
+      $dimensions = explode("x", trim($line));
+      if (count($dimensions) < 2 || !intval($dimensions[0]) || !intval($dimensions[1])) {
+        form_set_error('presets', t('Invalid dimension preset %preset', array('%preset' => $line)));
+      }
+      elseif (count($dimensions) == 3) {
+        $imagecache = imagecache_preset_by_name($dimensions[2]);
+        if (empty($imagecache)) {
+          form_set_error('presets', t('Invalid imagecache preset %preset', array('%preset' => $dimensions[2])));
+        }
+      }
+    }
+  }
+}
+
+/* 
+ * Submit function for the settings form
+ */
+function fancy_slide_settings_form_submit($form_id, &$form_state) {
+  fancy_slide_variable_set('fancy_slide_max_height', $form_state['values']['max_height']);
+  fancy_slide_variable_set('fancy_slide_max_width', $form_state['values']['max_width']);
+  if ($form_state['values']['presets']) {
+    $presets = array();
+    foreach (explode("\n", trim($form_state['values']['presets'])) as $line) {
+      $presets[] = trim($line);
+    }
+  }
+  fancy_slide_variable_set('fancy_slide_presets', $presets, FALSE);
+  if ($form_state['values']['node_type']) {
+    foreach ($form_state['values']['node_type'] as $name => $type) {
+      if ($type)
+        $types[] = $type;
+    }
+  }
+  fancy_slide_variable_set('fancy_slide_node_type', $types, FALSE);
+  fancy_slide_variable_set('fancy_slide_orientation', $form_state['values']['orientation'], FALSE);
+  fancy_slide_variable_set('fancy_slide_field', $form_state['values']['node_field'], FALSE);
+  fancy_slide_variable_set('fancy_slide_show_alt', $form_state['values']['show_alt'], FALSE);
+  fancy_slide_variable_set('fancy_slide_disable_imagecache', $form_state['values']['imagecache'], FALSE);
+  fancy_slide_variable_set('fancy_slide_default_delay', $form_state['values']['delay'], FALSE);
+  fancy_slide_variable_set('fancy_slide_default_overlay', $form_state['values']['text_overlay'], FALSE);
+  fancy_slide_variable_set('fancy_slide_default_style', $form_state['values']['list_style'], FALSE);
+}
+
+/**
+ * The form for adding or editing a slideshow.
+ * 
+ * @param $sid int
+ *    The slideshow ID to edit. If not specified, a new slideshow will be
+ *    created.
+ */
+function fancy_slide_edit_form($form_state, $sid = 0) {
+  drupal_add_js(drupal_get_path('module', 'fancy_slide') . '/js/fancy_slide.admin.js');
+  drupal_add_css(drupal_get_path('module', 'fancy_slide') . '/css/fancy_slide.admin.css');
+  
+  if ($sid) {
+    $slideshow = fancy_slide_get($sid);
+  }
+  
+  $form = array();
+  
+  $form['#redirect'] = 'admin/content/fancy-slide/view';
+
+  $form['basics'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Basic Settings'),
+    '#collapsible' => TRUE,
+  );
+
+  $form['basics']['sid'] = array(
+    '#type'           => 'hidden',
+    '#value'          => $sid ? $sid : '0',
+  );
+  $form['basics']['slideshow_name'] = array(
+    '#type'           => 'textfield',
+    '#title'          => t('Slideshow name'),
+    '#description'    => t('Enter a name for the slideshow.'),
+    '#required'       => TRUE,
+    '#maxlength'      => 128,
+    '#default_value'  => $slideshow['name'],
+  );
+
+  // Don't bother showing this if there is only one option
+  $types = fancy_slide_options_types();
+  if (count($types) > 2) {
+    $form['basics']['type'] = array(
+      '#type'           => 'radios',
+      '#title'          => t('Type of slideshow'),
+      '#description'    => t('Choose the type of slideshow. This will determine where the images are drawn from.'),
+      '#required'       => TRUE,
+      '#options'        => $types,
+      '#default_value'  => $slideshow['type'],
+    );
+  }
+  $form['basics']['node'] = array(
+    '#type'               => 'textfield',
+    '#title'              => t('Node'),
+    '#description'        => t('The node that contains all the images for the slideshow. Begin typing the node\'s title to autocomplete it.'),
+    '#autocomplete_path'  => 'fancy-slide/autocomplete-nid',
+    '#default_value'      => $slideshow['nid'] ? $slideshow['node_title'] : '',
+  );
+  if (module_exists('nodequeue')) {
+    $form['basics']['nodequeue'] = array(
+      '#type'           => 'select',
+      '#title'          => t('Nodequeue'),
+      '#description'    => t('Select the nodequeue that contains the nodes whose images you want to display.'),
+      '#options'        => fancy_slide_options_nodequeues(),
+      '#default_value'  => $slideshow['nodequeue'],
+    );
+  }
+
+  // Only show this if it's not overriden
+  $field = variable_get('fancy_slide_field', 'none');
+  if ($field == 'none') {
+    $form['basics']['slidefield'] = array(
+      '#type'           => 'select',
+      '#title'          => t('Slideshow field'),
+      '#description'    => t('The field that contains the image. Bear in mind that this is a list of all fields, and not all fields will be on each node type, so you must make sure that you have chosen a field that appears on the type of node you\'re using, otherwise nothing will show up in the slideshow. If you are using a single node type slideshow, this field is expected to contain multiple images. Otherwise, if the field contains multiple images, only the first will be used.'),
+      '#options'        => fancy_slide_options_fields(),
+      '#default_value'  => $slideshow['field'],
+    );
+  }
+
+  $presets = variable_get('fancy_slide_presets', NULL);
+  $dimensions = $slideshow['width'] ? $slideshow['width'] . 'x' . $slideshow['height'] : '';
+  $preset = $slideshow['preset'];
+  if ($presets) {
+    // Add existing dimensions to take care of existing slideshows
+    if ($dimensions) {
+      $ic = imagecache_preset($preset);
+      if (in_array($dimensions . 'x' . $ic['presetname'], $presets)) {
+        $dimensions .= 'x' . $ic['presetname'];
+      }
+      if (!in_array($dimensions, $presets)) {
+        $presets[] = $dimensions;
+      }
+    }
+    foreach ($presets as $preset) {
+      $options[$preset] = $preset;
+    }
+    $form['basics']['dimensions'] = array(
+      '#type'           => 'select',
+      '#title'          => t('Dimensions'),
+      '#description'    => t('Choose a dimension preset'),
+      '#options'        => $options,
+      '#default_value'  => $dimensions,
+    );
+  }
+  else {
+    $max_height = variable_get('fancy_slide_max_height', 2048);
+    $max_width = variable_get('fancy_slide_max_width', 2048);
+    $form['basics']['dimensions'] = array(
+      '#type'           => 'textfield',
+      '#title'          => t('Dimensions'),
+      '#description'    => t('Enter a width and height in pixels, such as 860x352. Width must be between 64 and !width. Height must be between 27 and !height.', array('!width' => $max_width, '!height' => $max_height)),
+      '#maxlength'      => 9,
+      '#default_value'  => $dimensions,
+    );
+  }
+
+  if (!variable_get('fancy_slide_disable_imagecache', 0) && module_exists('imagecache')) {
+    $form['basics']['preset'] = array(
+      '#type'           => 'select',
+      '#title'          => t('Imagecache preset'),
+      '#description'    => t('The imagecache preset used to automatically resize the slides in this slideshow. The preset should contain a scale operation (such as scale and crop) that ensures the width and height of the image matches the width and height of the slideshow, or some of the image might be obscured.'),
+      '#options'        => fancy_slide_options_presets(),
+      '#default_value'  => $slideshow['preset'],
+    );
+  }
+
+  $form['display'] = array(
+    '#type' => 'fieldset',
+    '#title' => 'Display Settings',
+    '#collapsible' => TRUE,
+  );
+
+  $form['display']['animation'] = array(
+    '#type'           => 'radios',
+    '#title'          => t('Animation'),
+    '#description'    => t('Choose the transition betwen slides in the slideshow. Note that this might still be used even if you set the duration to 0, because a user can still change slides manually.'),
+    '#required'       => TRUE,
+    '#options'        => array(
+      'fade'  => t('Fade'),
+      'slide' => t('Slide'),
+    ),
+    '#default_value'  => $slideshow['animation'] ? $slideshow['animation'] : 'fade',
+  );
+
+  $form['display']['delay'] = array(
+    '#type'           => 'textfield',
+    '#title'          => t('Delay between slides'),
+    '#description'    => t('The time in seconds that each slide should be displayed before advancing to the next. Set this to 0 to prevent the slides from advancing automatically.'),
+    '#maxlength'      => 3,
+    '#size'           => 5,
+    '#required'       => TRUE,
+    '#default_value'  => $slideshow['delay'] != NULL ? $slideshow['delay'] : variable_get('fancy_slide_default_delay', ''),
+  );
+
+  if ($form['display']['delay']['#default_value']) {
+    $form['display']['#collapsed'] = TRUE;
+  }
+
+  $form['display']['transition_speed'] = array(
+    '#type'           => 'textfield',
+    '#title'          => t('Transition speed'),
+    '#description'    => t('The time in milliseconds that the animation takes to transit from one slide to the next. 1000 is equal to one second.'),
+    '#maxlength'      => 5,
+    '#size'           => 7,
+    '#required'       => TRUE,
+    '#default_value'  => $slideshow['transition_speed'] ? $slideshow['transition_speed'] : 1000,
+  );
+
+  $form['display']['continuous'] = array(
+    '#type'           => 'checkbox',
+    '#title'          => t('Continuous'),
+    '#description'    => t('If checked, the slideshow will return to the first slide once the last slide is reached. If not checked, the slideshow will end once the last slide has been reached.'),
+    '#default_value'  => $slideshow['continuous'],
+  );
+
+  $orientation = variable_get('fancy_slide_orientation', -1);
+  if ($orientation == -1) {
+    $form['display']['vertical'] = array(
+      '#type'           => 'radios',
+      '#title'          => t('Slideshow orientation'),
+      '#description'    => t('If horizontal, the slides will animate horizontally as though they are side by side. If vertical, the slides will animate vertically as though they are on top of one another.'),
+      '#required'       => TRUE,
+      '#options'        => array('0' => t('Horizontal'), '1' => t('Vertical')),
+      '#default_value'  => $slideshow['vertical'],
+    );
+  }
+
+  $form['display']['randomize'] = array(
+    '#type'           => 'checkbox',
+    '#title'          => 'Randomize images',
+    '#description'    => 'Sort images into a random order for display',
+    '#default_value'  => $slideshow['randomize'],
+  );
+
+  $form['overlays'] = array(
+    '#type' => 'fieldset',
+    '#title' => 'Controls and Overlays',
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  $form['overlays']['show_controls'] = array(
+    '#type'           => 'checkbox',
+    '#title'          => t('Show controls'),
+    '#description'    => t('If checked, the control strip will appear, showing the image alternate text (description) (if the show alt text option is selected) and a set of thumbnails allowing the manual selection of slides.'),
+    '#default_value'  => $slideshow['show_controls'],
+  );
+  $form['overlays']['slide_controls'] = array(
+    '#type'           => 'checkbox',
+    '#title'          => t('Slide controls'),
+    '#description'    => t('If checked, the control strip will slide in when the mouse is moved over the slideshow, and slide out again when the mouse is moved away. If unchecked, the controls will always be visible. Note that if the controls are turned off altogether, this option will have no effect.'),
+    '#default_value'  => $slideshow['slide_controls'],
+  );
+  $form['overlays']['text_overlay'] = array(
+    '#type'           => 'radios',
+    '#title'          => 'Text overlay',
+    '#description'    => 'Show informational text with the image',
+    '#default_value'  => $slideshow['text_overlay'] !== NULL ? $slideshow['text_overlay'] : variable_get('fancy_slide_default_overlay', 0),
+    '#options'        => array(t('None'), t('Bottom'), t('Right')),
+  );
+  $form['overlays']['list_style'] = array(
+    '#type'           => 'radios',
+    '#title'          => 'List style',
+    '#description'    => 'The style of image list.',
+    '#default_value'  => $slideshow['list_style'] !== NULL ? $slideshow['list_style'] : variable_get('fancy_slide_default_style', 0),
+    '#options'        => array(t('Thumbnail'), t('Shape')),
+  );
+  $show_alt = variable_get('fancy_slide_show_alt', FALSE);
+  if ($show_alt) {
+    $form['overlays']['show_alt'] = array(
+      '#type'           => 'checkbox',
+      '#title'          => 'Show alt text in controls',
+      '#description'    => 'Show the alt text for the image as part of the controls section',
+      '#default_value'  => $slideshow['show_alt'],
+    );
+  }
+  $form['submit'] = array(
+    '#type'   => 'submit',
+    '#value'  => $sid ? t('Update') : t('Add'),
+  );
+  
+  return $form;
+}
+
+/**
+ * Validate handler for fancy_slide_edit_form().
+ */
+function fancy_slide_edit_form_validate($form_id, &$form_state) {
+  $form_state['values']['slideshow_name'] = check_plain($form_state['values']['slideshow_name']);
+  
+  $match = preg_match('/([0-9]{1,4})x([0-9]{1,4})/', $form_state['values']['dimensions'], $matches);
+
+  if (!$match) {
+    form_set_error('dimensions', t('Dimensions must be in the form 640x480 (numbers, followed by the x character, followed by more numbers.'));
+  }
+  $width = intval($matches[1]);
+  $height = intval($matches[2]);
+  $max_width = variable_get('fancy_slide_max_width', 2048);
+  $max_height = variable_get('fancy_slide_max_height', 2048);
+  if ($width < 64 || $width > $max_width) {
+    form_set_error('dimensions', t('Width must be between 64 and !width', array('!width' => $max_width)));
+  }
+  if ($height < 64 || $height > $max_height) {
+    form_set_error('dimensions', t('Height must be between 64 and !height', array('!height' => $max_height)));
+  }
+
+  $match = preg_match('/[0-9]{1,4}x[0-9]{1,4}x(.*)/', $form_state['values']['dimensions'], $matches);
+  if ($match) {
+    $form_state['values']['preset'] = $matches[1];
+  }
+  // Ensure that the imagecache preset is valid.
+  if (module_exists('imagecache') && $form_state['values']['preset']) {
+    if (is_numeric($form_state['values']['preset'])) {
+      $ic = imagecache_preset($form_state['values']['preset']);
+    }
+    else {
+      $ic = imagecache_preset_by_name($form_state['values']['preset']);
+      if (count($ic)) {
+        $form_state['values']['preset'] = $ic['presetid'];
+      }
+    }
+    if (!count($ic)) {
+      form_set_error('preset', t('Please choose a valid imagecache preset or choose not to use imagecache'));
+    }
+  }
+  
+  $showtype = $form_state['values']['type'];
+  
+  // If the slideshow is a single type, make sure that the node exists.
+  if ($showtype == FANCY_SLIDE_TYPE_SINGLE) {
+    $nid = db_result(db_query(
+      "SELECT nid FROM {node} WHERE title = '%s'", $form_state['values']['node']
+    ));
+    
+    if (!$nid) {
+      form_set_error('nid', t('The node %node was not found.', array('%node', $form_state['values']['node'])));
+    }
+  }
+  // If the slideshow is a nodequeue type, make sure a nodequeue is selected and
+  // actually exists.
+  elseif ($showtype == FANCY_SLIDE_TYPE_NODEQUEUE) {
+    $sqid_ok = TRUE;    
+    $sqid = $form_state['values']['nodequeue'];
+    
+    if (!$sqid) {
+      $sqid_ok = FALSE;
+    }
+    else {
+      // Look up the nodequeue to make sure it exists.
+      $queue = db_result(db_query(
+        "SELECT title FROM {nodequeue_subqueue} WHERE sqid = %d", $sqid
+      ));
+      
+      if (!$queue) {
+        $sqid_ok = FALSE;
+      }
+    }
+    
+    if (!$sqid_ok) {
+      form_set_error('nodequeue', t('You must select a valid nodequeue. If there are no nodequeues, you will need to !addlink.', array('!addlink', l(t('add one first'), 'admin/content/nodequeue/add/nodequeue'))));
+    }
+  }
+  
+  // Make sure that the selected field actually exists.
+  if (isset($form_state['values']['slidefield']) && !in_array($form_state['values']['slidefield'], array_keys(content_fields()))) {
+    form_set_error('slidefield', t('The field %field does not exist.', array('%field', $form_state['values']['slidefield'])));
+  }
+  
+  // Make sure the slideshow delay is numeric and greater than 0.
+  $delay = $form_state['values']['delay'];
+  
+  if (!is_numeric($delay) || $delay < 0 || $delay > 999) {
+    form_set_error('delay', t('Please enter a number between 0 and 999.'));
+  }
+  
+  // Make sure the transition speed is numeric and greater than 0.
+  $speed = $form_state['values']['transition_speed'];
+  
+  if (!is_numeric($speed) || $speed < 0 || $speed > 99999) {
+    form_set_error('delay', t('Please enter a number between 0 and 99999.'));
+  }
+  
+}
+
+function fancy_slide_edit_form_submit($form_id, &$form_state) {
+  $slide = array();
+  
+  if ($form_state['values']['sid']) {
+    $slide['sid'] = $form_state['values']['sid'];
+  }
+  
+  $slide['name'] = $form_state['values']['slideshow_name'];
+  list($slide['width'], $slide['height']) = explode('x', $form_state['values']['dimensions']);
+  if (isset($form_state['values']['type'])) {
+    $slide['type'] = $form_state['values']['type'];
+  }
+  else {
+    $types = fancy_slide_options_types();
+    $slide['type'] = $types[0];
+  }
+  $slide['animation'] = $form_state['values']['animation'];
+  $slide['nodequeue'] = $form_state['values']['nodequeue'];
+  if (isset($form_state['values']['slidefield'])) {
+    $slide['field'] = $form_state['values']['slidefield'];
+  }
+  else {
+    $slide['field'] = variable_get('fancy_slide_field', 'none');
+  }
+  $slide['delay'] = $form_state['values']['delay'];
+  $slide['preset'] = $form_state['values']['preset'];
+  if (isset($form_state['values']['vertical'])) {
+    $slide['vertical'] = $form_state['values']['vertical'];
+  }
+  else {
+    $slide['vertical'] = variable_get('fancy_slide_orientation', 1);
+  }
+  $slide['continuous'] = $form_state['values']['continuous'];
+  $slide['transition_speed'] = $form_state['values']['transition_speed'];
+  $slide['show_controls'] = $form_state['values']['show_controls'];
+  $slide['slide_controls'] = $form_state['values']['slide_controls'];
+  if ($slide['slide_controls'] && !$slide['show_controls']) {
+    $slide['show_controls'] = 1;
+    drupal_set_message(t('You chose to slide controls, but chose not to show controls, so show controls has been turned on for you'));
+  }
+  $slide['text_overlay'] = $form_state['values']['text_overlay'];
+  $slide['list_style'] = $form_state['values']['list_style'];
+  if (isset($form_state['values']['show_alt'])) {
+    $slide['show_alt'] = $form_state['values']['show_alt'];
+  }
+  else {
+    $slide['show_alt'] = FALSE;
+  }
+  $slide['randomize'] = $form_state['values']['randomize'];
+  
+  if ($title = $form_state['values']['node']) {
+    $slide['nid'] = db_result(db_query_range(
+      "SELECT nid FROM {node} WHERE title = '%s'", $title, 0, 1
+    ));
+  }
+  
+  if ($slide['sid']) {
+    fancy_slide_update($slide);
+  }
+  else {
+    fancy_slide_add($slide);
+  }
+}
+
+function fancy_slide_form() {
+  $form = array();
+  $slideshows = fancy_slide_get_all();
+  $slidetypes = fancy_slide_options_types();
+  
+  foreach ($slideshows as $key => $slideshow) {
+    $form['slidename'][$key] = array('#value' => $slideshow['name']);
+    $form['dimensions'][$key] = array('#value' => $slideshow['width'] . 'x' . $slideshow['height']);
+    $form['type'][$key] = array('#value' => $slidetypes[$slideshow['type']]);
+    
+    switch ($slideshow['type']) {
+      default:
+      case FANCY_SLIDE_TYPE_SINGLE:
+        $form['nodeinfo'][$key] = array('#value' => t('Node:') . ' ' . $slideshow['node_title']);
+        break;
+        
+      case FANCY_SLIDE_TYPE_NODEQUEUE:
+        $form['nodeinfo'][$key] = array('#value' => t('Nodequeue:') . ' ' . $slideshow['nodequeue_title']);
+        break;
+    }
+  }
+  
+  return $form;
+}
+
+/**
+ * Generate a list of CCK fields suitable for use on a FAPI form.
+ */
+function fancy_slide_options_fields() {
+  $fields = content_fields();
+  $myfields = array();
+  
+  foreach ($fields as $key => $field) {
+    $myfields[$key] = $field['widget']['label'] . ' (' . $key . ')';
+  }
+  
+  // If there are no CCK fields yet, warn the user by adding a single row to the
+  // select element.
+  if (!count($myfields)) {
+    $myfields['null'] = t('No fields');
+  }
+  
+  return $myfields;
+}
+
+/**
+ * Generate a list of nodequeues suitable for use on a FAPI form.
+ */
+function fancy_slide_options_nodequeues() {
+  $nodequeues = array();
+  $result = db_query(
+    "SELECT sqid, title FROM {nodequeue_subqueue} ORDER BY title ASC"
+  );
+  
+  while ($row = db_fetch_object($result)) {
+    $nodequeues[$row->sqid] = $row->title;
+  }
+  
+  // If there are no nodequeues, display a single entry in the select list to
+  // warn the user.
+  if (!count($nodequeues)) {
+    $nodequeues[0] = t('No nodequeues found');
+  }
+  
+  return $nodequeues;
+}
+
+/**
+ * Generate a list of imagecache presets suitable for use on a FAPI form.
+ */
+function fancy_slide_options_presets() {
+  $presets = imagecache_presets();
+  $output = array();
+  $output[0] = t('Do not use imagecache');
+  
+  foreach ($presets as $preset) {
+    $output[$preset['presetid']] = $preset['presetname'];
+  }
+  
+  return $output;
+}
+
+/**
+ * Generates a set of slideshow types suitable for use on a FAPI form.
+ */
+function fancy_slide_options_types() {
+  $types = array();
+  $types[FANCY_SLIDE_TYPE_SINGLE] = t('Single node');
+  
+  if (module_exists('nodequeue')) {
+    $types[FANCY_SLIDE_TYPE_NODEQUEUE] = t('Nodequeue');
+  }
+  
+  return $types;
+}
+
+/**
+ * Theme function for the FAPI form fancy_slide_form().
+ */
+function theme_fancy_slide_form($form) {
+  $header = array(
+    t('Name'),
+    t('Dimensions'),
+    t('Type'),
+    t('Source'),
+    t('Operations'),
+  );
+  $rows = array();
+  $slideshows = fancy_slide_get_all();
+  
+  foreach ($slideshows as $key => $slideshow) {
+    $row = array();
+    $row[] = drupal_render($form['slidename'][$key]);
+    $row[] = drupal_render($form['dimensions'][$key]);
+    $row[] = drupal_render($form['type'][$key]);
+    $row[] = drupal_render($form['nodeinfo'][$key]);
+
+    $links = array(
+      l(
+        t('edit'),
+        'admin/content/fancy-slide/edit/' . $key,
+        array('attributes' => array('title' => t('Edit this slideshow')))
+      ),
+      l(
+        t('delete'),
+        'admin/content/fancy-slide/delete/' . $key,
+        array('attributes' => array('title' => t('Delete this slideshow')))
+      ),
+    );
+    
+    $row[] = implode(' | ', $links);
+    
+    $rows[] = $row;
+  }
+  fancy_slide_render(1);
+  return theme('table', $header, $rows);
+}
+
diff --git a/fancy_slide.info b/fancy_slide.info
index 710bfdd..fe23e74 100644
--- a/fancy_slide.info
+++ b/fancy_slide.info
@@ -1,6 +1,13 @@
+; $Id: fancy_slide.info,v 1.2 2009/10/02 14:57:00 chriscohen Exp $
 name = Fancy Slide
 description = A configurable fancy-looking slideshow.
 core = 6.x
-version = 6.x-2.x-dev
+version = 6.x-2.6
 dependencies[] = content
-dependencies[] = imagefield
\ No newline at end of file
+dependencies[] = imagefield
+; Information added by drupal.org packaging script on 2009-10-02
+version = "6.x-2.6"
+core = "6.x"
+project = "fancy_slide"
+datestamp = "1254495648"
+
diff --git a/fancy_slide.install b/fancy_slide.install
index a632242..ceab077 100644
--- a/fancy_slide.install
+++ b/fancy_slide.install
@@ -139,6 +139,34 @@ function fancy_slide_schema() {
         'default'     => 0,
         'description' => $t('Whether or not the slideshow controls slide in and out on mouseover.'),
       ),
+      'text_overlay' => array(
+        'type'        => 'int',
+        'unsigned'    => TRUE,
+        'not null'    => TRUE,
+        'default'     => 0,
+        'description' => $t('Whether or not to show text overlay.'),
+      ),
+      'list_style' => array(
+        'type'        => 'int',
+        'unsigned'    => TRUE,
+        'not null'    => TRUE,
+        'default'     => 0,
+        'description' => $t('The style if image list to use.'),
+      ),
+      'show_alt' => array(
+        'type'        => 'int',
+        'unsigned'    => TRUE,
+        'not null'    => TRUE,
+        'default'     => 0,
+        'description' => $t('Whether or not to show alt text in controls.'),
+      ),
+      'randomize' => array(
+        'type'        => 'int',
+        'unsigned'    => TRUE,
+        'not null'    => TRUE,
+        'default'     => 0,
+        'description' => $t('Whether or not to randomize images.'),
+      ),
     ),
     'primary key' => array('sid'),
   );
@@ -220,4 +248,71 @@ function fancy_slide_update_6102() {
   );
   
   return $ret;
-}
\ No newline at end of file
+}
+
+/**
+ * Add optional text overlay and different list styles
+ */
+function fancy_slide_update_6103() {
+  $ret = array();
+  $t = get_t();
+  
+  db_add_field(
+    $ret,
+    'fancy_slide',
+    'text_overlay',
+    array(
+      'type'        => 'int',
+      'unsigned'    => TRUE,
+      'not null'    => TRUE,
+      'default'     => 0,
+      'description' => $t('Whether or not to show text overlay'),
+    )
+  );
+  db_add_field(
+    $ret,
+    'fancy_slide',
+    'list_style',
+    array(
+      'type'        => 'int',
+      'unsigned'    => TRUE,
+      'not null'    => TRUE,
+      'default'     => 0,
+      'description' => $t('The style of image list to use.'),
+    )
+  );
+  db_add_field(
+    $ret,
+    'fancy_slide',
+    'show_alt',
+    array(
+      'type'        => 'int',
+      'unsigned'    => TRUE,
+      'not null'    => TRUE,
+      'default'     => 0,
+      'description' => $t('Whether or not to show alt text in controls'),
+    )
+  );
+  return $ret;
+}
+
+/**
+ * Add option to randomize images
+ */
+function fancy_slide_update_6104() {
+  $ret = array();
+  $t = get_t();
+  db_add_field(
+    $ret,
+    'fancy_slide',
+    'randomize',
+    array(
+      'type'        => 'int',
+      'unsigned'    => TRUE,
+      'not null'    => TRUE,
+      'default'     => 0,
+      'description' => $t('Whether or not to randomize images'),
+    )
+  );
+  return $ret;
+}
diff --git a/fancy_slide.module b/fancy_slide.module
index 9c27c01..dc075c1 100644
--- a/fancy_slide.module
+++ b/fancy_slide.module
@@ -8,367 +8,6 @@ define('FANCY_SLIDE_TYPE_SINGLE', 0);
 define('FANCY_SLIDE_TYPE_NODEQUEUE', 1);
 
 /**
- * Add a slideshow to the database.
- * 
- * @param $slide array
- *    A slideshow array. For the format of this array, see the documentation for
- *    fancy_slide_get.
- * @see fancy_slide_get()
- */
-function fancy_slide_add($slide) {
-  // If we're adding a new slideshow, we can't have a sid, because this will
-  // be automatically assigned by the database.
-  if ($slide['sid']) {
-    unset($slide['sid']);
-  }
-  
-  drupal_write_record('fancy_slide', $slide);
-}
-
-/**
- * Autocomplete callback for the slideshow node selector.
- * 
- * @param $string string
- *    The part of the node title to autocomplete.
- */
-function fancy_slide_autocomplete_nid($string) {
-  $matches = array();
-  $result = db_query_range(
-    "SELECT nid, title FROM {node} WHERE LOWER(title) LIKE LOWER('%%%s%%')",
-    $string,
-    0, 10
-  );
-  
-  while ($row = db_fetch_object($result)) {
-    $matches[$row->title] = check_plain($row->title);
-  }
-  
-  print drupal_to_js($matches);
-  exit();
-}
-
-/**
- * Implementation of hook_block().
- */
-function fancy_slide_block($op = 'list', $delta = 0, $edit = array()) {
-  switch ($op) {
-    case 'list':
-      $blocks = array();
-      $slideshows = fancy_slide_get_all();
-      
-      // Generate a separate block for each slideshow so users can choose where
-      // they are placed.
-      foreach ($slideshows as $sid => $slideshow) {
-        $blocks[$sid]['info'] = t('Fancy Slide: ' . $slideshow['name']);
-      }
-
-      return $blocks;
-      
-    case 'view':
-      $slideshow = fancy_slide_get($delta);
-      
-      // Deal with a case where the delta does not refer to a valid slideshow.
-      if (!is_array($slideshow)) {
-        return array(
-          'subject' => t('Fancy Slide slideshow not found'),
-          'content' => t('The Fancy Slide slideshow with ID %id was not found.', array('%id' => $delta)),
-        );
-      }
-      
-      $block = array(
-        'subject' => $slideshow['name'],
-        'content' => theme('fancy_slide', $delta),
-      );
-      
-      return $block;
-  }
-}
-
-/**
- * Delete the specified slideshow.
- * 
- * @param $sid int
- *    The ID of the slideshow.
- */
-function fancy_slide_delete($sid) {
-  db_query("DELETE FROM {fancy_slide} WHERE sid = %d", $sid);
-  drupal_goto('admin/content/fancy-slide/view');
-}
-
-/**
- * The form for adding or editing a slideshow.
- * 
- * @param $sid int
- *    The slideshow ID to edit. If not specified, a new slideshow will be
- *    created.
- */
-function fancy_slide_edit_form($form_state, $sid = 0) {
-  drupal_add_js(drupal_get_path('module', 'fancy_slide') . '/js/fancy_slide.admin.js');
-  drupal_add_css(drupal_get_path('module', 'fancy_slide') . '/css/fancy_slide.admin.css');
-  
-  if ($sid) {
-    $slideshow = fancy_slide_get($sid);
-  }
-  
-  $form = array();
-  
-  $form['#redirect'] = 'admin/content/fancy-slide/view';
-  $form['sid'] = array(
-    '#type'           => 'hidden',
-    '#value'          => $sid ? $sid : '0',
-  );
-  $form['slideshow_name'] = array(
-    '#type'           => 'textfield',
-    '#title'          => t('Slideshow name'),
-    '#description'    => t('Enter a name for the slideshow.'),
-    '#required'       => TRUE,
-    '#maxlength'      => 128,
-    '#default_value'  => $slideshow['name'],
-  );
-  $form['dimensions'] = array(
-    '#type'           => 'textfield',
-    '#title'          => t('Dimensions'),
-    '#description'    => t('Enter a width and height in pixels, such as 860x352. Width must be between 64 and 2048. Height must be between 27 and 2048.'),
-    '#maxlength'      => 9,
-    '#default_value'  => $slideshow['width'] ? $slideshow['width'] . 'x' . $slideshow['height'] : '',
-  );
-  $form['type'] = array(
-    '#type'           => 'radios',
-    '#title'          => t('Type of slideshow'),
-    '#description'    => t('Choose the type of slideshow. This will determine where the images are drawn from.'),
-    '#required'       => TRUE,
-    '#options'        => fancy_slide_options_types(),
-    '#default_value'  => $slideshow['type'],
-  );
-  $form['nid'] = array(
-    '#type'               => 'textfield',
-    '#title'              => t('Node'),
-    '#description'        => t('The node that contains all the images for the slideshow. Begin typing the node\'s title to autocomplete it.'),
-    '#autocomplete_path'  => 'fancy-slide/autocomplete-nid',
-    '#default_value'      => $slideshow['nid'] ? $slideshow['node_title'] : '',
-  );
-  if (module_exists('nodequeue')) {
-    $form['nodequeue'] = array(
-      '#type'           => 'select',
-      '#title'          => t('Nodequeue'),
-      '#description'    => t('Select the nodequeue that contains the nodes whose images you want to display.'),
-      '#options'        => fancy_slide_options_nodequeues(),
-      '#default_value'  => $slideshow['nodequeue'],
-    );
-  }
-  $form['animation'] = array(
-    '#type'           => 'radios',
-    '#title'          => t('Animation'),
-    '#description'    => t('Choose the transition betwen slides in the slideshow. Note that this might still be used even if you set the duration to 0, because a user can still change slides manually.'),
-    '#required'       => TRUE,
-    '#options'        => array(
-      'fade'  => t('Fade'),
-      'slide' => t('Slide'),
-    ),
-    '#default_value'  => $slideshow['animation'] ? $slideshow['animation'] : 'fade',
-  );
-  $form['slidefield'] = array(
-    '#type'           => 'select',
-    '#title'          => t('Slideshow field'),
-    '#description'    => t('The field that contains the image. Bear in mind that this is a list of all fields, and not all fields will be on each node type, so you must make sure that you have chosen a field that appears on the type of node you\'re using, otherwise nothing will show up in the slideshow. If you are using a single node type slideshow, this field is expected to contain multiple images. Otherwise, if the field contains multiple images, only the first will be used.'),
-    '#options'        => fancy_slide_options_fields(),
-    '#default_value'  => $slideshow['field'],
-  );
-  $form['delay'] = array(
-    '#type'           => 'textfield',
-    '#title'          => t('Delay between slides'),
-    '#description'    => t('The time in seconds that each slide should be displayed before advancing to the next. Set this to 0 to prevent the slides from advancing automatically.'),
-    '#maxlength'      => 3,
-    '#size'           => 5,
-    '#required'       => TRUE,
-    '#default_value'  => $slideshow['delay'],
-  );
-  $form['transition_speed'] = array(
-    '#type'           => 'textfield',
-    '#title'          => t('Transition speed'),
-    '#description'    => t('The time in milliseconds that the animation takes to transit from one slide to the next. 1000 is equal to one second.'),
-    '#maxlength'      => 5,
-    '#size'           => 7,
-    '#required'       => TRUE,
-    '#default_value'  => $slideshow['transition_speed'] ? $slideshow['transition_speed'] : 1000,
-  );
-  if (module_exists('imagecache')) {
-    $form['preset'] = array(
-      '#type'           => 'select',
-      '#title'          => t('Imagecache preset'),
-      '#description'    => t('The imagecache preset used to automatically resize the slides in this slideshow. The preset should contain a scale operation (such as scale and crop) that ensures the width and height of the image matches the width and height of the slideshow, or some of the image might be obscured.'),
-      '#options'        => fancy_slide_options_presets(),
-      '#default_value'  => $slideshow['preset'],
-    );
-  }
-  $form['continuous'] = array(
-    '#type'           => 'checkbox',
-    '#title'          => t('Continuous'),
-    '#description'    => t('If checked, the slideshow will return to the first slide once the last slide is reached. If not checked, the slideshow will end once the last slide has been reached.'),
-    '#default_value'  => $slideshow['continuous'],
-  );
-  
-  $form['vertical'] = array(
-    '#type'           => 'radios',
-    '#title'          => t('Slideshow orientation'),
-    '#description'    => t('If horizontal, the slides will animate horizontally as though they are side by side. If vertical, the slides will animate vertically as though they are on top of one another.'),
-    '#required'       => TRUE,
-    '#options'        => array('0' => t('Horizontal'), '1' => t('Vertical')),
-    '#default_value'  => $slideshow['vertical'],
-  );
-  $form['show_controls'] = array(
-    '#type'           => 'checkbox',
-    '#title'          => t('Show controls'),
-    '#description'    => t('If checked, the control strip will appear, showing the image alternate text (description) and a set of thumbnails allowing the manual selection of slides.'),
-    '#default_value'  => $slideshow['show_controls'],
-  );
-  $form['slide_controls'] = array(
-    '#type'           => 'checkbox',
-    '#title'          => t('Slide controls'),
-    '#description'    => t('If checked, the control strip will slide in when the mouse is moved over the slideshow, and slide out again when the mouse is moved away. If unchecked, the controls will always be visible. Note that if the controls are turned off altogether, this option will have no effect.'),
-    '#default_value'  => $slideshow['slide_controls'],
-  );
-  $form['submit'] = array(
-    '#type'   => 'submit',
-    '#value'  => $sid ? t('Update') : t('Add'),
-  );
-  
-  return $form;
-}
-
-/**
- * Validate handler for fancy_slide_edit_form().
- */
-function fancy_slide_edit_form_validate($form_id, &$form_state) {
-  $form_state['values']['slideshow_name'] = check_plain($form_state['values']['slideshow_name']);
-  
-  if (!preg_match('/[0-9]{1,4}x[0-9]{1,4}/', $form_state['values']['dimensions'])) {
-    form_set_error('dimensions', t('Dimensions must be in the form 640x480 (numbers, followed by the x character, followed by more numbers.'));
-  }
-  
-  $showtype = $form_state['values']['type'];
-  
-  // If the slideshow is a single type, make sure that the node exists.
-  if ($showtype == FANCY_SLIDE_TYPE_SINGLE) {
-    $nid = db_result(db_query(
-      "SELECT nid FROM {node} WHERE title = '%s'", $form_state['values']['nid']
-    ));
-    
-    if (!$nid) {
-      form_set_error('nid', t('The node %node was not found.', array('%node', $form_state['values']['nid'])));
-    }
-  }
-  // If the slideshow is a nodequeue type, make sure a nodequeue is selected and
-  // actually exists.
-  else if ($showtype == FANCY_SLIDE_TYPE_NODEQUEUE) {
-    $sqid_ok = TRUE;    
-    $sqid = $form_state['values']['nodequeue'];
-    
-    if (!$sqid) {
-      $sqid_ok = FALSE;
-    }
-    else {
-      // Look up the nodequeue to make sure it exists.
-      $queue = db_result(db_query(
-        "SELECT title FROM {nodequeue_subqueue} WHERE sqid = %d", $sqid
-      ));
-      
-      if (!$queue) {
-        $sqid_ok = FALSE;
-      }
-    }
-    
-    if (!$sqid_ok) {
-      form_set_error('nodequeue', t('You must select a valid nodequeue. If there are no nodequeues, you will need to !addlink.', array('!addlink', l(t('add one first'), 'admin/content/nodequeue/add/nodequeue'))));
-    }
-  }
-  
-  // Make sure that the selected field actually exists.
-  if (!in_array($form_state['values']['slidefield'], array_keys(content_fields()))) {
-    form_set_error('slidefield', t('The field %field does not exist.', array('%title', $form_state['values']['slidefield'])));
-  }
-  
-  // Make sure the slideshow delay is numeric and greater than 0.
-  $delay = $form_state['values']['delay'];
-  
-  if (!is_numeric($delay) || $delay < 0 || $delay > 999) {
-    form_set_error('delay', t('Please enter a number between 0 and 999.'));
-  }
-  
-  // Make sure the transition speed is numeric and greater than 0.
-  $speed = $form_state['values']['transition_speed'];
-  
-  if (!is_numeric($speed) || $speed < 0 || $speed > 99999) {
-    form_set_error('delay', t('Please enter a number between 0 and 99999.'));
-  }
-  
-  // Ensure that the imagecache preset is valid.
-  if (module_exists('imagecache') && $form_state['values']['preset'] && !count(imagecache_preset($form_state['values']['preset']))) {
-    form_set_error('preset', t('Please choose a valid imagecache preset or choose not to use imagecache'));
-  }
-}
-
-function fancy_slide_edit_form_submit($form_id, &$form_state) {
-  $slide = array();
-  
-  if ($form_state['values']['sid']) {
-    $slide['sid'] = $form_state['values']['sid'];
-  }
-  
-  $slide['name'] = $form_state['values']['slideshow_name'];
-  list($slide['width'], $slide['height']) = explode('x', $form_state['values']['dimensions']);
-  $slide['type'] = $form_state['values']['type'];
-  $slide['animation'] = $form_state['values']['animation'];
-  $slide['nodequeue'] = $form_state['values']['nodequeue'];
-  $slide['field'] = $form_state['values']['slidefield'];
-  $slide['delay'] = $form_state['values']['delay'];
-  $slide['preset'] = $form_state['values']['preset'];
-  $slide['vertical'] = $form_state['values']['vertical'];
-  $slide['continuous'] = $form_state['values']['continuous'];
-  $slide['transition_speed'] = $form_state['values']['transition_speed'];
-  $slide['show_controls'] = $form_state['values']['show_controls'];
-  $slide['slide_controls'] = $form_state['values']['slide_controls'];
-  
-  if ($title = $form_state['values']['nid']) {
-    $slide['nid'] = db_result(db_query_range(
-      "SELECT nid FROM {node} WHERE title = '%s'", $title, 0, 1
-    ));
-  }
-  
-  if ($slide['sid']) {
-    fancy_slide_update($slide);
-  }
-  else {
-    fancy_slide_add($slide);
-  }
-}
-
-function fancy_slide_form() {
-  $form = array();
-  $slideshows = fancy_slide_get_all();
-  $slidetypes = fancy_slide_options_types();
-  
-  foreach ($slideshows as $key => $slideshow) {
-    $form['slidename'][$key] = array('#value' => $slideshow['name']);
-    $form['dimensions'][$key] = array('#value' => $slideshow['width'] . 'x' . $slideshow['height']);
-    $form['type'][$key] = array('#value' => $slidetypes[$slideshow['type']]);
-    
-    switch ($slideshow['type']) {
-      default:
-      case FANCY_SLIDE_TYPE_SINGLE:
-        $form['nodeinfo'][$key] = array('#value' => t('Node:') . ' ' . $slideshow['node_title']);
-        break;
-        
-      case FANCY_SLIDE_TYPE_NODEQUEUE:
-        $form['nodeinfo'][$key] = array('#value' => t('Nodequeue:') . ' ' . $slideshow['nodequeue_title']);
-        break;
-    }
-  }
-  
-  return $form;
-}
-
-/**
  * Get the specified slideshow.
  * 
  * @param $sid int
@@ -389,16 +28,14 @@ function fancy_slide_form() {
  *    - nid (node ID, if any)
  */
 function fancy_slide_get($sid) {
-  $result = db_query(
+  $row = db_fetch_object(db_query(
     "SELECT sid, name, width, height, field, delay, preset, vertical, type,
        nodequeue, nid, animation, continuous, transition_speed, show_controls,
-       slide_controls
+       slide_controls, text_overlay, list_style, show_alt, randomize
      FROM {fancy_slide}
      WHERE sid = %d",
     $sid
-  );
-  
-  $row = db_fetch_object($result);
+  ));
   
   if ($row) {
     return _fancy_slide_process_row($row);
@@ -423,17 +60,9 @@ function fancy_slide_get_all() {
   
   if (!isset($fancy_slide_all)) {
     $fancy_slide_all = array();
-    $result = db_query(
-      "SELECT sid, name, width, height, field, delay, preset, vertical, type,
-         nodequeue, nid, animation, continuous, transition_speed, show_controls,
-         slide_controls
-       FROM {fancy_slide}
-       ORDER BY sid ASC"
-    );
-    
-    while ($row = db_fetch_object($result)) {
-      $temp = _fancy_slide_process_row($row);
-      $fancy_slide_all[$temp['sid']] = $temp;
+    $result = db_query("SELECT sid FROM {fancy_slide} ORDER BY sid ASC");
+    while ($sid = db_result($result)) {
+      $fancy_slide_all[$sid] = fancy_slide_get($sid);
     }
   }
   
@@ -455,6 +84,43 @@ function fancy_slide_init() {
 }
 
 /**
+ * Implementation of hook_block().
+ */
+function fancy_slide_block($op = 'list', $delta = 0, $edit = array()) {
+  switch ($op) {
+    case 'list':
+      $blocks = array();
+      $slideshows = fancy_slide_get_all();
+      
+      // Generate a separate block for each slideshow so users can choose where
+      // they are placed.
+      foreach ($slideshows as $sid => $slideshow) {
+        $blocks[$sid]['info'] = t('Fancy Slide: ' . $slideshow['name']);
+      }
+
+      return $blocks;
+      
+    case 'view':
+      $slideshow = fancy_slide_get($delta);
+      
+      // Deal with a case where the delta does not refer to a valid slideshow.
+      if (!is_array($slideshow)) {
+        return array(
+          'subject' => t('Fancy Slide slideshow not found'),
+          'content' => t('The Fancy Slide slideshow with ID %id was not found.', array('%id' => $delta)),
+        );
+      }
+      
+      $block = array(
+        'subject' => $slideshow['name'],
+        'content' => theme('fancy_slide', $delta),
+      );
+      
+      return $block;
+  }
+}
+
+/**
  * Implementation of hook_menu().
  */
 function fancy_slide_menu() {
@@ -466,6 +132,7 @@ function fancy_slide_menu() {
     'page callback'     => 'drupal_get_form',
     'page arguments'    => array('fancy_slide_form'),
     'access arguments'  => array('administer fancy_slide'),
+    'file'              => 'fancy_slide.admin.inc',
   );
   $items['admin/content/fancy-slide/list'] = array(
     'title'             => 'List',
@@ -474,6 +141,7 @@ function fancy_slide_menu() {
     'page callback'     => 'drupal_get_form',
     'page arguments'    => array('fancy_slide_form'),
     'access arguments'  => array('administer fancy_slide'),
+    'file'              => 'fancy_slide.admin.inc',
   );
   $items['admin/content/fancy-slide/add'] = array(
     'title'             => 'Add',
@@ -482,6 +150,16 @@ function fancy_slide_menu() {
     'page callback'     => 'drupal_get_form',
     'page arguments'    => array('fancy_slide_edit_form'),
     'access arguments'  => array('administer fancy_slide'),
+    'file'              => 'fancy_slide.admin.inc',
+  );
+  $items['admin/content/fancy-slide/admin'] = array(
+    'title'             => 'Settings',
+    'description'       => 'Fancy Slide Settings',
+    'type'              => MENU_LOCAL_TASK,
+    'page callback'     => 'drupal_get_form',
+    'page arguments'    => array('fancy_slide_settings_form'),
+    'access arguments'  => array('administer fancy_slide settings'),
+    'file'              => 'fancy_slide.admin.inc',
   );
   $items['admin/content/fancy-slide/edit/%'] = array(
     'title'             => 'Edit',
@@ -490,6 +168,7 @@ function fancy_slide_menu() {
     'page callback'     => 'drupal_get_form',
     'page arguments'    => array('fancy_slide_edit_form', 4),
     'access arguments'  => array('administer fancy_slide'),
+    'file'              => 'fancy_slide.admin.inc',
   );
   $items['admin/content/fancy-slide/delete/%'] = array(
     'title'             => 'Delete',
@@ -498,6 +177,7 @@ function fancy_slide_menu() {
     'page callback'     => 'fancy_slide_delete',
     'page arguments'    => array(4),
     'access arguments'  => array('administer fancy_slide'),
+    'file'              => 'fancy_slide.admin.inc',
   );
   $items['fancy-slide/autocomplete-nid'] = array(
     'title'             => 'Autocomplete node ID',
@@ -505,88 +185,19 @@ function fancy_slide_menu() {
     'type'              => MENU_CALLBACK,
     'page callback'     => 'fancy_slide_autocomplete_nid',
     'access arguments'  => array('administer fancy_slide'),
+    'file'              => 'fancy_slide.admin.inc',
   );
   
   return $items;
 }
 
 /**
- * Generate a list of CCK fields suitable for use on a FAPI form.
- */
-function fancy_slide_options_fields() {
-  $fields = content_fields();
-  $myfields = array();
-  
-  foreach ($fields as $key => $field) {
-    $myfields[$key] = $field['widget']['label'] . ' (' . $key . ')';
-  }
-  
-  // If there are no CCK fields yet, warn the user by adding a single row to the
-  // select element.
-  if (!count($myfields)) {
-    $myfields['null'] = t('No fields');
-  }
-  
-  return $myfields;
-}
-
-/**
- * Generate a list of nodequeues suitable for use on a FAPI form.
- */
-function fancy_slide_options_nodequeues() {
-  $nodequeues = array();
-  $result = db_query(
-    "SELECT sqid, title FROM {nodequeue_subqueue} ORDER BY title ASC"
-  );
-  
-  while ($row = db_fetch_object($result)) {
-    $nodequeues[$row->sqid] = $row->title;
-  }
-  
-  // If there are no nodequeues, display a single entry in the select list to
-  // warn the user.
-  if (!count($nodequeues)) {
-    $nodequeues[0] = t('No nodequeues found');
-  }
-  
-  return $nodequeues;
-}
-
-/**
- * Generate a list of imagecache presets suitable for use on a FAPI form.
- */
-function fancy_slide_options_presets() {
-  $presets = imagecache_presets();
-  $output = array();
-  $output[0] = t('Do not use imagecache');
-  
-  foreach ($presets as $preset) {
-    $output[$preset['presetid']] = $preset['presetname'];
-  }
-  
-  return $output;
-}
-
-/**
- * Generates a set of slideshow types suitable for use on a FAPI form.
- */
-function fancy_slide_options_types() {
-  $types = array();
-  $types[FANCY_SLIDE_TYPE_SINGLE] = t('Single node');
-  
-  if (module_exists('nodequeue')) {
-    $types[FANCY_SLIDE_TYPE_NODEQUEUE] = t('Nodequeue');
-  }
-  
-  return $types;
-}
-
-/**
  * Implementation of hook_perm().
  */
 function fancy_slide_perm() {
   return array(
     'administer fancy_slide',
+    'administer fancy_slide settings',
   );
 }
 
@@ -632,6 +243,10 @@ function _fancy_slide_process_row($row) {
   $slide['continuous'] = $row->continuous;
   $slide['show_controls'] = $row->show_controls;
   $slide['slide_controls'] = $row->slide_controls;
+  $slide['text_overlay'] = $row->text_overlay;
+  $slide['list_style'] = $row->list_style;
+  $slide['show_alt'] = $row->show_alt;
+  $slide['randomize'] = $row->randomize;
   
   if ($row->nodequeue) {
     $slide['nodequeue_title'] = db_result(db_query(
@@ -679,7 +294,15 @@ function fancy_slide_render($sid) {
         foreach ($node->{$slideshow['field']} as $image) {
           // Only process if the image has a filepath.
           if ($image['filepath']) {
-            $slides[] = _fancy_slide_render_image($image, $slideshow['imagecache'] ? $slideshow['preset_name'] : NULL);
+            $slide = _fancy_slide_render_image(
+              $image, 
+              $slideshow['imagecache'] ? $slideshow['preset_name'] : NULL,
+              'node/' . $node->nid
+            );
+            if ($slideshow['text_overlay']) {
+              $slide['rendered'] .= _fancy_slide_render_overlay($image['data'], $slideshow['text_overlay']);
+            }
+            $slides[] = $slide;
           }
         }
       }
@@ -692,12 +315,29 @@ function fancy_slide_render($sid) {
       foreach ($nodes as $node) {
         // Make sure that the slideshow image field exists on this node.
         if ($node->{$slideshow['field']}[0]['filepath']) {
-          $slides[] = _fancy_slide_render_image($node->{$slideshow['field']}[0], $slideshow['imagecache'] ? $slideshow['preset_name'] : NULL, 'node/'.$node->nid);
+          $slide = _fancy_slide_render_image(
+            $node->{$slideshow['field']}[0],
+            $slideshow['imagecache'] ? $slideshow['preset_name'] : NULL,
+            'node/' . $node->nid
+          );
+          if ($slideshow['text_overlay']) {
+            $slides[] = _fancy_slide_render_image(
+              $node->{$slideshow['field']}[0],
+              $slideshow['imagecache'] ? $slideshow['preset_name'] : NULL,
+              'node/' . $node->nid
+            );
+            $slide['rendered'] .= _fancy_slide_render_overlay(
+              $node->{$slideshow['field']}[0]['data'], $slideshow['text_overlay']);
+          }
+          $slides[] = $slide;
         }
       }
       
       break;
   }
+  if ($slideshow['randomize']) {
+    shuffle($slides);
+  }
   return $slides;
 }
 
@@ -719,7 +359,13 @@ function fancy_slide_render($sid) {
 function _fancy_slide_render_image($image, $presetname = NULL, $link = NULL) {
   $slide = array();
   $slide['imagepath'] = $image['filepath'];
-  $slide['imagealt'] = $image['data']['alt'];
+  // extra fields provided by imagefield_extended
+  if (isset($image['data']['link']) && isset($image['data']['link_text'])) {
+    $slide['imagealt'] = $image['data']['link_text']['body'];
+  }
+  else {
+    $slide['imagealt'] = $image['data']['alt'];
+  }
 
   if ($presetname) {
     // Use imagecache to render the image with the specified preset.
@@ -729,11 +375,6 @@ function _fancy_slide_render_image($image, $presetname = NULL, $link = NULL) {
       $slide['imagepath'],
       $slide['imagealt']
     );
-    
-    // Add the link if necessary.
-    if ($link) {
-      $slide['rendered'] = l($slide['rendered'], $link, array('html' => TRUE));
-    }
   }
   else {
     // Don't use imagecache to render the image, just the normal method.
@@ -742,48 +383,67 @@ function _fancy_slide_render_image($image, $presetname = NULL, $link = NULL) {
       $slide['imagepath'],
       $slide['imagealt']
     );
-    
+  }
+
   // Add the link if necessary.
-    if ($link) {
-      $slide['rendered'] = l($slide['rendered'], $link, array('html' => TRUE));
+  // extra fields provided by imagefield_extended
+  if (isset($image['data']['link'])) {
+    if (isset($image['data']['link']['body']) && $image['data']['link']['body'] != "") {
+      $slide['rendered'] = l($slide['rendered'], $image['data']['link']['body'], array('html' => TRUE));
     }
   }
+  elseif ($link) {
+    $slide['rendered'] = l($slide['rendered'], $link, array('html' => TRUE));
+  }
   
   return $slide;
 }
 
+function _fancy_slide_render_overlay($data, $orientation) {
+  $title = isset($data['title']) ? $data['title'] : $data['alt'];
+  $desc  = isset($data['description']) ? $data['description'] : '';
+  $link  = isset($data['link']) ? $data['link']['body'] : '';
+  $text  = isset($data['link_text']) ? $data['link_text']['body'] : '';
+
+  return theme(
+    'fancy_slide_overlay',
+    $title,
+    $desc,
+    $link,
+    $text,
+    $orientation
+  );
+}
+
 /**
  * Implementation of hook_theme().
  */
 function fancy_slide_theme() {
   return array(
-    'fancy_slide'           => array(
+    'fancy_slide' => array(
       'arguments' => array(
         'slideshow' => 1,
       ),
       'template'  => 'fancy-slide',
     ),
-    'fancy_slide_form'      => array(
+    'fancy_slide_form' => array(
+      'file'      => 'fancy_slide.admin.inc',
       'arguments' => array(
         'form'    => NULL,
       ),
     ),
+    'fancy_slide_overlay' => array(
+      'arguments' => array(
+        'title' => NULL,
+        'description' => NULL,
+        'link' => NULL,
+        'link_text' => NULL,
+      ),
+    ),
   );
 }
 
 /**
- * Update a slideshow in the database.
- * 
- * @param $slide array
- *    The slideshow to be updated, with the appropriate details. For the format
- *    of the array, see the documentation for fancy_slide_get.
- * @see fancy_slide_get()
- */
-function fancy_slide_update($slide) {
-  drupal_write_record('fancy_slide', $slide, 'sid');
-}
-
-/**
  * Preprocess function for theme_fancy_slide().
  */
 function template_preprocess_fancy_slide(&$vars) {
@@ -799,6 +459,22 @@ function template_preprocess_fancy_slide(&$vars) {
   );
   
   $vars['fancyslide_styles'] = implode('; ', $styles);
+
+  // Add a class for the text overlay positioning
+  switch ($slideshow['text_overlay']) {
+    case 1: 
+      $vars['fancyslide_classes'] = 'bottom';
+      break;
+    case 2:
+      $vars['fancyslide_classes'] = 'right';
+      break;
+    case 3:
+      $vars['fancyslide_classes'] = 'top';
+      break;
+    case 4:
+      $vars['fancyslide_classes'] = 'left';
+      break;
+  }
   
   // Create a javascript array of options to be used when creating the
   // slideshow.
@@ -809,6 +485,10 @@ function template_preprocess_fancy_slide(&$vars) {
   $opts[] = 'slideControls: ' . ($slideshow['slide_controls'] ? 'true' : 'false');
   $opts[] = 'speed: ' . $slideshow['transition_speed'];
   $opts[] = 'vertical: ' . ($slideshow['vertical'] ? 'true' : 'false');
+  if ($slideshow['list_style'] == 1) {
+    $opts[] = 'listStyle: "' . drupal_get_path('module', 'fancy_slide') . '/shape.png"';
+  }
+  $opts[] = 'showAlt: ' . ($slideshow['show_alt'] ? 'true' : 'false');
   
   // If the delay is set to 0, prevent automatic transition to next slide.
   // Otherwise, set up the delay before going to the next slide.
@@ -834,44 +514,11 @@ EOT;
   $vars['slides'] = fancy_slide_render($vars['slideshow']);
 }
 
-/**
- * Theme function for the FAPI form fancy_slide_form().
- */
-function theme_fancy_slide_form($form) {
-  $header = array(
-    t('Name'),
-    t('Dimensions'),
-    t('Type'),
-    t('Source'),
-    t('Operations'),
-  );
-  $rows = array();
-  $slideshows = fancy_slide_get_all();
-  
-  foreach ($slideshows as $key => $slideshow) {
-    $row = array();
-    $row[] = drupal_render($form['slidename'][$key]);
-    $row[] = drupal_render($form['dimensions'][$key]);
-    $row[] = drupal_render($form['type'][$key]);
-    $row[] = drupal_render($form['nodeinfo'][$key]);
-
-    $links = array(
-      l(
-        t('edit'),
-        'admin/content/fancy-slide/edit/' . $key,
-        array('attributes' => array('title' => t('Edit this slideshow')))
-      ),
-      l(
-        t('delete'),
-        'admin/content/fancy-slide/delete/' . $key,
-        array('attributes' => array('title' => t('Delete this slideshow')))
-      ),
-    );
-    
-    $row[] = implode(' | ', $links);
-    
-    $rows[] = $row;
-  }
-  fancy_slide_render(1);
-  return theme('table', $header, $rows);
+function theme_fancy_slide_overlay($title, $desc, $link, $link_text) {
+  return '
+    <div class="slide-text"><div class="slide-text-inner">
+    <h2>' . $title . '</h2>
+    <p>' . $desc . '</p>
+    <a class="more-link" href="' . $link . '">' . $link_text . '</a>
+    </div></div>';
 }
diff --git a/js/fancy_slide.js b/js/fancy_slide.js
index 25a2c71..0e21235 100644
--- a/js/fancy_slide.js
+++ b/js/fancy_slide.js
@@ -1,284 +1,351 @@
-/*
- *  jQuery to power the fancy slide module.
- *
- */
- 
-(function($) {
-  $.fn.fancySlide = function(options){  
-    var defaultoptions = {
-      animation:      'slide', // Transition style
-      continuous:     true,    // Return to first slide when last slide is
-                               // reached
-      controlsBefore: '',      // Prefix slide description
-      controlsAfter:  '',      // Suffix slide description
-      showControls:   true,    // Add controller to the slider
-      slideControls:  false,   // Makes controls slide up and down on mouseover
-      vertical:       false,   // Slide animations move vertically
-      speed:          800,     // Transition time
-      rotate:         true,    // Let slider animate by itself
-      pause:          4000     // Pause time between transitions
-    };
-
-    var options = $.extend(defaultoptions, options);
-    var obj = $(this);
-    var slidewidth = $(this).outerWidth();
-    var slideheight = $(this).outerHeight();
-    var slides = $('li', obj).length;
-    var currentslide = 0;
-    var previousslide = 0;
-    var position = 0;
-    var timeout;
-    var depth = 99;
-    // Append to animation function name
-    var animationtype = options.animation + 'animate';
-   
-    if (options.speed == 0) {
-      animationtype = 'dontanimate';
-    }
-    
-    /*
-     *  Initiate the fancy slider.
-     *
-     */
-    return this.each(function() {
-
-      obj.width(slidewidth);
-      obj.height(slideheight);
-      obj.css('overflow', 'hidden');
-      
-      if(options.showControls) {
-        var html = '<div id="controller">';
-        html += '<span>' + options.controlsBefore + '</span>';
-        for (i = 0; i < slides; i++){
-          var thistitle = $('li img:eq(' + i + ')');
-          html += '<p>' + thistitle.attr('alt') + '</p>';
-        }
-        html += '<div class="controls">';
-        for (i = 0; i < slides; i++){
-          var thisslide = $('li img:eq(' + i + ')');
-          html += '<a href="#" title ="' + thisslide.attr('alt') + '">'
-          html += '<img src="' + thisslide.attr('src') + '" alt="' + thisslide.attr('alt') + '" />'
-          html += '</a>';
-        }
-        html += '</div>';
-        html += '</div>';
-        html += options.controlsAfter;            
-        $(obj).append(html);
-    
-        $('#controller').css('zIndex', depth + 1);
-        $('#controller').css('width', slidewidth - 20);
-        
-        // Make sure controller link images are sized correctly
-        $('#controller img').attr('height', '40');     
-
-        // Set classes for controller text and buttons
-        showinfo();
-
-        // Add sliding animation for controller
-        if (options.slideControls) {
-        var controlsheight = $('#controller').outerHeight();
-        $('#controller').css('bottom','-' + controlsheight + 'px');
-        obj.hover(
-          function() {
-            $('#controller').stop().animate({bottom:'0px'}, 300);
-            }, 
-            function() {
-              $('#controller').stop().animate({bottom:'-' + controlsheight + 'px'}, 300);
-            }
-          );
-        }
-        
-        // Give controller links functionality to change slides
-        $('#controller a').each(function(i) {
-          $(this).bind('click', function() {
-              previousslide = currentslide;
-              currentslide = i;
-              eval(animationtype + '(' + currentslide + ',' + previousslide + ',' + true + ')');
-              return false;
-            });
-        });
-      };
-      
-      // Set slider CSS to override default drupal
-      if (animationtype == 'slideanimate') {
-        $('ul', obj).css({
-          'margin' : 0,
-          'padding' : 0,
-          'width': slides*slidewidth
-          });    
-        $('li', obj).css({
-          'float' : (options.vertical ? 'none' : 'left'),
-          'height' : slideheight,
-          'width' : slidewidth
-        });
-      } else if (animationtype == 'fadeanimate' || animationtype == 'dontanimate') {
-        $('ul', obj).css({
-          'height' : slideheight,
-          'width' : slidewidth
-        });
-        $('li', obj).css({
-          'height' : slideheight,
-          'left' : '0',
-          'position' : 'absolute',
-          'top' : '0',
-          'width' : slidewidth
-        });
-                  
-        for (i = 0; i < slides; i++){
-          $('li:eq(' + i + ')', obj).css('zIndex', depth);
-          depth--;
-        }
-      }
-      
-      if (options.rotate) {
-        timeout = setTimeout(function(){
-          eval(animationtype + '("rotate",' + previousslide + ',' + false + ')');
-          },options.pause);
-      };
-    });
-    
-    // Work out which slide to animate to
-    function animationmechanic(destination) {
-      if (destination == 'rotate') {
-        currentslide++;
-        if (currentslide > slides - 1) {
-          currentslide = options.continuous ? 0 : currentslide - 1;
-        }
-      } else {      
-        currentslide = destination;
-      };
-      
-      return currentslide;
-      
-    };
-    
-    /*
-     *  Dont animate transition. If speed is set to 0 use this to save on overhead
-     *
-     */
-    function dontanimate(destination, current, clicked) {
-      var theslide = currentslide;
-     
-      if (destination == current){ //prevent button clicks on current slide
-        if(clicked) clearTimeout(timeout); //reset timeout if controller links are clicked
-        return;
-      }
-      animationmechanic(destination);
-      
-      if (options.showControls) {
-        showinfo();
-      };
-      
-      var diff = Math.abs(theslide-currentslide);
-      var speed = diff * options.speed;
-      
-      if (!clicked){
-        if (currentslide == 0){
-          previousslide = slides - 1;
-        } else {
-          previousslide = currentslide - 1;
-        }
-      }
-           
-      $('li:eq(' + previousslide + ')', obj).stop(true, true).hide();
-      $('li:eq(' + currentslide + ')', obj).stop(true, true).show();
-     
-      if(clicked) clearTimeout(timeout); // Reset timeout if controller links are clicked
-      
-      if(options.rotate) {
-        timeout = setTimeout(function(){
-          eval(animationtype + '("rotate",' + previousslide + ',' + false + ')');
-        }, diff*speed + options.pause);
-      }; 
-    };
-       
-    /*
-     *  Slide transition
-     *
-     */
-    function slideanimate(destination, current, clicked) {
-      var theslide = currentslide;
-      
-      if (destination == current){ // Prevent button clicks on current slide
-        if(clicked) clearTimeout(timeout); // Reset timeout if controller links are clicked
-        return;
-      }
-      animationmechanic(destination);
-      
-      if (options.showControls) {
-        showinfo();
-      };
-
-      var diff = Math.abs(theslide-currentslide);
-      var speed = diff * options.speed;
-      
-      if (!options.vertical) {
-        position = (currentslide * slidewidth * -1);
-        $('ul', obj).stop().animate({marginLeft: position}, speed);
-      } else {
-        position = (currentslide * slideheight * -1);
-        $('ul', obj).stop().animate({marginTop: position}, speed);
-      };
-
-      if (clicked) clearTimeout(timeout); // Reset timeout if controller links are clicked
-    
-      if (options.rotate) {
-        timeout = setTimeout(function(){
-          eval(animationtype + '("rotate",' + previousslide + ',' + false + ')');
-        }, diff*speed + options.pause);
-      };
-      
-    };
-    
-    /*
-     *  Fade transition
-     *
-     */
-    function fadeanimate(destination, current, clicked) {
-      var theslide = currentslide;
-     
-      if (destination == current){ //Prevent button clicks on current slide
-        if(clicked) clearTimeout(timeout); // Reset timeout if controller links are clicked
-        return;
-      }
-      animationmechanic(destination);
-      
-      if (options.showControls) {
-        showinfo();
-      };
-
-      if (!clicked){
-        if (currentslide == 0){
-          previousslide = slides - 1;
-        } else {
-          previousslide = currentslide - 1;
-        }
-      }
-      
-      var diff = Math.abs(theslide - currentslide);
-      var speed = diff * options.speed;
-      
-      $('li:eq(' + previousslide + ')', obj).stop(true, true).fadeOut(speed);
-      $('li:eq(' + currentslide + ')', obj).stop(true, true).fadeIn(speed);
-     
-      if(clicked) clearTimeout(timeout); // Reset timeout if controller links are clicked
-      
-      if(options.rotate) {
-        timeout = setTimeout(function(){
-          eval(animationtype + '("rotate",' + previousslide + ',' + false + ')');
-        }, diff*speed + options.pause);
-      }; 
-    };
-    
-    // Change classes on controller info and button states 
-    function showinfo() {
-      $('#controller p, #controller a').addClass('inactive');
-      $('#controller p.active, #controller a.active').removeClass('active');
-      $('#controller p:eq(' + currentslide + ')').removeClass('inactive');
-      $('#controller p:eq(' + currentslide + ')').addClass('active');
-      $('#controller a:eq(' + currentslide + ')').removeClass('inactive');
-      $('#controller a:eq(' + currentslide + ')').addClass('active');
-    };
-  };
-  
-})(jQuery);
+/*
+ *  jQuery to power the fancy slide module.
+ *
+ */
+ 
+(function($) {
+  $.fn.fancySlide = function(options){  
+    var defaultoptions = {
+      animation:      'slide', // Transition style
+      continuous:     true,    // Return to first slide when last slide is
+                               // reached
+      controlsBefore: '',      // Prefix slide description
+      controlsAfter:  '',      // Suffix slide description
+      showControls:   true,    // Add controller to the slider
+      slideControls:  false,   // Makes controls slide up and down on mouseover
+      vertical:       false,   // Slide animations move vertically
+      speed:          800,     // Transition time
+      rotate:         true,    // Let slider animate by itself
+      pause:          4000,    // Pause time between transitions
+      showAlt:        true     // Show alt text in controls
+    };
+
+    var options = $.extend(defaultoptions, options);
+    var obj = $(this);
+    var slidewidth = $(this).outerWidth() -3;
+    var slideheight = $(this).outerHeight() -3;
+	 var slides = $('li', obj).length;
+
+    var currentslide = 0;
+    var previousslide = 0;
+    var position = 0;
+    var timeout;
+    var depth = 99;
+    // Append to animation function name
+    var animationtype = options.animation + 'animate';
+   
+
+	
+    if (options.speed == 0) {
+      animationtype = 'dontanimate';
+    }
+    
+    /*
+     *  Initiate the fancy slider.
+     *
+     */
+    return this.each(function() {
+
+      obj.width(slidewidth);
+      obj.height(slideheight);
+      obj.css('overflow', 'hidden');
+ 
+  
+      if(options.showControls) {
+
+        if (options.listStyle) {
+          var html = '<div class="controller no-thumbnail">';
+        }
+        else {
+          var html = '<div class="controller thumbnail">'; 
+        }
+        html += '<span>' + options.controlsBefore + '</span>';
+        if (options.showAlt) {
+          for (i = 0; i < slides; i++){
+            var thistitle = $('li img:eq(' + i + ')', obj);
+            html += '<p>' + thistitle.attr('alt') + '</p>';
+          }
+        }
+        html += '<div class="controls">';
+        for (i = 0; i < slides; i++){
+          var thisslide = $('ul li img:eq(' + i + ')', obj);
+          html += '<a href="#" title ="' + thisslide.attr('alt') + '">';
+          if (options.listStyle) {
+            html += '<img src="' + options.listStyle + '" alt="' + thisslide.attr('alt') + '" />';
+          }
+          else {
+            html += '<img src="' + thisslide.attr('src') + '" alt="' + thisslide.attr('alt') + '" />';
+          }
+          html += '</a>';
+        }
+        html += '</div>';
+        html += '</div>';
+        html += options.controlsAfter;            
+        $(obj).append(html);
+    
+        controller = $('.controller', obj);
+        $(controller).css('zIndex', depth + 1);
+        $(controller).css('width', slidewidth - 20);
+        obj.height(slideheight + 50);  
+        // Make sure controller link images are sized correctly
+        $('img', controller).attr('height', '40');     
+
+        // Set classes for controller text and buttons
+        showinfo();
+
+		   // Add sliding animation for controller
+	        if (options.slideControls) {
+	       // var controlsheight = $(controller).outerHeight();
+				//$(controller).css('bottom','-' + controlsheight + 'px');
+				$('.fancy-slide').addClass('slide-controller');
+				obj.height(slideheight);  
+	        $(controller).hide();
+	        obj.hover(
+	          function() {
+	        	  		$(controller).slideDown(300);
+	            }, 
+	            function() {
+	            	$(controller).slideUp(300);
+	            }
+	          );
+	        }
+        
+        // Give controller links functionality to change slides
+        $('a', controller).each(function(i) {
+          $(this).bind('click', function() {
+              previousslide = currentslide;
+              currentslide = i;
+              eval(animationtype + '(' + currentslide + ',' + previousslide + ',' + true + ')');
+              return false;
+            });
+        });
+      };
+		
+		
+      // Set slider CSS to override default drupal
+      if (animationtype == 'slideanimate') {
+        $('ul', obj).css({
+          'margin' : 0,
+          'padding' : 0,
+          'width': slides*slidewidth
+          });    
+        $('li', obj).css({
+          'float' : (options.vertical ? 'none' : 'left'),
+          'height' : slideheight,
+          'width' : slidewidth
+        });
+      } else if (animationtype == 'fadeanimate' || animationtype == 'dontanimate') {
+        $('ul', obj).css({
+          'height' : slideheight,
+          'width' : slidewidth
+        });
+        $('li', obj).css({
+          'height' : slideheight,
+          'left' : '0',
+          'position' : 'absolute',
+          'top' : '0',
+          'width' : slidewidth
+        });
+                  
+        for (i = 0; i < slides; i++){
+          $('li:eq(' + i + ')', obj).css('zIndex', depth);
+          depth--;
+        }
+      }
+      
+      if (options.rotate) {
+        timeout = setTimeout(function(){
+          eval(animationtype + '("rotate",' + previousslide + ',' + false + ')');
+          },options.pause);
+      };
+    });
+    
+    // Work out which slide to animate to
+    function animationmechanic(destination) {
+      if (destination == 'rotate') {
+        currentslide++;
+        if (currentslide > slides - 1) {
+          currentslide = options.continuous ? 0 : currentslide - 1;
+        }
+      } else {      
+        currentslide = destination;
+      };
+      
+      return currentslide;
+      
+    };
+    
+    /*
+     *  Dont animate transition. If speed is set to 0 use this to save on overhead
+     *
+     */
+    function dontanimate(destination, current, clicked) {
+      var theslide = currentslide;
+     
+      if (destination == current){ //prevent button clicks on current slide
+        if(clicked) clearTimeout(timeout); //reset timeout if controller links are clicked
+        return;
+      }
+      animationmechanic(destination);
+      
+      if (options.showControls) {
+        showinfo();
+      };
+      
+      var diff = Math.abs(theslide-currentslide);
+      var speed = diff * options.speed;
+      
+      if (!clicked){
+        if (currentslide == 0){
+          previousslide = slides - 1;
+        } else {
+          previousslide = currentslide - 1;
+        }
+      }
+           
+      $('li:eq(' + previousslide + ')', obj).stop(true, true).hide();
+      $('li:eq(' + currentslide + ')', obj).stop(true, true).show();
+     
+      if(clicked) clearTimeout(timeout); // Reset timeout if controller links are clicked
+      
+      if(options.rotate) {
+        timeout = setTimeout(function(){
+          eval(animationtype + '("rotate",' + previousslide + ',' + false + ')');
+        }, diff*speed + options.pause);
+      }; 
+    };
+
+
+	       
+    /*
+     *  Slide transition
+     *
+     */
+    function slideanimate(destination, current, clicked) {
+      var theslide = currentslide;
+      
+      if (destination == current){ // Prevent button clicks on current slide
+        if(clicked) clearTimeout(timeout); // Reset timeout if controller links are clicked
+        return;
+      }
+      animationmechanic(destination);
+      
+      if (options.showControls) {
+        showinfo();
+      };
+
+      var diff = Math.abs(theslide-currentslide);
+      var speed = diff * options.speed;
+      
+      if (!options.vertical) {
+	        position = (currentslide * slidewidth * -1);
+        $('ul', obj).stop().animate({marginLeft: position}, speed);
+      } else {
+        position = (currentslide * slideheight * -1);
+        $('ul', obj).stop().animate({marginTop: position}, speed);
+      };
+
+      if (clicked) clearTimeout(timeout); // Reset timeout if controller links are clicked
+    
+      if (options.rotate) {
+        timeout = setTimeout(function(){
+          eval(animationtype + '("rotate",' + previousslide + ',' + false + ')');
+        }, diff*speed + options.pause);
+      };
+      
+    };
+    
+    /*
+     *  Fade transition
+     *
+     */
+    function fadeanimate(destination, current, clicked) {
+      var theslide = currentslide;
+     
+      if (destination == current){ //Prevent button clicks on current slide
+        if(clicked) clearTimeout(timeout); // Reset timeout if controller links are clicked
+        return;
+      }
+      animationmechanic(destination);
+      
+      if (options.showControls) {
+        showinfo();
+      };
+
+      if (!clicked){
+        if (currentslide == 0){
+          previousslide = slides - 1;
+        } else {
+          previousslide = currentslide - 1;
+        }
+      }
+      
+      var diff = Math.abs(theslide - currentslide);
+      var speed = diff * options.speed;
+      
+      $('li:eq(' + previousslide + ')', obj).stop(true, true).fadeOut(speed);
+      $('li:eq(' + currentslide + ')', obj).stop(true, true).fadeIn(speed);
+     
+      if(clicked) clearTimeout(timeout); // Reset timeout if controller links are clicked
+      
+      if(options.rotate) {
+        timeout = setTimeout(function(){
+          eval(animationtype + '("rotate",' + previousslide + ',' + false + ')');
+        }, diff*speed + options.pause);
+      }; 
+    };
+    
+    // Change classes on controller info and button states 
+    function showinfo() {
+      controller = $('.controller', obj);
+      $('p', controller).addClass('inactive');
+      $('a', controller).addClass('inactive');
+      $('p.active', controller).removeClass('active');
+      $('a.active', controller).removeClass('active');
+      $('p:eq(' + currentslide + ')', controller).removeClass('inactive');
+      $('p:eq(' + currentslide + ')', controller).addClass('active');
+      $('a:eq(' + currentslide + ')', controller).removeClass('inactive');
+      $('a:eq(' + currentslide + ')', controller).addClass('active');
+    };
+  };
+  
+
+})(jQuery);
+
+$(document).ready(function() {
+
+
+
+//Place the text under the slideshow
+
+	$('.bottom')
+		.each(function(){
+				var newHeight = $(this).height() + $(this).height() * 0.30;
+				
+				$(this).height(newHeight);	
+				$('.slide-text').height();	
+		});	
+
+  //  $('.fancy-slide.bottom p' , '.block-fancy_slide')
+  //  	.css({
+  //  		'max-width':'none'
+  //  		});
+  //
+		$('.fancy-slide.bottom a', '.block-fancy_slide').css({
+				'clear':'both',
+				'margin-top':10,
+				'position': 'relative',
+				'right' :0
+				});
+
+
+						
+  //opens lightbox for when linking to video files
+  $('.fancy-slide a[href$=.m4v], .fancy-slide a[href$=.flv]').attr('rel', 'lightvideo').addClass('lightvideo');
+  if (typeof(Lightbox) !== "undefined" && Lightbox !== null) {
+    Lightbox.initList();
+  }
+  $('.slide-text a:empty, .slide-text h2:empty').remove();
+  // hide all fancy slide images except the first one
+  $('li:gt(0)', '.fancy-slide').hide();
+});
diff --git a/shape.png b/shape.png
new file mode 100644
index 0000000..2086577
Binary files /dev/null and b/shape.png differ
