/*------------------------------------------------------
	
	重要なお知らせ用JS （3件表示）
	
------------------------------------------------------*/


function topNews() {
	var objs = newsEmergencyData.data;

	if(displayFlag == 0) {
		return false
	} else {
		var htmlData = ''; // 共通のHTMLを格納し、forの処理後にdocument.write()
		htmlData += '<div id="emergencyBox"><div class="inner"><h2><img src="/images/emergency_tx001.gif" alt="重要なお知らせ" width="148" height="21" /></h2><div id="toAllLink"><p class="iconLink01"><a href="/important/index.html">重要なお知らせ一覧</a></p></div><dl id="emergencyNewsBox">';
		
		if (3 <= objs.length) {
	
			for (var i = 0; i < 3; i++) {
				htmlData += '<dt>' + objs[i].disp_date + '</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 (3 > objs.length) {
	
			for (var i = 0; i < objs.length; i++) {
				htmlData += '<dt>' + objs[i].disp_date + '</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></div></div>';
		document.write(htmlData);
	}

}
topNews();

/* sample HTML code
<dl>
	<dt>2008年00月00日</dt>
	<dd><a href="../DUMMY" class="outLink02">テキストテキストテキスト</a></dd>
	<dt>2008年00月00日</dt>
	<dd><a href="../DUMMY">テキストテキストテキストテキスト<img src="../common/images/com_ic003.gif" alt="" width="15" height="14" /></a></dd>
	<dt>2008年00月00日</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>*/
