/**
 * rssheadline.js
 * 
 * 2008/08/20 Tomoaki Shibata
 */

if( typeof syun == 'undefined' ) {
    syun = {};
}

syun.RSSHeadline = function () {
    return {
	show : function(id, url, max) {
	    if(typeof max == 'undefined') { max = -1; }
	    $.getJSON('http://pipes.yahoo.com/saiten/feez2json?_render=json&_callback=?&url=' + url, null, function(xml) {         
		var cnt = 0;
		$.each(xml['value']['items'], function(k, v) { 
		    if(max < 0 || cnt < max) {
			$('<li></li>').html('<a href="' + v.link + '">' + v.title +'</a>').appendTo(id);
			cnt++;
		    }
		});
	    });
	}
    };
}();

