/*
 * Flickr for jQuery or how you want to call it ;)
 *
 * Author: Michael Mayer (http://www.nulldevice.de/)
 * Licensed under the GPL v2
 * Date: May 6, 2008
 * 
 * Documentation: Simply add one or more containers like 
 * <div class="flickrFeed" maxItems="10" 
 * href="http://api.flickr.com/services/feeds/photos_public.gne?id=12602671@N04&lang=en-us&format=json">
 * </div>
 * to your Web page and that's it! Your own RSS feed URL can 
 * be found on your personal flickr photostream page at 
 * the bottom. Don't forget to change the format parameter to 
 * "json" (default is "rss_200").
 * Enjoy it!
 * 
 * No guarantee whatsoever of course :)
 */
(function ($) { 
	jsonFlickrFeed = function (data) {
		var container = $('.flickrFeed');

		container.each(function() {
			$(this).show();

			if($(this).attr('maxItems')) {
				var maxItems = parseInt($(this).attr('maxItems'));
			} else {
				var maxItems = 5;
			}
			
			for (var i in data.items) {
				if(i >= maxItems) break;
				$(this).append('<div class="flickrPhoto"><div><a href="' 
                + data.items[i].link
                + '"><img src="' 
                + data.items[i].media.m  
                + '" alt="' + data.items[i].title 
                + '" title="' + data.items[i].title
                + '" /></a></div></div>');
			}
		});
	}

	$(document).ready( function () {
		$.getScript($('.flickrFeed').attr('href'));
	});

}) (jQuery);

