          function formatoutput(result){
              if (!result.error){
                  var thefeeds=result.feed.entries;
                  populateFeed(thefeeds,result.feed.link); 
              }
              else{//if error fetching feed, alert human readable error message
  	            alert(result.error.message);
              }
          }
  		
          function populateFeed(thefeeds,feedurl){
              //populate the starting divs
              var title = ""; //store the post title in ‘title’
              var theUrl = "";//store the URL in ‘theUrl’
			                
			  if (feedurl.indexOf('sickfish') != -1) { addTitle('Latest posts on my doodle blog'); }
			  if (feedurl.indexOf('philsblog') != -1) { addTitle('Latest posts on my personal blog'); }	
							
              for (var i=0; i<thefeeds.length; i++){
                  theUrl = thefeeds[i].link; //get the URL of the post
                  title = thefeeds[i].title; //get the title of the post
                  
				  
                  var divTag = document.createElement("div"); //create a new div
                  divTag.className = "recentPost"; //set the new div’s class
                  divTag.innerHTML = "<a href='" + theUrl + "'>" + title + "</a>"; //construct the HTML
				  var targetElement = document.getElementById('tumblrPosts');
                  document.getElementById('tumblrPosts').appendChild(divTag); //add the info to your HTML
              }
          }		
		  
		  function addTitle(titleText)
		  {
			  var divTag = document.createElement("div"); //create a new div
			  divTag.className = "blogTitleText"; //set the new div’s class
			  divTag.innerHTML = titleText;
			  var targetElement = document.getElementById('tumblrPosts');
			  document.getElementById('tumblrPosts').appendChild(divTag); //add the info to your HTML		  
		  }
  

