jQuery.fn.protectImage = function(settings) {
   settings = jQuery.extend({
      image: 'blank.gif',
      zIndex: 10
   }, settings);
   return this.each(function() {

      var position = $(this).offset();
      var height = $(this).height();
      var width = $(this).width();
      var srcimg = this;

      var protect = $('<img />').attr({
         width: width,
         height: height,
         src: settings.image
      }).css({
         /*border: '1px solid #f00',*/
         top: position.top,
         left: position.left,
         position: 'absolute',
         zIndex: settings.zIndex
      }).bind(
         'mouseenter', function() { 
         if($(srcimg).hasClass('imagecache-product_list')) {
            $(srcimg).toggleClass('hovering');
         }
         $(srcimg).trigger("mouseenter");
      }).bind(
         'mouseleave', function() { 
         if($(srcimg).hasClass('imagecache-product_list')) {
            $(srcimg).toggleClass('hovering');
         }
         $(srcimg).trigger("mouseleave");
      });

      if($(srcimg).parent().get(0).tagName == "A") {
         link = $(srcimg).parent().clone();
         link.html(protect);
         link.appendTo('body');
      }
      else {
         $(protect).appendTo('body');
      }
   });
};

