
jQuery(function(){
	_loadRss();
});

// RSS読み込み
function _loadRss(){
	var loadRss = '/ajax/rss_list.php?noPage=1&type=';
	var TYPE_ARRAY = new Array();
	TYPE_ARRAY[0] = ['pickup_rss', 'pickUp'];
	TYPE_ARRAY[1] = ['sports_base_rss', 'sportsBase'];
	TYPE_ARRAY[2] = ['outfitters_rss', 'outfitters'];
	TYPE_ARRAY[3] = ['cookinfo_rss', 'cookinfo'];
	TYPE_ARRAY[4] = ['cookblog_rss', 'cookblog'];

	// 一つ目(ピックアップ)
	jQuery.ajax({
		type: "GET",
		url: loadRss + TYPE_ARRAY[0][0],
		success: function(response){
			jQuery('#' + TYPE_ARRAY[0][1]).html(response);
		},
		error: function(){jQuery('#' + TYPE_ARRAY[0][1]).html('<li>データの取得に失敗しました</li>'); },
		complete: function(){
			// 二つ目(スポーツベース)
			jQuery.ajax({
				type: "GET",
				url: loadRss + TYPE_ARRAY[1][0],
				success: function(response){
					jQuery('#' + TYPE_ARRAY[1][1]).html(response);
				},
				error: function(){jQuery('#' + TYPE_ARRAY[1][1]).html('<li>データの取得に失敗しました</li>'); },
				complete: function(){

					// 3つ目(アウトフィッターズ)
					jQuery.ajax({
						type: "GET",
						url: loadRss + TYPE_ARRAY[2][0],
						success: function(response){
							jQuery('#' + TYPE_ARRAY[2][1]).html(response);
						},
						error: function(){jQuery('#' + TYPE_ARRAY[2][1]).html('<li>データの取得に失敗しました</li>'); },
						complete: function(){

							// 4つ目(料理教室情報)
							jQuery.ajax({
								type: "GET",
								url: loadRss + TYPE_ARRAY[3][0],
								success: function(response){
									jQuery('#' + TYPE_ARRAY[3][1]).html(response);
								},
								error: function(){jQuery('#' + TYPE_ARRAY[3][1]).html('<li>データの取得に失敗しました</li>'); },
								complete: function(){

									// 5つ目(料理教室ブログ)
									jQuery.ajax({
										type: "GET",
										url: loadRss + TYPE_ARRAY[4][0],
										success: function(response){
											jQuery('#' + TYPE_ARRAY[4][1]).html(response);
										},
										error: function(){jQuery('#' + TYPE_ARRAY[3][1]).html('<li>データの取得に失敗しました</li>'); },
										complete: function(){
											_loadLastModified();
											_setBlankLink();
										}
									});
								}
							});

						
						}
					});
				}
			});
		}
	});
}

// ハンジロとシップスの最終更新日
function _loadLastModified(){
	jQuery.ajax({
		type: "GET",
		url: '/ajax/last_modified.php',
		success: function(response){
			var list = response.split(',');
			jQuery('#shipsLastModified').html(list[1]);
			jQuery('#hanjiroLastModified').html(list[0]);
		},
		error: function(){ alert('通信エラー'); },
		complete: function(){
			_setBlankLink();
		}
	});
}


