   var rssoutput = "<ul>";
   var feedcontainer = "feeddiv";
   var feedurl = "";
   var feedlimit = 5;

   google.load("feeds", "1");

   function rssfeedsetup() {
       var feedpointer = new google.feeds.Feed(feedurl);
       feedpointer.setNumEntries(feedlimit);
       feedpointer.load(displayfeed);
   }

   function displayfeed(result) {
       var rsscontainer = document.getElementById(feedcontainer);
       var format = "dmy";
       var datecss = "float: right; display: inline; text-align: right; margin-top: 2px; font-size: .85em; color: #555555;";
       var authorcss = "margin-top: 2px; margin-bottom: 5px; font-size: .85em; color: #555555;";

       if (!result.errro) {

           var twittertitle = result.feed.title;
           var twitterlink = result.feed.link;
           var thefeeds = result.feed.entries;

           for (var i = 0; i < thefeeds.length; i++) {

               rssoutput += "<li style='border-bottom: 1px dotted #CCCCCC; margin-top: 5px; margin-bottom: 7px;' >";
               rssoutput += replaceURLWithHTMLLinks(thefeeds[i].title) + "<br>";
               rssoutput += "<span style='" + datecss + "'>";
               rssoutput += generateRelativePubDate(new Date(thefeeds[i].publishedDate),format);
               rssoutput += "</span>";
               rssoutput += "<div style='" + authorcss + "'>";
               rssoutput += ">> <a href='" + twitterlink + "' target='_blank'>" + twittertitle + "</a>";
               rssoutput += "</div>";
               rssoutput += "</li>";

           }
           rssoutput += "</ul>";
           rsscontainer.innerHTML = rssoutput;
       }
       else
           alert("Error fetching feeds!");
   }

   function replaceURLWithHTMLLinks(text) { 
      var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; 
      return text.replace(exp,"<a href='$1' target='_blank'>View Link</a>");  
   }

   var strings={
      "just_done":' just done',
      "second_ago":' second ago',
      "seconds_ago":' seconds ago',
      "minute_ago":' minute ago',
      "minutes_ago":' minutes ago',
      "hour_ago":' hour ago',
      "hours_ago":' hours ago',
      "day_ago":' day ago'
   };

   var mos=[
      'January',
      'February',
      'March',
      'April',
      'May',
      'June',
      'July',
      'August',
      'September',
      'October',
      'November',
      'December'
   ];

   function generateRelativePubDate(theDate,format) {
      if (typeof(theDate) == 'string') { theDate = new Date(theDate); }
      
      var now = (new Date).getTime();
      var then = theDate.getTime();

      if (now < then) { then = now; }

      var difference = now-then;
      var daysDifference = Math.floor(difference/1000/60/60/24); 
      difference = difference - daysDifference*1000*60*60*24;
      var hoursDifference = Math.floor(difference/1000/60/60); 
      difference = difference - hoursDifference*1000*60*60;
      var minutesDifference = Math.floor(difference/1000/60); 
      difference = difference - minutesDifference*1000*60;
      var secondsDifference = Math.floor(difference/1000); 

      /* return secondsDifference.toString()+"/"+minutesDifference.toString()+"/"+hoursDifference.toString()+"/"+daysDifference; */
      
      if (daysDifference > 1) {
         if (format&&format.match(/^ymd$/i)) { 
            return [theDate.getFullYear(),mos[theDate.getMonth()],theDate.getDate()].join(' ')
         }
         else if (format&&format.match(/^dmy$/i)) { 
            return [theDate.getDate(),mos[theDate.getMonth()],theDate.getFullYear()].join(' ')
         }
         else {
            return [mos[theDate.getMonth()],theDate.getDate()+',',theDate.getFullYear()].join(' ')
         }
      } 
      else if (daysDifference == 1) { return daysDifference.toString()+strings['day_ago']; }
      else if (hoursDifference > 1) { return hoursDifference.toString()+strings['hours_ago']; }
      else if (hoursDifference == 1) { return hoursDifference.toString()+strings['hour_ago']; }
      else if (minutesDifference > 1) { return minutesDifference.toString()+strings['minutes_ago']; }
      else if (minutesDifference == 1) { return minutesDifference.toString()+strings['minute_ago']; }
      else if (secondsDifference > 1) { return secondsDifference.toString()+strings['seconds_ago']; }
      else if (secondsDifference == 1) { return secondsDifference.toString()+strings['second_ago']; }
      else { return strings['just_done']; }
      
   }

   google.setOnLoadCallback(rssfeedsetup);

