/*
 * jQuery Sapo Fotos (http://unsignedint.net/blog/labs) - jQuery plug-in
 * Version 0.1, Released 2009.08.04
 *
 * Copyright (c) 2009 Luís Mendes (http://unsignedint.net/blog/labs)
 * Dual licensed GPL http://www.gnu.org/licenses/gpl.html 
 * and MIT http://www.opensource.org/licenses/mit-license.php
 */

(function(a){a.fn.sapoFotos=function(b){var c={user:null,tag:null,page:1,size:75,limit:9};var b=a.extend(c,b);return this.each(function(){var e=a("<ul>").appendTo(this);var d=a.sapoFotos.formatURL(b);jQuery.getScript(d,function(){var g=sapoFotosJSON.rss["channel"]["elements"];if(g==0){return}var f=sapoFotosJSON.rss["channel"]["item"];a.each(f,function(h,m){var k=m.link["value"];var l=m.title["cdata"];var j="<li><a href='"+k+"' title='"+l+"' alt='"+l+"'><img src='"+k+b.size+"x"+b.size+"' /></a></li>";e.append(j)});e.append("</ul>")})})};a.sapoFotos={formatURL:function(c){if(c.url){return c.url}var b="http://services.sapo.pt/Photos/JSON?jsonTag=sapoFotosJSON";if(c.user){b+="&u="+c.user}if(c.tag){b+="&tag="+c.tag}if(c.limit){b+="&limit="+c.limit}if(c.size){b+="&page="+c.size}return b}}})(jQuery);