﻿var current = null;
var menu = [];
var uint;
menu[0] = [
	["自然環境学の理念", "/about/about_feature/29.html"],
	["専攻長からのメッセージ", "/about/about_message/31.html"],
	["教育・研究組織", "/about/about_group/33.html"],
	["担当教員一覧", "/about/about_teacher/35.html"],
	["公募情報", "/about/about_recruit/356.html"],
	["専攻トピックス・アーカイブ", "/topic"],
	["研究科ニュース・アーカイブ", "http://www.k.u-tokyo.ac.jp/cgi-bin/news/news.cgi?mode=graduate"],
	["専攻写真アルバム・アーカイブ", "/about/about_album"],
	["専攻活動・カレンダー・アーカイブ", "/calendar/314.html"]
];
menu[1] = [
	["自然環境構造学分野", "http://nes.nenv.k.u-tokyo.ac.jp/"],
	["自然環境変動学分野", "http://changes.nenv.k.u-tokyo.ac.jp/"],
	["生物圏機能学分野", "http://lbf.nenv.k.u-tokyo.ac.jp/contents/index.html"],
	["生物圏情報学分野", "http://bis.nenv.k.u-tokyo.ac.jp/"],
	["自然環境評価学分野", "http://hyoka.nenv.k.u-tokyo.ac.jp/"],
	["自然環境形成学分野", "http://www.nef.nenv.k.u-tokyo.ac.jp/"],
	["地球環境モデリング分野", "http://www.ccsr.u-tokyo.ac.jp/%7eimasu/shizen.html"],
	["環境情報学分野", "http://ogu.csis.u-tokyo.ac.jp/ei-j.html"],
	["地球海洋環境学分野", "/research/research_09/122.html"],
	["海洋資源環境学分野", "/research/research_10/134.html"],
	["海洋生物圏環境学分野", "http://mbe.ori.u-tokyo.ac.jp/"],
	["海洋環境動態学分野", "/research/research_12/127.html"],
	["海洋物質循環学分野", "/research/research_13/129.html"],
	["海洋生命環境学分野", "/research/research_14/132.html"]
];
menu[2] = [
	["プレスリリース", "/result/result_press/306.html"],
	["刊行物", "/result/result_print/309.html"],
	["論文発表", "/result/result_thesis/303.html"],
	["外部資金プロジェクト", "/result/result_foreign/311.html"]
];
menu[3] = [
	["受験を希望される方へ", "/exam/for_examination/619.html"],
	["指導教員紹介", "/exam/exam_teacher/268.html"],
	["入試説明会", "/exam/exam_intro/282.html"],
	["専攻入試Ｑ＆Ａ", "/exam/exam_qa/296.html"],
	["卒業生の進路", "/exam/exam_future/467.html"],
	["学生の研究テーマ", "/exam/exam_theme/299.html"],
	["過去の入試問題", "/exam/exam_past/362.html"]
];

function init() {
	for (var i = 0; i < menu.length; i ++) {
		var str = "";
		str += '<ul class="popup" id="popup' + i + '" onmouseover="cancelHide();" onmouseout="hidePopup(0)">';
		for (var j = 0; j < menu[i].length; j ++) {
			str += '<li><a href="' + menu[i][j][1] + '">' + menu[i][j][0] + '</a></li>';
		}
		str += "</ul>";
		document.getElementsByTagName("body")[0].innerHTML += str;
	}
}
function showPopup(n, obj) {
	if (current != null) {
		$("popup" + current).style.display = "none";
		cancelHide();
	}
	current = n;
	pos = getPosition(obj);
	$("popup" + n).style.display = "block";
	$("popup" + n).style.top = (pos.y + 28) + "px";
	$("popup" + n).style.left = (pos.x - 1) + "px";
}
function hidePopup(n) {
	uint = setTimeout("hide()", 500);
}
function cancelHide() {
	clearTimeout(uint);
}
function hide() {
	if (current != null) {
		$("popup" + current).style.display = "none";
		current = null
	}
}

function $(id) {
	return(document.getElementById(id));
}
function getPosition(obj) {
	var elementX = elementY = obj;
	var offsetX = offsetY = 0;
	do {
		offsetX += elementX.offsetLeft || 0;
		elementX = elementX.offsetParent;
	} while (elementX);
	do {
		offsetY += elementY.offsetTop || 0;
		elementY = elementY.offsetParent;
	} while (elementY);
	return({x:offsetX, y:offsetY});
}

/*
init();
*/



