// Creates the Friday Design Face widget on my About page.
// It's based off of the tutorial found at Viget Inspire: http://www.viget.com/inspire/using-the-flickr-api/

function jsonFlickrApi(rsp) {
 if (rsp.stat != "ok"){
  // If this executes, something broke!
  return;
 }
 
 //variable "s" is going to contain 
 //all the markup that is generated by the loop below
 var s = "";
 
 //this loop runs through every item and creates HTML 
 for (var i=0; i < 1; i++) {
  photo = rsp.photos.photo[ i ];
  
  //notice that "t.jpg" is where you change the
  //size of the image
  t_url = "http://farm" + photo.farm + 
  ".static.flickr.com/" + photo.server + "/" + 
  photo.id + "_" + photo.secret + ".jpg";
    
  p_url = "http://www.flickr.com/photos/" + 
  photo.owner + "/" + photo.id;

  p_title = photo.title;
  
  s +=  '<a href="' + p_url + '">' + '<img alt="'+ photo.title + '"src="' + t_url + '"/>' + '</a><p class="caption"><a href="' + p_url + '">' + p_title + '</a> from Flickr</p>';
 }

 document.writeln(s); 
 //this tells the JavaScript to write 
 //everything in variable "s" onto the page
}