/*
 * jGFeed 1.0 - Google Feed API abstraction plugin for jQuery
 *
 * Copyright (c) 2009 jQuery HowTo
 *
 * Licensed under the GPL license:
 *   http://www.gnu.org/licenses/gpl.html
 *
 * URL:
 *   http://jquery-howto.blogspot.com
 *
 * Author URL:
 *   http://me.boo.uz
 *
 */
(function($){
  $.extend({
    jGFeed : function(url, fnk, num, key){
      // Make sure url to get is defined
      if(url == null) return false;
      // Build Google Feed API URL
      var gurl = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q="+url;
      if(num != null) gurl += "&num="+num;
      if(key != null) gurl += "&key="+key;
      // AJAX request the API
      $.getJSON(gurl, function(data){
        if(typeof fnk == 'function')
		  fnk.call(this, data.responseData.feed);
		else
		  return false;
      });
    }
  });
})(jQuery);

$.jGFeed('http://rssmix.the-search.jp/22191.rdf',
function(feeds){
  if(!feeds){
    return false;
  }
  for(var i=0; i<feeds.entries.length; i++){
    var entry = feeds.entries[i];
		var date = new Date(entry.publishedDate);
		var url = entry.link;
		var blogid = url.substring(23); //Length of "http://www.matsuaz.biz/"
		blogid = blogid.substring(0, blogid.indexOf("/"));
		var pday =date.getDate();
		var pmonth = date.getMonth() + 1;
		var pyear = date.getFullYear();
		var entryDate = pyear + "/" +pmonth + "/" + pday;
    $("#feed").append("<li><div class='" + blogid + "'>" + entryDate +"</div><a href='"+entry.link +"'>" + entry.title + "</a></li>");
  }
}, 10);



