diff -ruN plugin.20060429/flickr.rb plugin/flickr.rb
--- plugin.20060429/flickr.rb	2006-04-29 22:36:32.000000000 +0900
+++ plugin/flickr.rb	2006-09-25 16:49:31.000000000 +0900
@@ -24,6 +24,10 @@
 require 'md5'
 require 'rexml/document'
 
+add_header_proc do
+  %Q|\t<script type="text/javascript" src="js/lightbox.js"></script>\n|
+end
+
 def flickr(photo_id, size = nil, place = 'flickr')
   unless @conf['flickr.apikey'] || @conf['flickr.apikey'].empty?
     return '[ERROR] flickr.rb: API Key is not specified.'
@@ -37,7 +41,12 @@
   if @cgi.mobile_agent?
     body = %Q|<a href="#{photo[:src]}">#{photo[:title]}</a>|
   else
-    body = %Q|<a href="#{photo[:page]}"><img title="#{photo[:title]}" alt="#{photo[:title]}" src="#{photo[:src]}" class="#{place}"|
+    # XXX: Lightbox JS
+    if photo[:larger_src]
+      body = %Q|<a href="#{photo[:larger_src]}" rel="lightbox" title="#{photo[:title]} (<a href=&quot;#{photo[:page]}&quot;>Flickr</a>)"><img title="#{photo[:title]}" alt="#{photo[:title]}" src="#{photo[:src]}" class="#{place}"|
+    else
+      body = %Q|<a href="#{photo[:page]}"><img title="#{photo[:title]}" alt="#{photo[:title]}" src="#{photo[:src]}" class="#{place}"|
+    end
     body << %Q| width="#{photo[:width]}"| if photo[:width]
     body << %Q| height="#{photo[:height]}"| if photo[:height]
     body << %Q|></a>|
@@ -65,6 +74,7 @@
       photo[:title] = res.elements['//rsp/photo/title'].text
     }
     flickr_open('flickr.photos.getSizes', photo_id) {|f|
+      allsize = []
       res = REXML::Document.new(f)
       res.elements.each('//rsp/sizes/size') do |s|
         if s.attributes['label'].downcase == size.downcase
@@ -72,6 +82,25 @@
           photo[:width] = s.attributes['width']
           photo[:height] = s.attributes['height']
         end
+	allsize << [
+	  s.attributes['width'].to_i*s.attributes['height'].to_i,
+	  s.attributes['source']
+	]
+      end
+      # XXX: Lightbox JS
+      if photo[:src]
+	photo[:larger_src] = nil
+	allsize.sort!
+	allsize.each_with_index {|tinfo, tidx|
+	  if tinfo[1] == photo[:src]
+	    if allsize[tidx + 2]
+	      photo[:larger_src] = allsize[tidx + 2][1]
+	    elsif allsize[tidx + 1]
+	      photo[:larger_src] = allsize[tidx + 1][1]
+	    end
+	    break
+	  end
+	}
       end
     }
   rescue Exception => e
