// function.js - UTN GLOBAL SITE 共通 JavaScript 関数群
// Copyright(c) 2004 Nippon Data Corporation / All Rights Reserved
// Programmed by Tsuyoshi Wada

// Usage: 利用する HTML の <head> タグ内に下記のようなソースを埋め込めばよい。
//        <script language="JavaScript" src="_common/script/function.js"></script>

// History
// -------
// 2004-04-16 着手 (T.Wada)
// 2004-04-26 最終更新日時取得関数追加 (T.Wada)

//=============================================================================
// Windows の IE5 以上なら true
function utnIsExtend()
{
	var blnResult = false;
	if (window.navigator.platform == 'Win32') {
		// Windows である
		var idxPos = window.navigator.appVersion.indexOf("MSIE");
		if (0 < idxPos) {
			// Internet Explorer である
			if (5 <= window.navigator.appVersion.charAt(idxPos + 5)) {
				// Internet Explorer 5.0 以上 ('MSIE 5.0' 以上)
				if (window.navigator.userAgent.indexOf("Opera") == -1) {
					// Opera ではない (Opera は User Agent を偽装できるための対策)
					blnResult = true;
				}
			}
		}
	}
	return blnResult;
}

//=============================================================================
// 日時文字列定義
m_aMonthStr_en = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');

//=============================================================================
// 日時関連下位関数
function m_utnGetYear(dtDate)
{
	var strYear;
	strYear = String(dtDate.getFullYear());
	return strYear;
}
function m_utnGetMonth_ja(dtDate)
{
	var strMonth;
	strMonth = String(dtDate.getMonth() + 1);
	if (strMonth.length < 2) {
		strMonth = '0' + strMonth;
	}
	return strMonth;
}
function m_utnGetMonth_en(dtDate)
{
	var strMonth;
	strMonth = m_aMonthStr_en[dtDate.getMonth()];
	return strMonth;
}
function m_utnGetDate(dtDate)
{
	var strDate;
	strDate = String(dtDate.getDate());
	if (strDate.length < 2) {
		strDate = '0' + strDate;
	}
	return strDate;
}

//=============================================================================
// 最終更新日時取得
function utnGetDateJA()
{
	// 例: 2004年04月01日
	dtLast = new Date(document.lastModified);
	return m_utnGetYear(dtLast) + '年' + m_utnGetMonth_ja(dtLast) + '月' + m_utnGetDate(dtLast) + '日';
}
function utnGetDateEN()
{
	// 例: 01 Apr, 2004
	dtLast = new Date(document.lastModified);
	return m_utnGetDate(dtLast) + ' ' + m_utnGetMonth_en(dtLast) + ', ' + m_utnGetYear(dtLast);
}

//=============================================================================
// 文字列前後の空白削除
function utnTrimStr(strRaw)
{
	var strCooked = '';
	if (0 < strRaw.length) {
		strCooked = strRaw.replace(/^\s+|\s+$/g, "");
	}
	return strCooked;
}

//=============================================================================
// 表示言語の切り替え
function utnChangeLanguage()
{
	window.open('index.php.' + document.utnLanguage.utnSelLang.value , '_self')
}

