var msgsAll = "";
var msgsBTN = "";
var dispFlg = "0";

$(function(){

	var brsCheck = function(){ //
		if(!chkAjaBrowser()){
			document.location.href = 'brs_msg.html';
		} else {
			return;
		}
	}

	dispContents = function(oj) {
		eval("seRes = "+oj.responseText);
		if(seRes.mtRengo == "err1") {
			msgsAll = "<div style='text-align:center;color:red;font-size:14px;'>申し訳ございません。現在このページは表示できません。</div>";
		} else {
			var dispYear = seRes.sendYear;
			if(seRes.rengoAlls[0].data0 == "noDatas") {
				switch(dispFlg) {
					case "0":
					var myMsg = "今年度の情報はございません";
					msgsBTN = "<table width='500' border='0' align='center' cellpadding='5' cellspacing='0'>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'><img src='../../img/sankaku_simple_r.gif' width='15' height='11'><font size='2'><a href='#' onClick=\"lastYearDisp()\">福祉委員会全体　"+(dispYear - 1)+"年4月から"+dispYear+"年3月までの活動はこちら</a></font></td>";
					msgsBTN += "</tr>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'></td>";
					msgsBTN += "</tr>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'><img src='../../img/sankaku_simple_r.gif' width='15' height='11'><font size='2'><a href='#' onClick=\"yearBeforeDisp()\">福祉委員会全体　"+(dispYear - 2)+"年4月から"+(dispYear - 1)+"年3月までの活動はこちら</a></font></td>";
					msgsBTN += "</tr>";
					msgsBTN += "</table>";
					break;
					
					case "1":
					var myMsg = (dispYear - 1)+"年4月から"+dispYear+"年3月までの情報はございません";
					msgsBTN = "<br /><br /><br /><table width='500' border='0' align='center' cellpadding='5' cellspacing='0'>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'><img src='../../img/sankaku_simple_r.gif' width='15' height='11'><font size='2'><a href='#' onClick=\"nowYearDisp()\">福祉委員会全体　"+dispYear+"年4月以降の活動はこちら</a></font></td>";
					msgsBTN += "</tr>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'></td>";
					msgsBTN += "</tr>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'><img src='../../img/sankaku_simple_r.gif' width='15' height='11'><font size='2'><a href='#' onClick=\"yearBeforeDisp()\">福祉委員会全体　"+(dispYear - 2)+"年4月から"+(dispYear - 1)+"年3月までの活動はこちら</a></font></td>";
					msgsBTN += "</tr>";
					msgsBTN += "</table>";
					break;
					
					case "2":
					var myMsg = (dispYear - 2)+"年4月から"+(dispYear - 1)+"年3月までの情報はございません";				
					msgsBTN = "<br /><br /><br /><table width='500' border='0' align='center' cellpadding='5' cellspacing='0'>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'><img src='../../img/sankaku_simple_r.gif' width='15' height='11'><font size='2'><a href='#' onClick=\"nowYearDisp()\">福祉委員会全体　"+dispYear+"年4月以降の活動はこちら</a></font></td>";
					msgsBTN += "</tr>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'></td>";
					msgsBTN += "</tr>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'><img src='../../img/sankaku_simple_r.gif' width='15' height='11'><font size='2'><a href='#' onClick=\"lastYearDisp()\">福祉委員会全体　"+(dispYear - 1)+"年4月から"+dispYear+"年3月までの活動はこちら</a></font></td>";
					msgsBTN += "</tr>";
					msgsBTN += "</table>";
					titleMsg = (dispYear - 2)+"年4月から"+(dispYear - 1)+"年3月まで";
					break;				
				}
				msgsAll = "<div style='text-align:center;color:red;font-size:14px;'>"+myMsg+"</div>";
				msgsAll += msgsBTN;
			} else {
				switch(dispFlg) {
					case "0":
					msgsBTN = "<table width='500' border='0' align='center' cellpadding='5' cellspacing='0'>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'><img src='../../img/sankaku_simple_r.gif' width='15' height='11'><font size='2'><a href='#' onClick=\"lastYearDisp()\">福祉委員会全体　"+(dispYear - 1)+"年4月から"+dispYear+"年3月までの活動はこちら</a></font></td>";
					msgsBTN += "</tr>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'></td>";
					msgsBTN += "</tr>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'><img src='../../img/sankaku_simple_r.gif' width='15' height='11'><font size='2'><a href='#' onClick=\"yearBeforeDisp()\">福祉委員会全体　"+(dispYear - 2)+"年4月から"+(dispYear - 1)+"年3月までの活動はこちら</a></font></td>";
					msgsBTN += "</tr>";
					msgsBTN += "</table>";
					titleMsg = "<font style='font-size:14px;color:red'>&nbsp;&nbsp;&nbsp;&nbsp;"+dispYear+"年4月以降</font>";
					break;
					
					case "1":
					msgsBTN = "<table width='500' border='0' align='center' cellpadding='5' cellspacing='0'>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'><img src='../../img/sankaku_simple_r.gif' width='15' height='11'><font size='2'><a href='#' onClick=\"nowYearDisp()\">福祉委員会全体　"+dispYear+"年4月以降の活動はこちら</a></font></td>";
					msgsBTN += "</tr>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'></td>";
					msgsBTN += "</tr>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'><img src='../../img/sankaku_simple_r.gif' width='15' height='11'><font size='2'><a href='#' onClick=\"yearBeforeDisp()\">福祉委員会全体　"+(dispYear - 2)+"年4月から"+(dispYear - 1)+"年3月までの活動はこちら</a></font></td>";
					msgsBTN += "</tr>";
					msgsBTN += "</table>";
					titleMsg = "<font style='font-size:14px;color:red'>&nbsp;&nbsp;&nbsp;&nbsp;"+(dispYear - 1)+"年4月から"+dispYear+"年3月まで</font>";
					break;
					
					case "2":
					msgsBTN = "<table width='500' border='0' align='center' cellpadding='5' cellspacing='0'>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'><img src='../../img/sankaku_simple_r.gif' width='15' height='11'><font size='2'><a href='#' onClick=\"nowYearDisp()\">福祉委員会全体　"+dispYear+"年4月以降の活動はこちら</a></font></td>";
					msgsBTN += "</tr>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'></td>";
					msgsBTN += "</tr>";
					msgsBTN += "<tr>";
					msgsBTN += "<td height='23' valign='top' align='center'><img src='../../img/sankaku_simple_r.gif' width='15' height='11'><font size='2'><a href='#' onClick=\"lastYearDisp()\">福祉委員会全体　"+(dispYear - 1)+"年4月から"+dispYear+"年3月までの活動はこちら</a></font></td>";
					msgsBTN += "</tr>";
					msgsBTN += "</table>";
					titleMsg = "<font style='font-size:14px;color:red'>&nbsp;&nbsp;&nbsp;&nbsp;"+(dispYear - 2)+"年4月から"+(dispYear - 1)+"年3月まで</font>";
					break;					
				
				}
				msgsAll = "<table width='500' border='0' align='center' cellpadding='5' cellspacing='0' class='line120'>";
				msgsAll += "<tr><td valign='top' class='tiikifukusi'><font size='2'><a name='2'></a></font>福祉委員会全体"+titleMsg+"</td></tr>";
				for(var i = 0;i < seRes.rengoAlls.length;i++){
					msgsAll += "<tr><td valign='top' class='yohaku20'><font size='2'>";
					msgsAll += seRes.rengoAlls[i].data0+"&nbsp;&nbsp;"+seRes.rengoAlls[i].data1;
					msgsAll += "</font></td></tr>";
					msgsAll += "<tr><td height='42' valign='top' class='line120'><font size='2'>";
					msgsAll += seRes.rengoAlls[i].data2;
					msgsAll += "</font></td></tr>";
					msgsAll += "<tr><td valign='top' class='line120' align='right'>";
					msgsAll += seRes.rengoAlls[i].data3;
					msgsAll += "</td></tr>";												
				}
				msgsAll += "</table>";
			    msgsAll += "<br>";	  
			    msgsAll += "<table width='500' border='0' align='center' cellpadding='0' cellspacing='0'>";
			    msgsAll += "<tr>";
			    msgsAll += "<td><div align='right'><a href='ugoki.html'><font size='2'>このページの上に戻る</font></a></div></td>";
			    msgsAll += "</tr>";
			    msgsAll += "</table>"; 
			    msgsAll += "<br>";
				msgsAll += msgsBTN;
			}
		}
		$('#contentsAll').html(msgsAll);
	}
	
	var loadingImg = "<div style='margin:10px;font-size:14px;'><img src='../img/indicator_medium.gif' width='20'>&nbsp;&nbsp;<font style='color:gray'>しばらくお待ちください</font></div>";
	$('#contents').html(loadingImg);		
	sendRequest(dispContents,{action: 'allDisps'},'POST','mod/fukushiAllMain.php',true,true);

	lastYearDisp = function(){
		dispFlg = "1";
 		var loadingImg = "<div style='margin:10px;font-size:14px;'><img src='../img/indicator_medium.gif' width='20'>&nbsp;&nbsp;<font style='color:gray'>しばらくお待ちください</font></div>";
		$('#contents').html(loadingImg);
		sendRequest(dispContents,{action: 'lastYear'},'POST','mod/fukushiAllMain.php',true,true);	 
	}

	yearBeforeDisp = function(){
		dispFlg = "2";
 		var loadingImg = "<div style='margin:10px;font-size:14px;'><img src='../img/indicator_medium.gif' width='20'>&nbsp;&nbsp;<font style='color:gray'>しばらくお待ちください</font></div>";
		$('#contents').html(loadingImg);
		sendRequest(dispContents,{action: 'yearBefore'},'POST','mod/fukushiAllMain.php',true,true);	 
	}
	
	nowYearDisp = function(){
		dispFlg = "0";
 		var loadingImg = "<div style='margin:10px;font-size:14px;'><img src='../img/indicator_medium.gif' width='20'>&nbsp;&nbsp;<font style='color:gray'>しばらくお待ちください</font></div>";
		$('#contents').html(loadingImg);
		sendRequest(dispContents,{action: 'allDisps'},'POST','mod/fukushiAllMain.php',true,true); 
	}
});
