//init
tier_cnt=0;
root_path="";

//renewはテストディレクトリ名
//違う名前を付けたい場合は、カンマ区切りで追加してください。
//本番用
root_path_str = new Array("www.zojoji.or.jp","zojoji.or.jp","124.108.39.14");

//テスト用
//root_path_str = new Array("beta");

pathCheck = String(document.location);

//サファリ対策
if( navigator.appVersion.indexOf("Safari") ){
	urls = pathCheck.split(":/");
}else{
	urls = pathCheck.split("://");
}

str  = urls[1].split("/");

for (i in str){ tier_cnt ++;}

for (i in str){
	for (jj in root_path_str){
		if(str[i] == root_path_str[jj]){
			offset = (i-0)+2;
			break;
		}
	}
}

path_cnt = tier_cnt-offset;

for (i=0 ;i<path_cnt ;i++){
	root_path +="../";
}

//set path
img_path = root_path +"shared_img/";

dir_1 = offset-1;

//--------------------------------------------------------------------

var ie=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0
var opera=window.opera?1:0

var folder=''
var image=''

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//--------------------------------------------------------------------
function LeftMenu(){

	menu_nm = new Array("home","news","info","history","treasure","keidai","ekou","kigan","noukotsu","kekkon","tenjoe","publish","sanpai","dantai","links");
	def_off = new Array("_off","_off","_off","_off","_off","_off","_off","_off","_off","_off","_off","_off","_off","_off","_off");

	if(str[dir_1] == "index.html" || str[dir_1] == ""){
		//TOPページ
		def_off[0] = "_on";
	}else{
		//1階層下のページ
		for (ii in menu_nm){
			if( str[dir_1] == menu_nm[ii]){
				def_off[ii] = "_on";
				break;
			}
		}
	}

with (document) {

writeln("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
writeln("<tr>");
writeln("<td><a href=\"http://www.zojoji.or.jp/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('home','','"+img_path+menu_nm[0]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[0]+def_off[0]+".gif\" alt=\"ホームに戻る\" name=\"home\" width=\"130\" height=\"28\" border=\"0\"></a><br><br></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+menu_nm[1]+"/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('oshirase','','"+img_path+menu_nm[1]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[1]+def_off[1]+".gif\" alt=\"お知らせ\" name=\"oshirase\" width=\"130\" height=\"28\" border=\"0\"></a></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+menu_nm[2]+"/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('aboutzojoji','','"+img_path+menu_nm[2]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[2]+def_off[2]+".gif\" alt=\"増上寺について\" name=\"aboutzojoji\" width=\"130\" height=\"28\" border=\"0\"></a></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+menu_nm[3]+"/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('historyzojoji','','"+img_path+menu_nm[3]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[3]+def_off[3]+".gif\" alt=\"増上寺の歴史\" name=\"historyzojoji\" width=\"130\" height=\"28\" border=\"0\"></a></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+menu_nm[4]+"/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('takaramono','','"+img_path+menu_nm[4]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[4]+def_off[4]+".gif\" alt=\"増上寺の宝物\" name=\"takaramono\" width=\"130\" height=\"28\" border=\"0\"></a></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+menu_nm[5]+"/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('keidai','','"+img_path+menu_nm[5]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[5]+def_off[5]+".gif\" alt=\"境内のご案内\" name=\"keidai\" width=\"130\" height=\"28\" border=\"0\"></a></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+menu_nm[6]+"/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('ekou','','"+img_path+menu_nm[6]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[6]+def_off[6]+".gif\" alt=\"回向のご案内\" name=\"ekou\" width=\"130\" height=\"28\" border=\"0\"></a></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+menu_nm[7]+"/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('kigan','','"+img_path+menu_nm[7]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[7]+def_off[7]+".gif\" alt=\"祈願のご案内\" name=\"kigan\" width=\"130\" height=\"28\" border=\"0\"></a></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+menu_nm[8]+"/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('noukotsu','','"+img_path+menu_nm[8]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[8]+def_off[8]+".gif\" alt=\"納骨のご案内\" name=\"noukotsu\" width=\"130\" height=\"28\" border=\"0\"></a></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+menu_nm[9]+"/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('kekkon','','"+img_path+menu_nm[9]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[9]+def_off[9]+".gif\" alt=\"結婚式のご案内\" name=\"kekkon\" width=\"130\" height=\"28\" border=\"0\"></a></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+menu_nm[10]+"/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('tenjoe','','"+img_path+menu_nm[10]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[10]+def_off[10]+".gif\" alt=\"光摂殿天井絵\" name=\"tenjoe\" width=\"130\" height=\"28\" border=\"0\"></a></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+menu_nm[11]+"/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('publish','','"+img_path+menu_nm[11]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[11]+def_off[11]+".gif\" alt=\"出版物\" name=\"publish\" width=\"130\" height=\"28\" border=\"0\"></a></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+menu_nm[12]+"/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('sanpai','','"+img_path+menu_nm[12]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[12]+def_off[12]+".gif\" alt=\"団体参拝\" name=\"sanpai\" width=\"130\" height=\"28\" border=\"0\"></a></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+menu_nm[13]+"/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('organization','','"+img_path+menu_nm[13]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[13]+def_off[13]+".gif\" alt=\"各種団体\" name=\"organization\" width=\"130\" height=\"28\" border=\"0\"></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+menu_nm[14]+"/index.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('link','','"+img_path+menu_nm[14]+"_on.gif',1)\"><img src=\""+img_path+menu_nm[14]+def_off[14]+".gif\" alt=\"リンク\" name=\"link\" width=\"130\" height=\"28\" border=\"0\"></a></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><br><br></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+"mame/index.html\"><img src=\""+img_path+"banner_mame.jpg\" width=\"88\" height=\"31\" hspace=\"15\" border=\"0\"></a><br><br></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><img src=\""+img_path+"banner_3min.jpg\" width=\"88\" height=\"31\" hspace=\"15\" border=\"0\"><br><br></td>");
writeln("</tr>");


writeln("<tr>");
writeln("<td><a href=\""+root_path+"route/index.html\"><img src=\""+img_path+"banner_map.jpg\" width=\"88\" height=\"31\" hspace=\"15\" border=\"0\"></a><br><br></td>");
writeln("</tr>");
writeln("</table>");


}

}