// http://phalkunz.blogspot.com/2007/05/recent-flickrs-photos-with-javascript.html
// http://code.google.com/apis/ajaxfeeds/signup.html
// fyrebear.com google api key - ABQIAAAAGOfAw09NSLVQY4x7m_ClVRTRJqGMeOkNsDOoW3f2-5nhAElDXxQKyFv8vjVc6Cu6aJIrNgYtO4UWAw
// This code will pull in umlates Flickr feed
 
    google.load("feeds", "1");
 
    function initialize() {
      var spaces = "&nbsp;";
      totalNumOfPics = 18;
      numOfPicsPerRow = 3;
      
      var feed1 = new google.feeds.Feed("http://api.flickr.com/services/feeds/groups_pool.gne?id=72784924@N00&lang=en-us&format=rss_200");
      feed1.setNumEntries(totalNumOfPics);
      
      feed1.load(function(result) {
        if (!result.error) {
          var container = document.getElementById("feed1");
          numOfEntries =  result.feed.entries.length;
          
          for (var i = 0; i < numOfEntries; i++) {
            var entry = result.feed.entries[i];
         
  container.innerHTML += formatThumb(entry.link, getThumbUrl(entry.content)) + spaces;     
  			if ((i+1)%numOfPicsPerRow==0) container.innerHTML += "</br>";                 
          }
        }
      });
    }
    google.setOnLoadCallback(initialize);

function getThumbUrl(st){
				
				// eliminate the the first para
				ind1 = st.indexOf("http://farm");
				st = st.substring(ind1, st.length);
				
				ind2 = st.indexOf("\"");
				st = st.substring(0, ind2);
				st = st.replace("_m.","_s.");
				
				return st;
				
	}


	function formatThumb(link,thumb){
		return "<a target=\"_blank\" href=" + link + "><img src="+ thumb +"></img></a>" ;
	}
 
    


