// 外部JSファイル呼び出し記述
// <script language="JavaScript" type="text/javascript" src="../includes/menu.js"></script>
// 
// ======================================================================= //
// 2004/02/12 初版
// 2004/03/08 選択されているメニューについて追加
// ======================================================================= //

	var preLoad_status = "false";

/* ----------------------------------------------------------------------- 
　概要　：画像の先読込処理
　呼出　：preLoad()
　引数　：なし
　戻り値：なし

　使用されている画像の名前を利用してファイル名を取得。
　画像名の最初が下記のもの（３つ）の場合
　tab1_* , tab2_* , menu_*
----------------------------------------------------------------------- */
function preLoad() {
	if(document.images){
		menu_on_Images  = new Array();
		menu_of_Images  = new Array();
		menu_ov_Images  = new Array();

	 	tmp_img_name = "";

		for(file_loop = 0; file_loop < document.images.length; file_loop ++){

			tmp_img_name = document.images[file_loop].name ;

			// alert(tmp_img_name)

			base_folder = "../header/img/";
			menu_on_Images[tmp_img_name] = new Image();
			menu_on_Images[tmp_img_name].src = base_folder + tmp_img_name + "_on.gif";
			menu_of_Images[tmp_img_name] = new Image();
			menu_of_Images[tmp_img_name].src = base_folder + tmp_img_name + "_of.gif";
			menu_ov_Images[tmp_img_name] = new Image();
			menu_ov_Images[tmp_img_name].src = base_folder + tmp_img_name + "_ov.gif";
			menu_vi_Images[tmp_img_name] = new Image();
			menu_vi_Images[tmp_img_name].src = base_folder + tmp_img_name + "_vi.gif";
			menu_ex_Images[tmp_img_name] = new Image();
			menu_ex_Images[tmp_img_name].src = base_folder + tmp_img_name + "_ex.gif";
			menu_pr_Images[tmp_img_name] = new Image();
			menu_pr_Images[tmp_img_name].src = base_folder + tmp_img_name + "_pr.gif";
			menu_ne_Images[tmp_img_name] = new Image();
			menu_ne_Images[tmp_img_name].src = base_folder + tmp_img_name + "_ne.gif";
		}

		preLoad_status = "true";
	}
}


/* ----------------------------------------------------------------------------------------------------
　概要　：メニュー画像の変更
　呼出　：change(image_Name, image_status)
　引数　：image_Name 　= 変更するＩＭＧタグの名前 = 画像のファイル名（on,off）の前まで
　　　　　image_status = on か of 空白
　戻り値：なし

　使用例(初期値onのもの) ⇒ onMouseOut なし
　<img src="tab1_exh_on.gif" name="tab1_exh">

　使用例(通常)
　<a href="#" onMouseOver="change('tab1_exh','on');" onMouseOut="change('tab1_exh','of')">
　<img src="tab1_exh_of.gif" name="tab1_exh" border="0">
　</a>
---------------------------------------------------------------------------------------------------- */

/* ----- ヘッダー専用 ----- */
function change(image_Name, image_status) {


	if(preLoad_status == "true"){
		if(image_status=="on"){
			document.images[image_Name].src = menu_on_Images[image_Name].src;
		}
		else if(image_status=="of"){
			document.images[image_Name].src = menu_of_Images[image_Name].src;
		}
		else if(image_status=="ov"){
			document.images[image_Name].src = menu_ov_Images[image_Name].src;
		}
	}else{
		base_folder = "../header/img/";
		if(image_status==""){
			document.images[image_Name].src = base_folder + image_Name + ".gif";
		}else{
			document.images[image_Name].src = base_folder + image_Name + "_" + image_status + ".gif";
		}
	}
}


/* ----- 各ディレクトリ直下のimg用 ----- */
function change_each(image_Name, image_status) {

	base_folder = "./img/";
	if(image_status==""){
		document.images[image_Name].src = base_folder + image_Name + ".gif";
	}else{
		document.images[image_Name].src = base_folder + image_Name + "_" + image_status + ".gif";
	}
}

/* ----------------------------------------------------------------------------------------------------
　概要　：リロード時に再読込をする　NN4への対応
　呼出　：resize()
　引数　：なし
　戻り値：なし

　<body onResize="resize();">
---------------------------------------------------------------------------------------------------- */

function resize(e){
	if (document.layers) {window.location.reload();}
}

/* ----------------------------------------------------------------------------------------------------
　概要　：画像の変更
　呼出　：change(image_Name, image_status)
　引数　：image_Name 　= 変更するＩＭＧタグの名前 = 画像のファイル名（on,off）の前まで
　　　　　image_status = on か of 空白
　戻り値：なし

　使用例(初期値onのもの) ⇒ onMouseOut なし
　<img src="tab1_exh_on.gif" name="tab1_exh">

　使用例(通常)
　<a href="#" onMouseOver="change('tab1_exh','on');" onMouseOut="change('tab1_exh','of')">
　<img src="tab1_exh_of.gif" name="tab1_exh" border="0">
　</a>
---------------------------------------------------------------------------------------------------- */

function btchange(image_Name, image_status) {

	base_folder = "./img/";
	if(image_status==""){
		document.images[image_Name].src = base_folder + image_Name + ".gif";
	}else{
		document.images[image_Name].src = base_folder + image_Name + "_" + image_status + ".gif";
	}
}

/* ----------------------------------------------------------------------------------------------------
　概要　：画像の変更
　呼出　：change(image_Name, image_status)
　引数　：image_Name 　= 変更するＩＭＧタグの名前 = 画像のファイル名（on,off）の前まで
　　　　　image_status = on か of 空白
　戻り値：なし

　使用例(初期値onのもの) ⇒ onMouseOut なし
　<img src="tab1_exh_on.gif" name="tab1_exh">

　使用例(通常)
　<a href="#" onMouseOver="change('tab1_exh','on');" onMouseOut="change('tab1_exh','of')">
　<img src="tab1_exh_of.gif" name="tab1_exh" border="0">
　</a>
---------------------------------------------------------------------------------------------------- */

function btplchange(image_Name, image_status, image_place) {

	base_folder = "./img/";
	if(image_status==""){
		document.images[image_place].src = base_folder + image_Name + ".gif";
	}else{
		document.images[image_place].src = base_folder + image_Name + "_" + image_status + ".gif";
	}
}

// ================================================================================================== //
// 　以下のfunctionは不要（上記functionひとつで対応）
// ================================================================================================== //


/* ----------------------------------------------------------------------------------------------------
　概要　：無線スポットの説明windowをOPEN
　呼出　：
　引数　：
　戻り値：
---------------------------------------------------------------------------------------------------- */
   function musen_spot(){ w = window.open("http://www.ceatec.com/ja/2005/musen-spot/musen_spot.htm","popAc","directories=0,location=0,menubar=0,scrollbars=1,toolbar=0,resizable=1,top=20,left=20,width=680,height=620"); w.focus();
   }
/* ----------------------------------------------------------------------------------------------------
　概要　：バックボーンの説明windowをOPEN　＞for 会場図　Hall1 to 8 ezchpages
　呼出　：
　引数　：
　戻り値：
---------------------------------------------------------------------------------------------------- */
   function backbone(){ w = window.open("http://www.ceatec.com/ja/2005/backbone/backbone.html","popAc","directories=0,location=0,menubar=0,scrollbars=1,toolbar=0,resizable=1,top=20,left=20,width=800,height=620"); w.focus();
   }

/* ----------------------------------------------------------------------------------------------------
　概要　：カウントダウン
　呼出　：
　引数　：
　戻り値：

カウントダウン部分の様子を日付と時間で切り替える
会期10月4日～10月8日

通常									：開催まであと00日
会期前日（10/3　18：00～）				：まもなく開催
	<td align='right'>
	<div style='background: #002A6A;margin-left: 10px;'><img src='../header/img/ceatec_count_mamonaku.gif' width='44' height='32' alt='まもなく開催'></div></td>
	<td><img src='../header/img/ceatec_count_name.gif' width='171' height='12' alt='シーテック ジャパン 2005'><br>
	<img src='../header/img/ceatec_count_date.gif' width='171' height='20' alt='10月4日（火）→8日（土） 幕張メッセ'></td>

会期中（10/4　10：00～10/8　17：00）	：開催中
	<td align='right'><div style='background: #002A6A;margin-left: 10px;'><img src='../header/img/ceatec_count_kaisaichuu.gif' width='44' height='32' alt='開催中'></div></td>
	<td><img src='../header/img/ceatec_count_name.gif' width='171' height='12' alt='シーテック ジャパン 2005'><br>
	<img src='../header/img/ceatec_count_date.gif' width='171' height='20' alt='10月4日（火）→8日（土） 幕張メッセ'></td>

会期後（10/8　17：00～）				：トルツメ
	<td align='right'>
	<img src='../header/img/spacer.gif' alt='' width='1' height='1'>
	</td>

---------------------------------------------------------------------------------------------------- */
function countdown(){
	//変数宣言
	var dtToday = new Date();

	//記念日をいれてください。
	//注意：月は０からスタートしているのに注意。(10月5日は2004,9,05)
	var dtCeatecOpen = new Date(2005,9,4);
	var dtCeatecClose = new Date(2005,9,8);

	//計算結果を表示していきます。
	var days = (dtCeatecOpen.getTime() - dtToday.getTime())/(24*60*60*1000);
	var close_days = (dtCeatecClose.getTime() - dtToday.getTime())/(24*60*60*1000);
	
	//残りの日数。最も近くて大きい整数を返す、Math.ceil()
        var nokori = Math.ceil(days)
        var nokori2 = Math.ceil(close_days)
        //alert(nokori)

	//０から９までの画像を用意してください。
	//画像のURLを宣言します。
	var strPicture = new Array(
		"../header/img/ceatec_count_0.gif",
		"../header/img/ceatec_count_1.gif",
		"../header/img/ceatec_count_2.gif",
		"../header/img/ceatec_count_3.gif",
		"../header/img/ceatec_count_4.gif",
		"../header/img/ceatec_count_5.gif",
		"../header/img/ceatec_count_6.gif",
		"../header/img/ceatec_count_7.gif",
		"../header/img/ceatec_count_8.gif",
		"../header/img/ceatec_count_9.gif");

	//2桁に揃えておく
	//var str = nokori + ", " + dtToday.getHours() + ", " + nokori2
	//alert(str);
	//document.write("?" + dtToday.getHours() + "?");
	if (nokori > 0 ){
		if (nokori < 10)
		{
			nokori = "0" + nokori;
		}else{
	                nokori = "" + nokori;
		}

		//数字に画像を当てるための準備です。
		var imgDate;
		imgDate= nokori.toString();

		//ここから表示
		if (nokori == 1 && dtToday.getHours() >= 18){
			document.write("<td align='right'><div style='background: #002A6A;margin-left: 10px;'><img src='../header/img/ceatec_count_mamonaku.gif' width='44' height='32' alt='まもなく開催'></div></td>");
			document.write("<td><img src='../header/img/ceatec_count_name.gif' width='171' height='12' alt='シーテック ジャパン 2005'><br><img src='../header/img/ceatec_count_date.gif' width='171' height='20' alt='10月4日（火）→8日（土） 幕張メッセ'></td>");
		} else {
			document.write("<td align='right'><div style='background: #002A6A;margin-left: 10;'><img src='../header/img/ceatec_count_001.gif' width='44' height='11' alt='開催まで'><br><img src='"+ strPicture[nokori.substring(0,1)] + "' width='15' height='21'><img src='"+ strPicture[nokori.substring(1,2)] + "' width='15' height='21'><img src='../header/img/ceatec_count_002.gif' width='11' height='21' alt='日'></div></td>");
			document.write("<td><img src='../header/img/ceatec_count_name.gif' width='171' height='12' alt='シーテック ジャパン 2005'><br><img src='../header/img/ceatec_count_date.gif' width='171' height='20' alt='10月4日（火）→8日（土） 幕張メッセ'></td>");
		}

	}else{
		//ここから表示
		if(nokori2 >= 0){
			//台風情報
			//document.write('<tr>');
			//document.write('<TD><a href="../news_webmag/infor.html" target="_blank"><img src="img/taifuu.gif" border="0"></a></TD>');
			//document.write('</tr>');
			
			//通常会期中
			if (nokori == 0 && dtToday.getHours() < 10){
				document.write("<td align='right'><div style='background: #002A6A;margin-left: 10px;'><img src='../header/img/ceatec_count_mamonaku.gif' width='44' height='32' alt='まもなく開催'></div></td>");
				document.write("<td><img src='../header/img/ceatec_count_name.gif' width='171' height='12' alt='シーテック ジャパン 2005'><br><img src='../header/img/ceatec_count_date.gif' width='171' height='20' alt='10月4日（火）→8日（土） 幕張メッセ'></td>");
			} else if (nokori2 == 0 && dtToday.getHours() >= 17) {
				document.write("<td align='right'>");
				document.write("<img src='../header/img/spacer.gif' alt='' width='1' height='1'></td>");
				document.write("<td><img src='../header/img/ceatec_count_name.gif' width='171' height='12' alt='シーテック ジャパン 2005'><br><img src='../header/img/ceatec_count_date.gif' width='171' height='20' alt='10月4日（火）→8日（土） 幕張メッセ'></td>");
			} else {
				document.write("<td align='right'><div style='background: #002A6A;margin-left: 10px;'><img src='../header/img/ceatec_count_kaisaichuu.gif' width='44' height='32' alt='開催中'></div></td>");
				document.write("<td><img src='../header/img/ceatec_count_name.gif' width='171' height='12' alt='シーテック ジャパン 2005'><br><img src='../header/img/ceatec_count_date.gif' width='171' height='20' alt='10月4日（火）→8日（土） 幕張メッセ'></td>");
			}
			//document.write("<tr>");
			//document.write("<td rowspan='3'><img name='countbase01_w' src='img/countbase01_w.gif' width='68' height='46' border='0'></td>");
			//document.write("<td colspan='2'><img name='countbase02_w' src='img/countbase02_w.gif' width='44' height='8'border='0'></td>");
			//document.write("<td rowspan='3'><img name='countbase04_w' src='img/countbase04_w.gif' width='16' height='46' border='0'></td>");
			//document.write("</tr>");
			//document.write("<tr><TD><img src='img/count_0.gif'></TD>");
			//document.write("<TD><img src='"+ strPicture[nokori2] + "'></TD></tr>");
			//document.write("<tr>");
			//document.write("<td colspan='2'><img name='countbase03_w' src='img/countbase03_w.gif' width='44' height='8' border='0'></td>");
			//document.write("</tr>");

			//2003
			//document.write("<TD VALIGN='baseline'><img src='img/shuuryou_made.gif'></TD>");
			//document.write("<TD><img src='img/count_0.gif'></TD>");
			//document.write("<TD><img src='"+ strPicture[nokori2] + "'></TD>");
			//document.write("<TD><img src='img/nichi.gif'></TD>");

		}else{
			if(nokori2 < 0){
				document.write("<td align='right'>");
				document.write("<img src='../header/img/spacer.gif' alt='' width='1' height='1'></td>");
				document.write("<td><img src='../header/img/ceatec_count_name.gif' width='171' height='12' alt='シーテック ジャパン 2005'><br><img src='../header/img/ceatec_count_date.gif' width='171' height='20' alt='10月4日（火）→8日（土） 幕張メッセ'></td>");
			}
		}
	}
	    return;
}

