diff -U 3 -H -d -r -N -- fancybox/fancybox.admin.inc fancybox/fancybox.admin.inc
--- fancybox/fancybox.admin.inc	2010-03-15 23:38:51.000000000 +0100
+++ fancybox/fancybox.admin.inc	2010-07-07 09:18:36.000000000 +0200
@@ -25,7 +25,7 @@
     $form['fancybox_files'] = array(
       '#prefix' => '<div class="messages status">',
       '#suffix' => '</div>',
-      '#value' => t('Plugin detected, using @js_file and @css_file', array('@js_file' => $files['js'], '@css_file' => $files['css']))
+      '#markup' => t('Plugin detected, using @js_file and @css_file', array('@js_file' => $files['js'], '@css_file' => $files['css']))
     );
   }
 
@@ -72,37 +72,8 @@
     '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')),
   );
 
-  // Image module:
-  if (module_exists('image')) {
-    $data['image'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Image module'),
-      '#collapsible' => TRUE,
-      '#collapsed' => TRUE,
-    );
-    $data['image']['status'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Enable Fancybox on Image nodes'),
-      '#default_value' => isset($settings['image']['auto']) ? $settings['image']['auto'] : FALSE,
-    );
-
-    $options = array();
-    $sizes = image_get_sizes();
-    foreach ($sizes as $label => $size) {
-      $options[$label] = $size['label'];
-    }
-
-    $data['image']['size'] = array(
-      '#type' => 'select',
-      '#title' => t('Display size'),
-      '#options' => $options,
-      '#default_value' => isset($settings['image']['size']) ? $settings['image']['size'] : '_original',
-      '#description' => t('The size to be used when displaying an image in a Fancybox.'),
-    );
-  }
-
   // ImageField module:
-  if (module_exists('imagefield')) {
+  if (module_exists('image')) {
     $data['imagefield'] = array(
       '#type' => 'fieldset',
       '#title' => t('ImageField module'),
@@ -117,29 +88,26 @@
       '#default_value' => isset($settings['imagefield']['grouping']) ? $settings['imagefield']['grouping'] : 1,
     );
 
-    // ImageCache module:
-    if (module_exists('imagecache')) {
-      $options = array(0 => t('Original image (no preset)'));
-      foreach (imagecache_presets() as $preset) {
-        $options[$preset['presetname']] = $preset['presetname'];
-      }
-      $data['imagefield']['imagecache_preset'] = array(
-        '#type' => 'select',
-        '#title' => t('ImageCache preset'),
-        '#options' => $options,
-        '#default_value' => isset($settings['imagefield']['imagecache_preset']) ? $settings['imagefield']['imagecache_preset'] : 0,
-        '#description' => t('The ImageCache preset to be use when displaying ImageField images in Fancybox.'),
-      );
+    $options = array(0 => t('Original image (no preset)'));
+    foreach (image_styles() as $preset) {
+      $options[$preset['name']] = $preset['name'];
     }
-
-    $data['imagefield']['use_node_title'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Use node title as caption'),
-      '#description' => t('By default, the caption for image fields is the title text for the image. If no title is configured, the alt text will be used. Check this to always display the node title as the image caption.'),
-      '#default_value' => isset($settings['imagefield']['use_node_title']) ? $settings['imagefield']['use_node_title'] : FALSE,
+    $data['imagefield']['imagecache_preset'] = array(
+      '#type' => 'select',
+      '#title' => t('ImageCache preset'),
+      '#options' => $options,
+      '#default_value' => isset($settings['imagefield']['imagecache_preset']) ? $settings['imagefield']['imagecache_preset'] : 0,
+      '#description' => t('The ImageCache preset to be use when displaying ImageField images in Fancybox.'),
     );
   }
 
+  $data['imagefield']['use_node_title'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Use node title as caption'),
+    '#description' => t('By default, the caption for image fields is the title text for the image. If no title is configured, the alt text will be used. Check this to always display the node title as the image caption.'),
+    '#default_value' => isset($settings['imagefield']['use_node_title']) ? $settings['imagefield']['use_node_title'] : FALSE,
+  );
+
   $form['data'] = $data;
   $form['data']['#tree'] = TRUE;
 
@@ -174,12 +142,6 @@
     return; // Skip validation if Reseting to defaults
   }
 
-	// Check minimal jQuery version, need at leat 1.3.x
-  $jquery_version = jquery_update_get_version();
-	if (version_compare($jquery_version, '1.3.0') <= 0) {
-    form_error($form, t('Fancybox requires jQuery 1.3+, found @version',array('@version' => $jquery_version)));
-	}
-  
   // Check fancybox_path for .js files.
   $path =  rtrim($form_state['values']['fancybox_path'], '/ ');
   $files = _detect_fancybox_files($path);
diff -U 3 -H -d -r -N -- fancybox/fancybox.info fancybox/fancybox.info
--- fancybox/fancybox.info	2010-07-06 11:09:23.000000000 +0200
+++ fancybox/fancybox.info	2010-07-07 00:14:14.000000000 +0200
@@ -1,6 +1,10 @@
 ; $Id: fancybox.info,v 1.1.4.2 2010/03/14 10:52:37 sbacelic Exp $
 name = Fancybox
 description = Provides the Fancybox jQuery plugin for displaying images, HTML content and multimedia in an elegant box.
-core = 6.x
+core = 7.x
 package = User interface
-dependencies[] = jquery_update
+
+files[] = fancybox.install
+files[] = fancybox.module
+files[] = fancybox.admin.inc
+files[] = fancybox.theme.inc
diff -U 3 -H -d -r -N -- fancybox/fancybox.module fancybox/fancybox.module
--- fancybox/fancybox.module	2010-03-15 23:38:51.000000000 +0100
+++ fancybox/fancybox.module	2010-07-07 09:42:48.000000000 +0200
@@ -62,10 +62,14 @@
 
 
 /**
- * Implementation of hook_perm().
+ * Implementation of hook_permission().
  */
-function fancybox_perm() {
-  return array('administer fancybox');
+function fancybox_permission() {
+  return array(
+    'administer fancybox' => array(
+      'title' => t('Administer Fancybox'),
+    ),
+  );
 }
 
 /**
@@ -79,7 +83,7 @@
     'file' => 'fancybox.admin.inc',
   );
 
-  $items['admin/settings/fancybox'] = $base + array(
+  $items['admin/config/user-interface/fancybox'] = $base + array(
     'title' => 'Fancybox',
     'description' => 'Configure the settings for Fancybox.',
     'page callback' => 'drupal_get_form',
@@ -91,38 +95,6 @@
 }
 
 /**
- * Implementation of hook_theme().
- */
-function fancybox_theme() {
-  $theme = array();
-
-  $base = array('file' => 'fancybox.theme.inc');
-
-  $theme['imagefield_image_imagecache_fancybox'] = $base + array(
-    'arguments' => array(
-      'namespace' => NULL,
-      'field' => NULL,
-      'path' => NULL,
-      'alt' => NULL,
-      'title' => NULL,
-      'gid' => NULL,
-      'attributes' => NULL,
-    ),
-  );
-
-  if (function_exists('imagecache_presets') && module_exists('imagefield')) {
-    foreach (imagecache_presets() as $preset) {
-      $theme['fancybox_formatter_'. $preset['presetname'] .'|fancybox'] = $base + array(
-        'function' => 'theme_fancybox_formatter_imagefield',
-        'arguments' => array('element' => NULL),
-      );
-    }
-  }
-
-  return $theme;
-}
-
-/**
  * Check whether Fancybox should be initialized for the current URL.
  */
 function fancybox_active($settings) {
@@ -136,7 +108,7 @@
   
   $page_match = drupal_match_path($path, $settings['activation']['activation_pages']);  
   if ($path != $_GET['q']) {
-    $page_match = $page_match || drupal_match_path($_GET['q'], $sett6ings['activation']['activation_pages']);
+    $page_match = $page_match || drupal_match_path($_GET['q'], $settings['activation']['activation_pages']);
   }
 
   // Decide whether to include or exclude pages.
@@ -495,19 +467,18 @@
 /**
  * Implementation of hook_field_formatter_info().
  *
- * Add Fancybox and ImageCache formatters to CCK image fields if Imagefield and
- * ImageCache modules are enabled.
+ * Add Fancybox and Image formatters to image fields if Image module is enabled.
  */
 function fancybox_field_formatter_info() {
   $formatters = array();
 
-  if (module_exists('imagecache')) {
+  if (module_exists('image')) {
     $presets = array();
 
-    foreach (imagecache_presets() as $preset) {
-      $presets[$preset['presetname'] .'|fancybox'] = array(
-        'label' => t('Fancybox: @preset image', array('@preset' => $preset['presetname'])),
-        'field types' => array('image', 'filefield'),
+    foreach (image_styles() as $preset) {
+      $presets[$preset['name'] .'_fancybox'] = array(
+        'label' => t('Fancybox: @preset image', array('@preset' => $preset['name'])),
+        'field types' => array('image'),
       );
     }
 
@@ -520,64 +491,59 @@
 }
 
 /**
- * Implementation of hook_insert_styles().
- */
-function fancybox_insert_styles() {
-  $insert_styles = array();
-
-  if (module_exists('imagecache')) {
-    foreach (imagecache_presets() as $preset) {
-      $insert_styles[$preset['presetname'].'|fancybox'] = array(
-        'label' => t('Fancybox: @preset image', array('@preset' => $preset['presetname']))
-      );
-    }
-  }
-
-  return $insert_styles;
-}
-
-/**
- * Implementation of hook_insert_content().
- */
-function fancybox_insert_content($item, $style, $widget) {
-  return fancybox_imagefield_image_imagecache(NULL, $item, $style['name'], NULL);
-}
-
-/**
- * Implementation of hook_field_formatter().
+ * Implementation of hook_field_formatter_view().
  */
-function fancybox_imagefield_image_imagecache($field, $item, $formatter, $node) {
+function fancybox_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
   $settings = variable_get('fancybox_settings', array());
 
-  if (!isset($item['filepath']) && isset($item['fid'])) {
-    $file = field_file_load($item['fid']);
-    $item['filepath'] = $file['filepath'];
-  }
-
-  // Image caption.
-  $item_data = $item['data'];
-  $image_title = $item_data['description'];
-  $image_title = (!empty($image_title) ? $image_title : $item_data['title']);
-  $image_title = (!empty($image_title) ? $image_title : $item_data['alt']);
+  $element = array();
 
-  if ($settings['imagefield']['use_node_title']) {
-    $image_title = $node->title;
+  // Check if the formatter involves a particular image style.
+  $matches = array();
+  if (preg_match('/([a-z0-9_]+)_fancybox/', $display['type'], $matches)) {
+    $image_style = $matches[1];
   }
 
-  $loop_item = '';
-  $nid = $item['nid'] ? $item['nid'] : ($node->nid ? $node->nid : '');
-  switch ($settings['imagefield']['grouping']) {
-    case 1:
-      $loop_item = $nid .'-'. $field;
-      break;
-    case 2:
-      $loop_item = 'all';
-      break;
+  // Check if the formatter involves a link.
+  if (strpos($display['type'], 'image_link_content') === 0) {
+    $uri = entity_uri($entity_type, $entity);
+  }
+  elseif (strpos($display['type'], 'image_link_file') === 0) {
+    $link_file = TRUE;
   }
 
-  list($namespace, $presetname) = explode('|', $formatter, 2);
+  foreach ($items as $delta => $item) {
+    if (isset($link_file)) {
+      $uri = array(
+        'path' => file_create_url($item['uri']),
+        'options' => array(),
+      );
+    }
 
-  if ($preset = imagecache_preset_by_name($namespace)) {
-    return theme('imagefield_image_imagecache_fancybox', $namespace, $field, $item['filepath'], $image_title, $loop_item);
+    //$href_uri = 'public://styles/fancybox/' . $item['filename'];
+    $style_name = isset($settings['imagefield']['imagecache_preset']) ? $settings['imagefield']['imagecache_preset'] : 0;
+    $style_path = image_style_path($style_name, $item['uri']);
+    if (!file_exists($style_path)) {
+      $style_path = image_style_url($style_name, $item['uri']);
+    }
+    $variables['path'] = file_create_url($style_path);
+    $href = file_create_url($style_path);
+
+    $element[$delta] = array(
+      '#theme' => 'image_formatter',
+      '#item' => $item,
+      '#image_style' => isset($image_style) ? $image_style : '',
+      //'#path' => isset($uri) ? $uri : '',
+      '#path' => array(
+        'path' => $href,
+        'options' => array(
+          'attributes' => array(
+            'class' => array('imagefield-fancybox'),
+          ),
+        ),
+      ),
+    );
   }
+
+  return $element;
 }
diff -U 3 -H -d -r -N -- fancybox/fancybox.theme.inc fancybox/fancybox.theme.inc
--- fancybox/fancybox.theme.inc	2010-03-14 11:52:37.000000000 +0100
+++ fancybox/fancybox.theme.inc	1970-01-01 01:00:00.000000000 +0100
@@ -1,45 +0,0 @@
-<?php
-// $Id: fancybox.theme.inc,v 1.1.2.1 2010/03/14 10:52:37 sbacelic Exp $
-
-/**
- * @file
- * Theme functions for Fancybox module.
- */
-
-
-/**
- * Theme ImageCache + Imagefield CCK field formatter.
- */
-function theme_fancybox_formatter_imagefield($element) {
-  if (module_exists('imagecache') && module_exists('imagefield')) {
-    $node = node_load($element['#item']['nid']);
-    return fancybox_imagefield_image_imagecache($element['#field_name'], $element['#item'], $element['#formatter'], $node);
-  }
-}
-
-/**
- * Theme ImageCache + Imagefield CCK field.
- */
-function theme_imagefield_image_imagecache_fancybox($namespace, $field, $path, $title = '', $loop = '', $attributes = NULL) {
-  if (!empty($path)) {
-    $attributes = drupal_attributes($attributes);
-    $imagecache_path = imagecache_create_url($namespace, $path);
-    $image = '<img src="'. $imagecache_path .'" alt="'. check_plain($alt) .'" '. $attributes .' />';
-
-    $settings = variable_get('fancybox_settings', array());
-
-    if ($presetname = $settings['imagefield']['imagecache_preset']) {
-      $link_path = imagecache_create_url($presetname, $path);
-    }
-    else {
-      $link_path = file_create_url($path);
-    }
-
-    $options = array('html' => TRUE, 'attributes' => array('title' => $title, 'class' => 'imagefield-fancybox'));
-    if ($loop) {
-      $options['attributes']['rel'] = 'imagefield-fancybox-'. $loop;
-    }
-
-    return l($image, $link_path, $options);
-  }
-}
diff -U 3 -H -d -r -N -- fancybox/js/fancybox.js fancybox/js/fancybox.js
--- fancybox/js/fancybox.js	2010-03-14 11:52:37.000000000 +0100
+++ fancybox/js/fancybox.js	2010-07-07 00:13:14.000000000 +0200
@@ -1,15 +1,20 @@
 // $Id: fancybox.js,v 1.1.2.1 2010/03/14 10:52:37 sbacelic Exp $
 
+(function($) {
+
 /**
  * Initiate Fancybox using selector and options from the module's settings.
  */
-Drupal.behaviors.initFancybox = function() {
-  var settings = Drupal.settings.fancybox;
-
-  if (settings && settings.selector.length) {
-    $(settings.selector).fancybox(settings.options);
-  }
+Drupal.behaviors.initFancybox = {
+  attach : function() {
+    var settings = Drupal.settings.fancybox;
 
-  $('.imagefield-fancybox').fancybox(settings.options);
+    if (settings && settings.selector.length) {
+      $(settings.selector).fancybox(settings.options);
+    }
 
+    $('.imagefield-fancybox').fancybox(settings.options);
+  }
 }
+
+})(jQuery);
