$(document).ready(function() {
	// begin flickr feed pull
	$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?id=25213436@N02&lang=en-us&format=json&jsoncallback=?", function(data){
		// append each recent photo to a li
		$.each(data.items, function(i,item){
			i = i++;
			$('<img alt="' + item.title + '"/>').attr("src", item.media.m).appendTo("ul#my-flickr-photos")
			.wrap('<li class="flickr-thumb"><a href="' + item.link + '" title="' + item.title + '" rel="lightBox"></a></li>');
			// convert to small thumb
			$("ul#my-flickr-photos li a img").each(function() {
				   var smallThumb = $(this).attr("src").replace(/_m.jpg$/i,'_s.jpg');
				   $(this).attr("src", smallThumb);
			});
			// modfiy href to regular size image
			$("ul#my-flickr-photos li a").each(function() {
				 var modURL = $(this).attr("href").replace(/_m.jpg$/i,'.jpg');
				 $(this).attr("href", modURL);
			 });
			// limit the returned image count to 15
			if ( i == 2 ) return false;
		});
		// end recent photo append
	});
	// end flickr feed pull
});
