//レイヤー名の定義
if(ie4) {
	EP = document.all["EPic"];	//拡大画像用
	ES1 = document.all["EScope1"];	//拡大可能範囲の枠画像用(1)
	BA = document.all["BArrow"];	//吹き出しの矢印画像用
	ES2 = document.all["EScope2"];	//拡大可能範囲の枠画像用(2)
	ES3 = document.all["EScope3"];	//拡大可能範囲の枠画像用(3)
	EP.style.visibility = "hidden";
	ES1.style.visibility = "hidden";
	BA.style.visibility = "hidden";
	ES2.style.visibility = "hidden";
	ES3.style.visibility = "hidden";
	EP.style.zIndex = 1;	//拡大画像用レイヤーの表示順設定
	ES1.style.pixelLeft = 440;	//各拡大可能範囲枠レイヤーの表示位置設定
	ES1.style.pixelTop = 340;
	ES2.style.pixelLeft = 300;
	ES2.style.pixelTop = 240;
	ES3.style.pixelLeft = 511;
	ES3.style.pixelTop = 300;
}
if(dom) {
	EP = document.getElementById("EPic");	//拡大画像用
	ES1 = document.getElementById("EScope1");	//拡大可能範囲の枠画像用(1)
	BA = document.getElementById("BArrow");	//吹き出しの矢印画像用
	ES2 = document.getElementById("EScope2");	//拡大可能範囲の枠画像用(2)
	ES3 = document.getElementById("EScope3");	//拡大可能範囲の枠画像用(3)
	EP.style.visibility = "hidden";
	ES1.style.visibility = "hidden";
	BA.style.visibility = "hidden";
	ES2.style.visibility = "hidden";
	ES3.style.visibility = "hidden";
	EP.style.zIndex = 1;
}
if(ie5) {
	EP.style.zIndex = 1;
	ES1.style.pixelLeft = 440;
	ES1.style.pixelTop = 340;
	ES2.style.pixelLeft = 300;
	ES2.style.pixelTop = 240;
	ES3.style.pixelLeft = 511;
	ES3.style.pixelTop = 300;
}
if(nn4) {
	EP = document.layers["EPic"];	//拡大画像用
	ES1 = document.layers["EScope1"];	//拡大可能範囲の枠画像用(1)
	BA = document.layers["BArrow"];	//吹き出しの矢印画像用
	ES2 = document.layers["EScope2"];	//拡大可能範囲の枠画像用(2)
	ES3 = document.layers["EScope3"];	//拡大可能範囲の枠画像用(3)
	EP.visibility = "hide";
	ES1.visibility = "hide";
	BA.visibility = "hide";
	ES2.visibility = "hide";
	ES3.visibility = "hide";
	EP.bgColor = "#ffffff";
	BA.background.src = more_expand_area_array[0];//拡大可能範囲枠画像の設定
	ES1.background.src = more_expand_area_array[1];
	ES2.background.src = more_expand_area_array[2];
	ES3.background.src = more_expand_area_array[3];
	EP.zIndex = 1;
	ES1.moveTo(440, 340);
	ES2.moveTo(300, 240);
	ES3.moveTo(511, 300);
}
if(nn6) {
	EP.style.backgroundColor = "rgb(255,255,255)";
	BA.style.backgroundImage = "url(" + more_expand_area_array[0] + ")";
	ES1.style.backgroundImage = "url(" + more_expand_area_array[1] + ")";
	ES2.style.backgroundImage = "url(" + more_expand_area_array[2] + ")";
	ES3.style.backgroundImage = "url(" + more_expand_area_array[3] + ")";
	EP.style.zIndex = 1;
	ES1.style.left = "440px";
	ES1.style.top = "340px";
	ES2.style.left = "300px";
	ES2.style.top = "240px";
	ES3.style.left = "511px";
	ES3.style.top = "300px";
}
if(opera) {
	EP.style.backgroundColor = "#ffffff";
	BA.style.backgroundImage = "url(" + more_expand_area_array[0] + ")";
	ES1.style.backgroundImage = "url(" + more_expand_area_array[1] + ")";
	ES2.style.backgroundImage = "url(" + more_expand_area_array[2] + ")";
	ES3.style.backgroundImage = "url(" + more_expand_area_array[3] + ")";
	EP.style.zIndex = 1;
	ES1.style.left = 440;
	ES1.style.top = 340;
	ES2.style.left = 300;
	ES2.style.top = 240;
	ES3.style.left = 511;
	ES3.style.top = 300;
}

//表示した拡大画像別に科目一覧へのリンクアドレスを作成
function checkimage(){
	var	ckimg;
	var	bgimg_head = "";
	var	bgimg_tail = "";
	var	link_address_head = "http://www.edogawa-med.jp/cgi-bin/map.cgi?t1=";
	var	link_address_tail = "&t2=0&";
	var	fname_str;
	var	fname_str2;
	var	i = 0;

	//前処理
	//Netscape 4.x
	if(nn4){
		ckimg = EP.background.src;
	}
	//IE、他
	else{
		ckimg = EP.style.backgroundImage;
		bgimg_head = "url(";
		bgimg_tail = ")";
	}

	//表示中の地図画像ファイルの特定
	for( i=0; i<pic_fname_all.length; i++ ){
		//IE、他用
		fname_str = bgimg_head + pic_fname_all[i] + bgimg_tail;
		//Firefox用
		fname_str2 = bgimg_head + "\"" + pic_fname_all[i] + "\"" + bgimg_tail;

		if( ckimg==fname_str || ckimg==fname_str2 )	break;
	}

	//科目一覧へのリンクアドレスを作成
	location.href = link_address_head + i + link_address_tail;
}

//区全体図のロールオーバー処理
function img_rollover(no, no_src, parm){
	//拡大画像表示中の地域はロールオーバーさせない
	if( no!=flag ){
		var str = "map_p" + no;
		if( parm )
			//ロールオーバー画像
			no_src.src = str + "_over.gif";
		else
			//通常画像
			no_src.src = str + ".gif";
	}
}

//拡大画像レイヤーの可視・不可視
function changeVisible(p_no1, p_no2) {
	//拡大可能範囲枠の場合
	if(p_no2 > 0){
		//拡大可能範囲の枠画像（レイヤー）を非表示
		//Netscape 4.x
		if(nn4){
			ES1.visibility = "hide";
			ES2.visibility = "hide";
			ES3.visibility = "hide";
		}
		//IE、他
		else{
			ES1.style.visibility = "hidden";
			ES2.style.visibility = "hidden";
			ES3.style.visibility = "hidden";
		}

		//拡大画像レイヤーのサイズを設定
		var	W = more_expand_pic_size_array[0][p_no2];
		var	H = more_expand_pic_size_array[1][p_no2];
		//Netscape 4.x
		if(nn4){
			EP.resizeTo(W,H);
		}
		//IE 4.x 以上
		else if(ie){
			EP.style.pixelWidth = W;
			EP.style.pixelHeight = H;
		}
		//Netscape 6.x 以上
		else if(nn6){
			EP.style.width = W + "px";
			EP.style.height = H + "px";
		}
		//Opera
		else if(opera){
			EP.style.width = W;
			EP.style.height = H;
		}

		//拡大画像レイヤーに画像ファイルを設定
		//Netscape 4.x
		if(nn4){
			EP.background.src = more_expand_pic_array[p_no2];
		}
		//IE、他
		else{
			EP.style.backgroundImage = "url(" + more_expand_pic_array[p_no2] + ")";
		}

	}
	else{
		//拡大画像表示状態のチェック用フラグ
		var	vis = 0;

		//拡大画像が非表示状態の場合フラグON
		//Netscape 4.x
		if(nn4){
			if(EP.visibility == "hide")	vis = 1;
			BA.background.src = more_expand_area_array[0];
			ES1.background.src = more_expand_area_array[1];
			ES2.background.src = more_expand_area_array[2];
			ES3.background.src = more_expand_area_array[3];
		}
		//IE、他
		else{
			if(EP.style.visibility == "hidden")	vis = 1;
		}

		//拡大画像のサイズ取得
		var	W = expand_pic_size_array[0][p_no1];
		var	H = expand_pic_size_array[1][p_no1];
		//吹き出し矢印の表示位置取得
		var	T = arrow_array[0][p_no1];
		var	L = arrow_array[1][p_no1];
		//拡大画像のファイル名取得
		var	bgimg = expand_pic_array[p_no1];

		//拡大画像が非表示状態の場合
		if( vis ){
			//Netscape 4.x
			if(nn4){
				EP.resizeTo(W,H);
				EP.visibility = "show"
				EP.background.src = bgimg;
				BA.moveTo(L,T);
				BA.visibility = "show";
				switch(p_no1){
					case 1:
						ES1.visibility = "show";
						break;
					case 7:
						ES2.visibility = "show";
						ES3.visibility = "show";
						break;
					default:
						ES1.visibility = "show";
						ES2.visibility = "show";
						ES3.visibility = "show";
				}
			}
			//IE、他
			else{
				//IE 4.x 以上
				if(ie){
					EP.style.pixelWidth = W;
					EP.style.pixelHeight = H;
					BA.style.pixelTop = T;
					BA.style.pixelLeft = L;
				}
				//Netscape 6.x 以上
				else if(nn6){
					EP.style.width = W + "px";
					EP.style.height = H + "px";
					BA.style.top = T + "px";
					BA.style.left = L + "px";
				}
				//Opera
				else if(opera){
					EP.style.width = W;
					EP.style.height = H;
					BA.style.top = T;
					BA.style.left = L;
				}
				EP.style.visibility = "visible";
				EP.style.backgroundImage = "url(" + bgimg + ")";
				BA.style.visibility = "visible";
				switch(p_no1){
					case 1:
						ES1.style.visibility = "visible";
						break;
					case 7:
						ES2.style.visibility = "visible";
						ES3.style.visibility = "visible";
						break;
					default:
						ES1.style.visibility = "hidden";
						ES2.style.visibility = "hidden";
						ES3.style.visibility = "hidden";
				}
			}
			//表示画像Noフラグに表示状態にした画像Noを設定
			flag = p_no1;
		}
		//拡大画像が表示状態の場合
		else{
			//Netscape 4.x
			if(nn4){
				//一度全レイヤーを非表示
				EP.visibility = "hide";
				ES1.visibility = "hide";
				BA.visibility = "hide";
				ES2.visibility = "hide";
				ES3.visibility = "hide";
				//表示中の地域以外がクリックされた場合
				if( p_no1 != flag ){
					//拡大画像を表示
					EP.resizeTo(W,H);
					EP.visibility = "show";
					EP.background.src = bgimg;
					BA.moveTo(L,T);
					BA.visibility = "show";
					//拡大可能範囲の枠画像（レイヤー）を表示
					switch(p_no1){
						case 1:
							ES1.visibility = "show";
							break;
						case 7:
							ES2.visibility = "show";
							ES3.visibility = "show";
							break;
						default:
							ES1.visibility = "hide";
							ES2.visibility = "hide";
							ES3.visibility = "hide";
					}
					//前回選択されていた地域の画像を通常状態に変更
					var str = "map_p" + flag;
					var	img_rl = document.layers[str];
					img_rl.src = str + ".gif";
					//表示画像Noフラグに表示状態にした画像Noを設定
					flag = p_no1;
				}
				//同じ地域がクリックされた場合
				else{
					//表示画像Noフラグをクリア
					flag = 0;
				}
			}
			//IE、他
			else{
				//一度全レイヤーを非表示
				EP.style.visibility = "hidden";
				ES1.style.visibility = "hidden";
				BA.style.visibility = "hidden";
				ES2.style.visibility = "hidden";
				ES3.style.visibility = "hidden";
				//
				if( p_no1 != flag ){
					//IE 4.x 以上
					if(ie){
						EP.style.pixelWidth = W;
						EP.style.pixelHeight = H;
						BA.style.pixelTop = T;
						BA.style.pixelLeft = L;
					}
					//Netscape 6.x 以上
					else if(nn6){
						EP.style.width = W + "px";
						EP.style.height = H + "px";
						BA.style.top = T + "px";
						BA.style.left = L + "px";
					}
					//Opera
					else if(opera){
						EP.style.width = W;
						EP.style.height = H;
						BA.style.top = T;
						BA.style.left = L;
					}
					EP.style.visibility = "visible";
					EP.style.backgroundImage = "url(" + bgimg + ")";
					BA.style.visibility = "visible";

					switch(p_no1){
						case 1:
							ES1.style.visibility = "visible";
							break;
						case 7:
							ES2.style.visibility = "visible";
							ES3.style.visibility = "visible";
							break;
						default:
							ES1.style.visibility = "hidden";
							ES2.style.visibility = "hidden";
							ES3.style.visibility = "hidden";
					}

					//先に表示されていた画像（レイヤー）のオブジェクトを取得
					var str = "map_p" + flag;
					//区全体図のロールオーバー画像を通常状態に
					if( document.all[str] )
						document.all[str].src = str + ".gif";
					else
						document.getElementById(str).src = str + ".gif";
					//表示画像Noフラグに新たに表示した画像Noを設定
					flag = p_no1;
				}
				else{
					flag = 0;
				}
			}
		}
	}
}
