/* -------------------------------------------------------------------------- */
/*
 * @fileoverview
 *  Script for Top Page (Initialization Script).
 *
 * @version rev 0.0.1 2009-12-11
 * jQuery 1.2.6
 * jFeed 3.1

 */
/* -------------------------------------------------------------------------- */


$(function() {
	// Feed情報
	// サイト内Feed: '(FeedのURI)' or 外部Feed: '(proxy.phpへのパス)?url=(FeedのURI)'
	var feedsUrls = [
		'/common/php/proxy.php?url=http://campcamp.jugem.jp/?mode=rss',
		'/common/php/proxy.php?url=http://sugamogamo.jugem.jp/?mode=rss'
	];

	// 取得したFeedを挿入するID
	var insertIDs = [
		'#feed1',
		'#feed2'
	];

	// 見出し画像ファイルのパス
	var insertHeadingImages = [
		'/common/img/h_campcamp.gif',
		'/common/img/h_sugamogamo.gif'
	];

	$.each(feedsUrls,function(i) {
		jQuery.getFeed({
			url: feedsUrls[i],
			success: function(feed) {
				var html = '<ul>';
				for(var j = 0; j < feed.items.length && j < 10; j++) {
					var item = feed.items[j];
					html += '<li>' + '<a href=\"' + item.link + '\"  class=\"externalLink"\">' + item.title + '</a>' + '</li>';
				}
				jQuery(insertIDs[i]).append(html);
				html += '</ul>';

				// Init innerfade
				jQuery(insertIDs[i] + ' ul').innerfade({ 
					animationtype: 'fade',
					speed: 'slow',
					timeout: 5000,
					type: 'random_start'
				});
			}
		});
	});
});
