/**
setAttribute()メソッドを使って画像のマウスオーバー／マウスアウトイベントを実装する。

■引数
 id, rollover時の画像パス, rollout時の画像パス, ... 
 をロールオーバーしたい画像の数だけ繰り返す
 
■使い方：window.onload = function() { ...この中で... } 
var myMethod = new onRollOverIMG( 'ID1', 'img/m1.gif', 'img/m1a.gif', 'ID2', 'img/m2.gif', 'img/m2a.gif',...);
*/
var onRollOverIMG = function(){

	//onMouseOver, onMouseOutを追加していく
	for ( var j = 0; j < arguments.length; j+=3 ) {
		
		//マウスイベント用メソッドの生成
		var func1 = "this.src='" + arguments[j+1] + "'";	//rollOut時
		var func2 = "this.src='" + arguments[j+2] + "'";	//rollOver時
		
		//ブラウザ別の設定：IEはマウスイベント名を全て小文字で
		if( document.all ){ /*IE系*/
			document.getElementById( arguments[j] ).setAttribute( 'onmouseover', new Function( func2 ) );
			document.getElementById( arguments[j] ).setAttribute( 'onmouseout', new Function( func1 ) );
		} else {	/*非IE系*/
			document.getElementById( arguments[j] ).setAttribute( 'onMouseOver', func2 );
			document.getElementById( arguments[j] ).setAttribute( 'onMouseOut', func1 );
		}
	}
	
};




// for Cookie

if (!navigator.cookieEnabled) {
	alert("クッキーへの書き込みができません。\rクッキーを有効にしないと、当サイト閲覧で不具合がでる可能性があります。\rクッキーを有効にしてください。");
} else {
	
	var $label = "IndexHtml";
	var $cookie = document.cookie+";";
	var $startValue = $cookie.indexOf( $label + '=' );
	
	
	if( $startValue == -1 ) {	// クッキーが読み出せないとき Cookieの書込みとtop.htmlへリダイレクト
	
		// クッキーを書込む：ラベル, 値, 有効期間
		// writeCookie( $label, 1, setTimeLimit( 1 ) );
		writeCookieWhileSession( $label, 1 );
		
		//ドメイン
			$domein = 'http://www.ntcltd.com/';
		if(  location.href == $domein + 'index.html' || location.href == $domein ) location.href = $domein + 'top.html';
	
	} else {
		writeCookieWhileSession( $label, 1 );
		//alert( "OK" );
		//document.cookie = $label + "=;expires=Thu,01-Jan-70 00:00:01 GMT"; /* ブラウザを終了するとクッキー削除 */ 
	}
	
}


// 有効期限を設定
function setTimeLimit( _day ){
	var timelimit = new Date();
	timelimit.setTime(timelimit.getTime()+( _day*1000*60*60*24 ));
	//
	return timelimit.toGMTString();
}

// クッキーの書込み
function writeCookie( _label, _value, _limit ){
		// Cookieの書き込み
		document.cookie = _label+"="+escape(_value)+";expires=" + _limit;
}
// こっちはセッション間のみ：ブラウザを閉じるとクッキーも消える
function writeCookieWhileSession( _label, _value ){
		// Cookieの書き込み
		document.cookie = _label+"="+escape(_value)+";expires=";
}