/****************************************************
 * jQuery RSS Plugin by fieeeld
 * version: 0.04 (2008/12/01)
 * @requires jQuery v1.2.6 or later
 *
 * Demo at: http://tpfields.xrea.jp/demo/js/sitefeeds/
 *
 ****************************************************/
$(function(){
	$.ajax({
		url: "http://www.ohda-jc.jp/10/information/feeds/rss2.0.xml",//RSSファイル名
		async: true,
		cache: false,
		dataType:"xml",
		success: function(xml){
			$('item' , xml).each(function(i){
                /* 初期設定で3件出力します。件数を変更は"i > 2"の部分を修正してください。
                   数値は"出力したい件数 - 1"を入力して下さい。*/
                if ( i > 4 ) {
                    return false;
                }
				var title = $('title', this).text();
				var url = $('link' , this).text();
				var cont = $('content' , this).text();
				
               

				//日付を整形
				var date = dateParse($('pubDate' , this).text());
				//"2008/10/14  ほにゃらら" の形式で出力
				$('#feedList').append('<li><div class="clearfix"><em>'+date[0]+'</em><a href="'+url+'">'+title+date[1]+'</a><a href="'+url+'"><img src="http://www.ohda-jc.jp/10/images/botm2.jpg" alt="詳しく見る" align="absmiddle" class="botom" /></a></div></li>');
    		});
		}
	});
});

//dateParse: "2008/10/14" 形式
function dateParse(str){
    var objDate = new Date(str);
    var nowDate = new Date();
    //現在の日付との差を計算
    myDay = Math.floor((nowDate.getTime()-objDate.getTime()) / (1000*60*60*24)) + 1;
    //もし3日以内なら"new!"マーク
    if (myDay < 3 ){
        var newMsg = '  <span style="color:#ff6666">NEW!</span>';
    } else {
        var newMsg = '';
    }
    var year = objDate.getFullYear();
    var month = objDate.getMonth() + 1;
    var date = objDate.getDate();
    if ( month < 10 ) { month = "0" + month; }
    if ( date < 10 ) { date = "0" + date; }
    str = year + '.' + month + '.' + date;
    rtnValue = new Array(2);
    rtnValue[0] = str;
    rtnValue[1] = newMsg;
    return rtnValue;
}

$(function(){
	$.ajax({
		url: "http://www.ohda-jc.jp/10/report/feeds/rss2.0.xml",//RSSファイル名
		async: true,
		cache: false,
		dataType:"xml",
		success: function(xml){
			$('item' , xml).each(function(i){
                /* 初期設定で3件出力します。件数を変更は"i > 2"の部分を修正してください。
                   数値は"出力したい件数 - 1"を入力して下さい。*/
                if ( i > 9 ) {
                    return false;
                }
				var title = $('title', this).text();
				var url = $('link' , this).text();
				var cont = $('content' , this).text();
				
				
               

				//日付を整形
				var date = dateParse($('pubDate' , this).text());
				//"2008/10/14  ほにゃらら" の形式で出力
				
				var cate = $('category' , this).text();
				if (cate == "総務広報委員会" ){
        		var cateMsg = '<a href="'+url+'" title="総務広報委員会" class="newscate1">総務広報委員会</a>';} 
				if (cate == "相生実践委員会" ){
        		var cateMsg = '<a href="'+url+'" title="相生実践委員会" class="newscate2">相生実践委員会</a>';} 
				if (cate == "青少年育成委員会" ){
        		var cateMsg = '<a href="'+url+'" title="青少年育成委員会" class="newscate3">青少年育成委員会</a>';} 
				if (cate == "地域力開発委員会" ){
        		var cateMsg = '<a href="'+url+'" title="地域力開発委員会" class="newscate4">地域力開発委員会</a>';} 
				if (cate == "組織改革準備会議" ){
        		var cateMsg = '<a href="'+url+'" title="組織改革準備会議" class="newscate5">組織改革準備会議</a>';} 
				if (cate == "事務局" ){
        		var cateMsg = '<a href="'+url+'" title="事務局" class="newscate6">事務局</a>';} 
				
				$('#feed1').append('<dl><dt>'+cateMsg+date[0]+'</dt><dd><a href="'+url+'">'+title+'</a>'+date[1]+'</dd></dl>');
    		});
		}
	});
});

//dateParse: "2008/10/14" 形式
function dateParse(str){
    var objDate = new Date(str);
    var nowDate = new Date();
    //現在の日付との差を計算
    myDay = Math.floor((nowDate.getTime()-objDate.getTime()) / (1000*60*60*24)) + 1;
    //もし3日以内なら"new!"マーク
    if (myDay < 3 ){
        var newMsg = '  <span style="color:#ff6666">NEW!</span>';
    } else {
        var newMsg = '';
    }
    var year = objDate.getFullYear();
    var month = objDate.getMonth() + 1;
    var date = objDate.getDate();
    if ( month < 10 ) { month = "0" + month; }
    if ( date < 10 ) { date = "0" + date; }
    str = year + '.' + month + '.' + date;
    rtnValue = new Array(2);
    rtnValue[0] = str;
    rtnValue[1] = newMsg;
    return rtnValue;
}

$(function(){
	$.ajax({
		url: "http://www.ohda-jc.jp/10/blog/feeds/rss2.0.xml",//RSSファイル名
		async: true,
		cache: false,
		dataType:"xml",
		success: function(xml){
			$('item' , xml).each(function(i){
                /* 初期設定で3件出力します。件数を変更は"i > 2"の部分を修正してください。
                   数値は"出力したい件数 - 1"を入力して下さい。*/
                if ( i > 9 ) {
                    return false;
                }
				var title = $('title', this).text();
				var url = $('link' , this).text();
				var cont = $('content' , this).text();
				
               

				//日付を整形
				var date = dateParse($('pubDate' , this).text());
				//"2008/10/14  ほにゃらら" の形式で出力
				$('#blogList').append('<li><div class="clearfix"><em>'+date[0]+'</em><a href="'+url+'">'+title+date[1]+'</a><a href="'+url+'"><img src="http://www.ohda-jc.jp/10/images/botm2.jpg" alt="詳しく見る" align="absmiddle" class="botom" /></a></div></li>');
    		});
		}
	});
});

//dateParse: "2008/10/14" 形式
function dateParse(str){
    var objDate = new Date(str);
    var nowDate = new Date();
    //現在の日付との差を計算
    myDay = Math.floor((nowDate.getTime()-objDate.getTime()) / (1000*60*60*24)) + 1;
    //もし3日以内なら"new!"マーク
    if (myDay < 3 ){
        var newMsg = '  <span style="color:#ff6666">NEW!</span>';
    } else {
        var newMsg = '';
    }
    var year = objDate.getFullYear();
    var month = objDate.getMonth() + 1;
    var date = objDate.getDate();
    if ( month < 10 ) { month = "0" + month; }
    if ( date < 10 ) { date = "0" + date; }
    str = year + '.' + month + '.' + date;
    rtnValue = new Array(2);
    rtnValue[0] = str;
    rtnValue[1] = newMsg;
    return rtnValue;
}

$(function(){
	$.ajax({
		url: "http://www.ohda-jc.jp/10/banner/feeds/rss2.0.xml",//RSSファイル名
		async: true,
		cache: false,
		dataType:"xml",
		success: function(xml){
			$('item' , xml).each(function(i){
                /* 初期設定で3件出力します。件数を変更は"i > 2"の部分を修正してください。
                   数値は"出力したい件数 - 1"を入力して下さい。*/
                if ( i > 9 ) {
                    return false;
                }
				
				var cont = $('content' , this).text();
				var img = $(cont).find("p").slice(0).html();
				$('#bannarList').append(''+img+'<br />');
    		});
		}
	});
});

