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

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


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
common_js_path = root_path+"js/";
common_css_path = root_path+"css/";
common_img_path = root_path+"images/";

	dir_1 = offset-1;
	dir_2 = offset;
	dir_3 = offset+1;

	dir_1_nm_array = new Array("","看護コミュニティ","看護の知識","研究発表の広場","イベント情報","お役立ちリンク","アラカルト","このサイトについて","21世紀COEプログラム");

	dir_1_str_array = new Array("","community","nursing","project","event","links","alacarte","about","coe","ehon");

	link_array = new Array("","community/nurse/index.html","nursing/01/index.html","project/index.html","event/calendar/201007.html","links/index01.html","alacarte/book/index.html","about/web/06.html","coe/01.html");

	css_array = new Array("","community.css","nurs.css","text.css","event.css","link.css","text.css","about.css","coe.css");

	for (ii in dir_1_str_array){
		if( str[dir_1] == dir_1_str_array[ii]){
			use_css_file = css_array[ii];
			break;
		}
	}

//alert(use_css_file);
with (document) {

writeln("<link href=\""+common_css_path+""+use_css_file+"\" rel=\"stylesheet\" type=\"text/css\">");

}

//------------------------------------------------------------------------
//------------------------------------------------------------------------
//------------------------------------------------------------------------
function dsp_head_navi(){

//-------------------------------------------------------------------------
// layer2
//-------------------------------------------------------------------------

d2_nm_array = new Array(8);
d2_str_array = new Array(8);

d2_nm_array[3] = new Array("","日本型遺伝看護","がん集学的アプローチ","がんサバイバー","日本型高齢者ケア","性暴力被害者ケア","不妊ケア","在宅ホスピス（地域緩和ケア）","子どもと家族中心のケア","健康教育実践プログラム","国際看護コラボレーション実践開発","健康資源コンテンツデジタル化とe-learning開発","こころのケア","看護サービスの活用評価","日常生活援助のための看護技術");
d2_str_array[3] = new Array("","01","02","03","04","05","06","07","08","09","10","11","12","13","14");

//-------------------------------------------------------------------------
// layer3 
//-------------------------------------------------------------------------
// layer2以降は外部ファイル化して、ページ表示時に取得するようにする。

d3_nm_array = new Array(8);
d3_str_array = new Array(8);

d3_nm_array[1] = new Array("","3階層のフォルダ1","3階層のフォルダ2","3階層のフォルダ3");
d3_str_array[1] = new Array("");

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

	for (ii in dir_1_str_array){
		if( str[dir_1] == dir_1_str_array[ii]){
			dir_1_nm = dir_1_nm_array[ii];
			head_img = "head_navi_0"+ii+".gif";
			//link_array[ii] ="#";
			dir1_id = ii;
			break;
		}
	}

if(path_cnt >2){
	dir2_id =0;
	//2階層目の名前取得
	if(str[dir_2]){
		for (ii2 in d2_str_array[dir1_id]){
			if( str[dir_2] == d2_str_array[dir1_id][ii2]){
				dir_2_nm = d2_nm_array[dir1_id][ii2];
				dir2_id = ii2;
				break;
			}
		}
	}
}else{
	dir2_id =0;
}

	dir3_id =0;
	//3階層目の名前取得
	if(str[dir_3]){
		for (ii3 in d3_str_array[dir2_id]){
			if( str[dir_3] == d3_str_array[dir2_id][ii3]){
				dir_3_nm = d3_nm_array[dir2_id][ii3];
				dir3_id = ii3;
				break;
			}
		}
	}
	
	//alert(common_img_path+head_img);

	with (document) {
		writeln("<a name=\"top\"><img src=\""+common_img_path+head_img+"\" width=\"760\" height=\"30\" border=\"0\" usemap=\"#Top_Menu\"></a>");
	}

}

//------------------------------------------------------------------------
//------------------------------------------------------------------------
//------------------------------------------------------------------------
function dsp_global_navi(cur_nm){


	if(dir_1_nm != ""){
		str_global_navi ="<a href=\""+root_path+"\">トップページ</a> &gt; <a href=\""+root_path+link_array[ii]+"\">"+dir_1_nm+"</a>";
	}

	if(dir2_id != 0){
		str_global_navi +=" &gt; <a href=\""+root_path+str[dir_1]+"/"+str[dir_2]+"\">"+dir_2_nm+"</a>";
	}

	if(dir3_id != 0){
		str_global_navi +=" &gt; <a href=\""+root_path+str[dir_1]+"/"+str[dir_2]+"/"+str[dir_3]+"\">"+dir_3_nm+"</a>";
	}

	//自分のページ名を表示
	str_global_navi += " &gt; "+cur_nm;

	//スタイルシート挟み込み
	str_global_navi = "<div class=\"navi_text\">"+str_global_navi+"</div>";
	with (document) {
	writeln(str_global_navi);
	}

}

//------------------------------------------------------------------------
//	左ナビゲーション
//	階層1によって呼び分ける
//------------------------------------------------------------------------
function dsp_left_navi(){

with (document) {
	writeln("<script language=\"JavaScript\" src=\""+common_js_path+"left_"+dir1_id+".js\"></script>");
}

}


//------------------------------------------------------------------------
//	ページ評価のためのチェック


function check_rating() {
}


//------------------------------------------------------------------------
//	ページ評価
//	rating
//------------------------------------------------------------------------
function rating(){
	//ディレクトリ設定
	rating_img_path = root_path+"rating/images/";

	rating_cgi      = root_path+"rating/rating.php?url="+String(document.location);

	with (document) {
writeln("<form action=\""+rating_cgi+"\" method=\"post\" name=\"rating\" accept-charset=\"shift_jis\" target=\"_blank\" onSubmit=\"return check_rating();\">");
writeln("<table width=\"585\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
writeln("	<tr>");
writeln("		<td><img src=\""+rating_img_path+"line_ten.gif\" width=\"585\" height=\"9\"></td>");
writeln("	</tr>");
writeln("<tr>");
writeln("	<td><img src=\""+rating_img_path+"sp.gif\" width=\"1\" height=\"2\"></td>");
writeln("</tr>");
writeln("<tr>");
writeln("	<td height=\"256\" background=\""+rating_img_path+"back.gif\">");
writeln("		<table width=\"585\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
writeln("			<tr>");
writeln("				<td width=\"170\"><div align=\"center\">");
writeln("					<table width=\"163\"  border=\"0\" align=\"right\" cellpadding=\"0\" cellspacing=\"0\">");
writeln("						<tr>");
writeln("							<td><img src=\""+rating_img_path+"title.gif\" width=\"163\" height=\"116\" alt=\"コンテンツの評価にご協力ください\"></td>");
writeln("						</tr>");
writeln("						<tr>");
writeln("							<td background=\""+rating_img_path+"title_back.gif\"><p class=\"mini\">今後の記事投稿・更新の参考にさせていただきたいので、ぜひこの記事へのあなたの評価を投票してください。クリックするだけで投票できます。</p></td>");
writeln("						</tr>");
writeln("						<tr>");
writeln("							<td><img src=\""+rating_img_path+"title_end.gif\" width=\"163\" height=\"7\"></td>");
writeln("						</tr>");
writeln("					</table>");
writeln("				</div></td>");
writeln("				<td valign=\"top\">");
writeln("					<table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\">");
writeln("						<tr>");
writeln("							<td><img src=\""+rating_img_path+"q1.gif\" width=\"198\" height=\"13\"></td>");
writeln("						</tr>");
writeln("						<tr>");
writeln("							<td>");
writeln("								<table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"1\">");
writeln("									<tr>");
writeln("										<td width=\"39%\"><input name=\"rating_p\" type=\"radio\" value=\"5\" id=\"rating_p5\">");
writeln("<label for=\"rating_p5\"><span class=\"mtext\">とても役に立った</span></label></td>");
writeln("										<td width=\"29%\"><input name=\"rating_p\" type=\"radio\" value=\"4\" id=\"rating_p4\">");
writeln("<label for=\"rating_p4\"><span class=\"mtext\">まあ役に立った</span></label></td>");
writeln("										<td width=\"32%\"><input name=\"rating_p\" type=\"radio\" value=\"3\" id=\"rating_p3\">");
writeln("<label for=\"rating_p3\"><span class=\"mtext\">どちらともいえない</span></label></td>");
writeln("									</tr>");
writeln("									<tr>");
writeln("										<td><input name=\"rating_p\" type=\"radio\" value=\"2\" id=\"rating_p2\">");
writeln("<label for=\"rating_p2\"><span class=\"mtext\"> あまり役に立たなかった</span></label></td>");
writeln("										<td colspan=\"2\"><input name=\"rating_p\" type=\"radio\" value=\"1\" id=\"rating_p1\">");
writeln("<label for=\"rating_p1\"><span class=\"mtext\">まったく役に立たなかった</span></label></td>");
writeln("									</tr>");
writeln("								</table>");
writeln("							</td>");
writeln("						</tr>");
writeln("						<tr>");
writeln("							<td><img src=\""+rating_img_path+"line_ten02.gif\" width=\"387\" height=\"1\" vspace=\"1\"></td>");
writeln("							</tr>");
writeln("							<tr>");
writeln("								<td><img src=\""+rating_img_path+"q2.gif\" width=\"377\" height=\"30\" vspace=\"1\"><span class=\"default_txt\"><br>");
writeln("								例：○○の意味がわからなかった、リンクが切れていた、○○について知りたかった<br>");
writeln("など<font color=\"#D32559\">　※記入していただいた内容に対してこちらから返信はしておりません</font></span></td>");
writeln("							</tr>");
writeln("							<tr>");
writeln("								<td><textarea name=\"rating_com\" cols=\"46\" rows=\"3\" id=\"rating_com\"></textarea>  	</td>");
writeln("							</tr>");
writeln("							<tr>");
writeln("								<td><div align=\"left\"><input type=\"image\" src=\""+rating_img_path+"botan.jpg\" width=\"122\" height=\"30\"border=\"0\"></div></td>");
writeln("							</tr>");
writeln("						</table>");
writeln("					</td>");
writeln("				</tr>");
writeln("			</table>");
writeln("		</td>");
writeln("	</tr>");
writeln("</table>");
writeln("</form>");

	}

}


//------------------------------------------------------------------------
//------------------------------------------------------------------------
//------------------------------------------------------------------------
function dsp_footer_navi(){

	link_path = root_path+dir_1_str_array[7]+"/";

	if(dir_1_nm != ""){
		str_global_navi ="<a href=\""+root_path+"\">トップページ</a> &gt; <a href=\""+root_path+str[dir_1]+"\">"+dir_1_nm+"</a>";
	}

	with (document) {
	writeln("<table width=\"760\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">");
	writeln("<tr>");
	writeln("<td align=\"center\"><div class=\"navi_text\">");
	writeln("<a href=\""+link_path+"web/06.html\">看護ネットとは？</a>　|　<a href=\""+link_path+"web/01.html\">著作権に関するご注意</a>　|　<a href=\""+link_path+"web/02.html\">ご利用ガイド</a>　|　<a href=\""+link_path+"web/03.html\">プライバシーポリシー</a>　|　<a href=\""+link_path+"web/04.html\">お問い合わせ</a>　|　<a href=\""+link_path+"web/05.html\">サイトマップ</a>");

	writeln("<img src=\""+root_path+"log/w3a/writelog.php?ref="+document.referrer+"\" width=\"1\" height=\"1\">");

	writeln("</div></td>");
	writeln("</tr>");
	writeln("</table>");
	}


with (document) {
writeln("<map name=\"Top_Menu\">");
writeln("<area shape=\"rect\" coords=\"16,4,129,28\" href=\""+root_path+link_array[1]+"\" alt=\""+dir_1_nm_array[1]+"\">");
writeln("<area shape=\"rect\" coords=\"136,4,229,28\" href=\""+root_path+link_array[2]+"\" alt=\""+dir_1_nm_array[2]+"\">");
writeln("<area shape=\"rect\" coords=\"236,4,355,28\" href=\""+root_path+link_array[3]+"\" alt=\""+dir_1_nm_array[3]+"\">");
writeln("<area shape=\"rect\" coords=\"361,4,468,28\" href=\""+root_path+link_array[4]+"\" alt=\""+dir_1_nm_array[4]+"\">");
writeln("<area shape=\"rect\" coords=\"473,4,593,28\" href=\""+root_path+link_array[5]+"\" alt=\""+dir_1_nm_array[5]+"\">");
writeln("<area shape=\"rect\" coords=\"598,4,691,28\" href=\""+root_path+link_array[6]+"\" alt=\""+dir_1_nm_array[6]+"\">");

writeln("</map>");

writeln("<map name=\"Map1\">");
writeln("<area shape=\"rect\" coords=\"16,10,205,51\" href=\""+root_path+"\" alt=\"看護ネット\">");
writeln("<area shape=\"rect\" coords=\"661,33,754,51\" href=\""+root_path+"\" alt=\"トップページへ\">");
writeln("<area shape=\"rect\" coords=\"543,32,652,53\" href=\""+root_path+"about/web/06.html\" alt=\"このサイトについて\">");
writeln("</map>");

}

}

//------------------------------------------------------------------------
function google_analytics(){
	with (document){

}

}