/********************************************************************************/
/*	Api_news_index																*/
/*	Api_news_list																*///★未使用
/*	Api_news_detail																*///★未使用
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/*	Api_last_update																*/
/*	Api_groups																	*/
/********************************************************************************/
/*	110725	新規作成															*/
/********************************************************************************/


/******************************************************************************************************************************************************************/


/********************************************************************************/
/* 引 数 1：[str]json															*/
/********************************************************************************/
/* 戻り値 ：なし																*/
/********************************************************************************/
function Api_news_index(json)
{
	//str
	var tag	= "";

	json = eval(json);


	for(var y = 0, cnt = json.length; y < cnt; y++)
	{
		tag+= '	<li><a href="http://sankokai.sakura.ne.jp/news/detail.php?id=' + json[y].id + '">' + json[y].title + '</a>(' + json[y].dates_open + ')</li>' + "\n";
	}
	document.getElementById("news").innerHTML = tag;
}


/********************************************************************************/
/* 引 数 1：[str]json															*/
/********************************************************************************/
/* 戻り値 ：なし																*/
/********************************************************************************/
function Api_news_list(json)
{
	//str
	var tag	= "";


	json = eval(json);


	for(var y = 0, cnt = json.length; y < cnt; y++)
	{
		tag+=	'	<tr>'																					+ "\n" +
				'		<th>' + json[y].dates_open + '</th>'												+ "\n" +
				'		<td><a href="detail.html?id=' + json[y].id + '">' +  json[y].title + '</a></td>'	+ "\n" +
				'	</tr>'																					+ "\n";
	}
	Wrap.myInnerHTML( document.getElementById("news"), tag );	//tableタグ内をinnerHTMLで書き換えるとIEでエラーとなるので、関数を噛ませる
}


/********************************************************************************/
/* 引 数 1：[str]json															*/
/********************************************************************************/
/* 戻り値 ：なし																*/
/********************************************************************************/
function Api_news_detail(json)
{
	document.getElementById("news_dates_open").innerHTML= json.dates_open;
	document.getElementById("news_title").innerHTML		= json.title;


	if("undefined" != typeof json._next_)
	{
		document.getElementById("next").innerHTML= '<li class="prev"><a href="detail.html?id=' + json._next_ + '">←前の記事へ</a></li>';
	}

	if("undefined" != typeof json._prev_)
	{
		document.getElementById("prev").innerHTML= '<li class="next"><a href="detail.html?id=' + json._prev_ + '">次の記事へ→</a></li>';
	}


	if("" != json.image_path)
	{
		document.getElementById("news_image_path").innerHTML = '<img src="' + json.image_path + '" style="margin-bottom:20px;" />';
	}
	document.getElementById("news_body").innerHTML = json.body;
}


/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/


/********************************************************************************/
/* 引 数 1：[str]日付(YYYY-mm-dd)												*/
/********************************************************************************/
/* 戻り値 ：なし																*/
/********************************************************************************/
function Api_last_update(dates)
{
	document.getElementById("last_update").innerHTML = dates;
}


/********************************************************************************/
/* 引 数 1：[str]json															*/
/********************************************************************************/
/* 戻り値 ：なし																*/
/********************************************************************************/
function Api_groups(json)
{
	//str
	var tag	= "";
	var tr;


	json = eval(json);


	//グループループ
	for(var y = 0, cnt_y = json.length; y < cnt_y; y++)
	{
		//施設ループ
		tr = "";

		for(var x = 0, cnt_x = json[y].length; x < cnt_x; x++)
		{
			tr+='	<tr>'																	+ "\n" +
				'		<td class="emptyShisetsu">'	+ json[y][x].name			+ '</td>'	+ "\n" +
				'		<td>'						+ json[y][x].tel			+ '</td>'	+ "\n" +
				'		<td>'						+ json[y][x].cnt_empty_floor+ '</td>'	+ "\n" +
//				'		<td>'						+ json[y][x].cnt_tandby		+ '</td>'	+ "\n" +	//先方指示で非表示に
				'	</tr>'																	+ "\n";
		}

		if("" != tr)
		{
			tag+=	'<h5 class="emptyTitle"><span>■ </span>' + json[y][0].name__groups + '</h5>'					+ "\n" +
					'<table width="580" border="0" cellspacing="1" cellpadding="0" class="st-table2 emptyTable">'	+ "\n" +
					'	<tr>'																						+ "\n" +
					'		<th width="46%" class="emptyShisetsu">施設名</th>'										+ "\n" +
					'		<th width="40%">連絡先</th>'															+ "\n" +
					'		<th width="14%">空</th>'																+ "\n" +
//					'		<th width="12%">待機数</th>'															+ "\n" +	//先方指示で非表示に
					'	</tr>'																						+ "\n" +
					tr																								+
					'</table>'																						+ "\n";
		}
	}
	document.getElementById("groups").innerHTML = tag;
}
