/*------------------------------------------------------
	
	各カテゴリTOP用JS （5件表示）
	
------------------------------------------------------*/


function topNews() {
	var objs = newsData.data;

	var htmlData = ''; // 共通のHTMLを格納し、forの処理後にdocument.write()
	htmlData += '<dl>';

	if (5 <= objs.length) {

		for (var i = 0; i < 5; i++) {
			htmlData += '<dt>' + objs[i].disp_date + '<img src="/common/images/topics_ic00' + objs[i].categoryId + '.gif" alt="' + objs[i].categoryName + '" width="44" height="13" /></dt>';

			if (objs[i].link == '1') { // 通常時
				htmlData += '<dd><a href="' + objs[i].url + '">';
				htmlData += objs[i].title + '</a></dd>';
			} else if (objs[i].link == '2') { // 外部リンク
				if (objs[i].window == '1') {
					htmlData += '<dd><a href="' + objs[i].url + '" target="_blank">';
					htmlData += objs[i].title + '<img src="/common/images/com_ic003.gif" alt="" width="15" height="14" /></a></dd>';
				} else if (objs[i].window == '0') {
					htmlData += '<dd><a href="' + objs[i].url + '">';
					htmlData += objs[i].title + '</a></dd>';
				}
			} else if (objs[i].link == '3') { // PDF
				htmlData += '<dd><a href="' + objs[i].url + '" target="_blank">';
				htmlData += objs[i].title + '（PDF:' + objs[i].pdf_file_size + 'KB）<img src="/common/images/com_ic004.gif" alt="" width="15" height="15" /></a></dd>';
			} else if (objs[i].link == '4') {　 // リンクなし文言
				htmlData += '<dd>' + objs[i].title + '</dd>';
			}
		}

	} else if (5 > objs.length) {

		for (var i = 0; i < objs.length; i++) {
			htmlData += '<dt>' + objs[i].disp_date + '<img src="/common/images/topics_ic00' + objs[i].categoryId + '.gif" alt="' + objs[i].categoryName + '" width="44" height="13" /></dt>';

			if (objs[i].link == '1') { // 通常時
				htmlData += '<dd><a href="' + objs[i].url + '">';
				htmlData += objs[i].title + '</a></dd>';
			} else if (objs[i].link == '2') { // 外部リンク
				if (objs[i].window == '1') {
					htmlData += '<dd><a href="' + objs[i].url + '" target="_blank">';
					htmlData += objs[i].title + '<img src="/common/images/com_ic003.gif" alt="" width="15" height="14" /></a></dd>';
				} else if (objs[i].window == '0') {
					htmlData += '<dd><a href="' + objs[i].url + '">';
					htmlData += objs[i].title + '</a></dd>';
				}
			} else if (objs[i].link == '3') { // PDF
				htmlData += '<dd><a href="' + objs[i].url + '" target="_blank">';
				htmlData += objs[i].title + '（PDF:' + objs[i].pdf_file_size + 'KB）<img src="/common/images/com_ic004.gif" alt="" width="15" height="15" /></a></dd>';
			} else if (objs[i].link == '4') {　 // リンクなし文言
				htmlData += '<dd>' + objs[i].title + '</dd>';
			}
		}

	}
	htmlData += '</dl>';
	document.write(htmlData);
}
topNews();

/* sample HTML code
<dl>
	<dt>2008年00月00日<img src="../common/images/topics_ic003.gif" alt="" width="44" height="13" /></dt>
	<dd><a href="DUMMY" class="outLink02">テキストテキストテキスト</a></dd>
	<dt>2008年00月00日<img src="../common/images/topics_ic003.gif" alt="" width="44" height="13" /></dt>
	<dd><a href="DUMMY">テキストテキストテキストテキスト<img src="../common/images/com_ic003.gif" alt="" width="15" height="14" /></a></dd>
	<dt>2008年00月00日<img src="../common/images/topics_ic003.gif" alt="" width="44" height="13" /></dt>
	<dd><a href="DUMMY">テキストテキストテキストテキスト<img src="../common/images/com_ic004.gif" alt="" width="15" height="15" /></a></dd>
	<dt>2008年00月00日<img src="../common/images/topics_ic003.gif" alt="" width="44" height="13" /></dt>
	<dd>テキストテキストテキストテキストテキスト</dd>
</dl>*/

