//ファイル名
var HTML = [, "home", "projects", "members", "publications", "collaborations", "gallery", "movie", "access"];
//インデックスの表示名(日本語)
var jaIndex = [, 'トップ', '研究紹介', 'スタッフ', '業績', '共同研究', 'ギャラリー', 'ムービー', 'アクセス'];
//インデックスの表示名(英語)
var enIndex = [, 'Home', 'Projects', 'Members', 'Publications', 'Collaborations', 'Gallery', 'Movie'];
//下に表示されるボックスの表示名(日本語)[]内でひとつのグループ
var jaSub = [["", "", "", ""], , , , ["論文", "学会発表"], , ["令和6年度","令和5年度","令和4年度","令和3年度", "令和2年度", "令和元年度", "平成31年度", "平成30年度", "平成29年度", "平成28年度", "平成27年度", "平成26年度"], , ];
var enSub = [["", "", "", ""], , , , ["Paper", "Academic"], , ["2023-2024","2022-2023","2021-2022","2020-2021","2019-2020", "2019", "2018-2019", "2017-2018", "2016-2017", "2015-2016", "2014-2015"], , ];
//下に表示されるボックスのファイル名(共通)
var subHTML = [["", "", "", ""], , , , ["pubpa", "pubac"], , ["photo6","photo5","photo4","photo3","photo2","photo1","photo31", "photo30", "photo29", "photo28", "photo27", "photo26"], , ];
//インデックスの数(日本語)
itemJnum = jaIndex.length;
//インデックスの数(英語)
itemEnum = enIndex.length;
var jaLng = ['日本語', 'English'];
var enLng = ['Japanese', 'English'];
var selectLng = ['ja', 'en'];
itemLng = selectLng.length;
var defaltWid;
var windowWid;//ブラウザ幅
var windowHei;//ブラウザ高さ
function lngitem() {
if (oLng.value == 'ja') {
return Number(itemJnum);
} else {
return Number(itemEnum);
}
}
var oTitle;
var oIndex;
var oListBox;
var oBody;
var oLanguage;
var oTitleName;
var oSelectBox;
var oSelectNum;
var oFocusBox;
var oFocusNum;
var oSubBox;
var oSubNum;
var oLng;
var oDisplay;
function domRead() {
defaltWid = 820;
windowWid = window.innerWidth;//ブラウザ幅
windowHei = window.innerHeight;//ブラウザ高さ
oTitle = document.getElementById('title');
oIndex = document.getElementById('index');
oListBox = document.getElementById('listbox');
oBody = document.getElementById('body');
oLanguage = document.getElementById('language');
oTitleName = document.getElementById('titleName');
oSelectBox = document.getElementById('selectBox');
oSelectNum = document.getElementById('selectNum');
oFocusBox = document.getElementById('focusBox');
oFocusNum = document.getElementById('focusNum');
oSubBox = document.getElementById('subBox');
oSubNum = document.getElementById('subNum');
oLng = document.getElementById('lng');
oDisplay = document.getElementById('display');
}
window.onload = function(){
domRead();
//宣言部分
if (windowWid <= Number(defaltWid)){
var outsideLef = 0;
} else {
var outsideLef = (windowWid - defaltWid) / 2;
}
var bodyMargin = 2;
var titleHei = oTitle.offsetHeight + bodyMargin;
//title
oTitle.style.width = defaltWid - 20;
oTitle.style.left = outsideLef;
//index
oIndex.style.top = titleHei;
oIndex.style.left = 0;
oIndex.style.width = windowWid;
//listbox
oListBox.style.top = titleHei + oIndex.offsetHeight + 5;
//body
oBody.style.left = outsideLef;
oBody.style.top = titleHei + oIndex.offsetHeight + 10;
oBody.style.width = defaltWid;
//language
oLanguage.style.left = outsideLef + defaltWid - 350 - 10;
oLanguage.style.top = 40;
//titleName
oTitleName.style.left = outsideLef + 10;
setting();
}
function setting () {
domRead()
//親ファイル名
if (oSelectBox.value == "") {
oSelectBox.value = './body/ja/home.html';
oSelectNum.value = 1;
}
if (oLng.value == "") {
oLng.value = 'ja';
}
if (oDisplay.value == "") {
oTitleName.style.display = 'none';
} else {
oTitleName.style.display = 'block';
oTitleName.innerHTML = oDisplay.value;
}
for (i = 0; i <= itemLng - 1; i++) {
var iElement = document.createElement('div');
if (oLng.value == 'ja') {
iElement.innerHTML = jaLng[i];
iElement.className = 'lng';
iElement.id = 'l' + i;
} else {
iElement.innerHTML = enLng[i];
iElement.className = 'lng';
iElement.id = 'l' + i;
}
if (i == 0) {
iElement.style.float = 'left';
} else if (i == 1) {
iElement.style.float = 'right';
}
var pObject = oLanguage;
pObject.appendChild(iElement);
var oLi = document.getElementById('l' + i);
oLi.onmouseover = lngover
oLi.onmouseout = lngout
oLi.onclick = lngclick
if (oLng.value == selectLng[i]) {
oLi.className = 'pushlng lng';;
} else {
oLi.className= 'nonlng lng';
}
}
for (i = 1; i <= lngitem() - 1; i++) {
var iElement = document.createElement('span');
if (oLng.value == 'ja') {
iElement.innerHTML = '
' + jaIndex[i] + '
';
} else if (oLng.value == 'en') {
iElement.innerHTML = '' + enIndex[i] + '
';
}
var pObject = oIndex;
pObject.appendChild(iElement);
var oAi = document.getElementById('a' + i);
oAi.onmouseover = Mover;
oAi.onmouseout = Mout;
oAi.onclick = click;
oAi.style.width = defaltWid / (lngitem() - 1) - 1;
}
titleChange();
oAiClass();
}
function none () {}
function Mover() {
domRead();
var j = this.id.substr(1);
if (oLng.value == 'ja') {
oFocusBox.value = './body/ja/' + HTML[j] + '.html';
} else if (oLng.value == 'en') {
oFocusBox.value = './body/en/' + HTML[j] + '.html';
}
oFocusNum.value = j;
elementDelete();
if (this.className !== 'push button') {
this.className = 'select button';
}
var element = document.createElement('div');
element.id = 'list';
element.style.left = this.offsetLeft;
var objBody = oListBox;
objBody.appendChild(element);
try {
for (i = 0; i <= subHTML[j].length - 1; i++) {
if (oLng.value == 'ja') {
var elementid = jaSub[j];
} else {
var elementid = enSub[j];
}
var element = document.createElement('div');
element.innerHTML = elementid[i];
element.className = 'listbox nonlist';
element.id = 'box_' + i;
element.onmouseover = ListBoxOver;
element.onmouseout = ListBoxOut;
element.style.width = 180;
element.onclick = subClick;
var objBody = document.getElementById('list');
objBody.appendChild(element);
var element = document.createElement('span');
element.innerHTML = '≫';
element.className = 'listbox nonlist';
element.style.float = 'left';
element.style.top = -16;
element.id = 'boxsub_' + i;
var objBody = document.getElementById('box_' + i);
objBody.appendChild(element);
}
//listboxの内外の検出
var element = document.createElement('div');
element.id = 'detector';
element.onmouseover = detectorOver;
element.style.left = 0;
element.style.width = windowWid;
element.style.height = windowHei;
element.style.top = 0;
var objBody = document.body;
objBody.appendChild(element);
} catch (e) {
}
}
function Mout() {
if (this.className !== 'push button') {
this.className= 'non button';
}
}
function detectorOver() {
domRead();
if (document.getElementById('a' + oFocusNum.value).className !== 'push button') {
document.getElementById('a' + oFocusNum.value).className = 'non button';
}
elementDelete();
}
function ListBoxOver() {
domRead();
var childs = this.childNodes;
this.className= 'selectlist listbox';
childs[1].className= 'selectlist listbox';
if (oFocusNum.value !== oSelectNum.value) {
document.getElementById('a' + oFocusNum.value).className = 'select button';
}
}
function ListBoxOut() {
var childs = this.childNodes;
this.className= 'nonlist listbox';
childs[1].className= 'nonlist listbox';
}
function lngover() {
if (this.className !== 'pushlng lng') {
this.className= 'selectlng lng';
}
}
function lngout() {
if (this.className !== 'pushlng lng') {
this.className = 'nonlng lng';
}
}
function click() {
domRead();
oBody.style.height = 0;
oSelectBox.value = oFocusBox.value
oSelectNum.value = oFocusNum.value
oSubBox.value = ''
oSubNum.value = ''
oBody.contentDocument.location.replace(oFocusBox.value);
oDisplay.value = '';
oAiClass();
oTitleName.style.display = 'none';
}
function subClick() {
domRead();
var j = this.id.split("_")[1];
var subHTMLelement = subHTML[oFocusNum.value];
oSubBox.value = './sub/' + subHTMLelement[j] + '.html';
oSubNum.value = j;
oBody.style.height = 0;
oSelectBox.value = oSubBox.value;
oSelectNum.value = oFocusNum.value;
oBody.contentDocument.location.replace(oSubBox.value);
if (oLng.value == 'ja') {
oTitleName.innerHTML = jaSub[oSelectNum.value][oSubNum.value];
oDisplay.value = jaSub[oSelectNum.value][oSubNum.value];
} else if (oLng.value == 'en') {
oTitleName.innerHTML = enSub[oSelectNum.value][oSubNum.value];
oDisplay.value = enSub[oSelectNum.value][oSubNum.value];
}
oAiClass();
oTitleName.style.display = 'block';
elementDelete();
}
function lngclick() {
domRead();
if (this.className !== 'pushlng lng') {
oBody.style.height = 0;
j = this.id.substr(1);
oLng.value = selectLng[j];
try {
var element = oLanguage;
element.textContent = null;
} catch(e) {};
try {
var elementsid = oIndex;
elementsid.textContent = null;
} catch(e) {};
try {
if (oSubBox.value !== ''){
for (i = 0; i <= itemLng - 1; i++) {
if (subHTML[oSelectNum.value][i] == oSubBox.value.split('/').pop().split('.')[0]) {
oSubNum.value = i;
}
}
if (oLng.value == 'ja') {
oTitleName.innerHTML = jaSub[oSelectNum.value][oSubNum.value];
oDisplay.value = jaSub[oSelectNum.value][oSubNum.value];
} else if (oLng.value == 'en') {
oTitleName.innerHTML = enSub[oSelectNum.value][oSubNum.value];
oDisplay.value = enSub[oSelectNum.value][oSubNum.value];
}
}
} catch (e) {}
elementDelete();
setting();
titleChange();
}
}
function oAiClass () {
for (i = 1; i <= lngitem() - 1; i++) {
var oAi = document.getElementById('a' + i);
if (i == oSelectNum.value) {
oAi.className = 'push button';
} else {
oAi.className= 'non button';
}
}
}
function elementDelete () {
domRead();
try {
var element = document.getElementById('list');
element.parentNode.removeChild(element);
} catch(e) {};
try {
var element = document.getElementById('detector');
element.parentNode.removeChild(element);
} catch(e) {};
}
function titleChange() {
domRead();
if (oLng.value == 'ja') {
if (subBox.value == '') {
if (Number(oSelectNum.value) > itemJnum - 1) {
var sBox = './body/ja/home.html';
oSelectBox.value = './body/ja/home.html';
oSelectNum.value = 1;
} else {
var sBox = './body/ja/' + HTML[oSelectNum.value] + '.html';
}
} else {
var sBox = oSelectBox.value;
}
oBody.contentDocument.location.replace(sBox);
document.getElementById('uni1').innerHTML = '岩手大学'
document.getElementById('uni2').innerHTML = '理工学部, 大学院工学研究科'
document.getElementById('uni3').innerHTML = '化学・生命理工学科 化学コース'
document.getElementById('lab').innerHTML = '表面反応化学研究室'
document.getElementById('upl').innerHTML = '最終更新日'
} else {
if (subBox.value == '') {
if (Number(oSelectNum.value) > itemEnum - 1) {
var sBox = './body/en/home.html';
oSelectBox.value = './body/en/home' + '.html';
oSelectNum.value = 1;
} else {
var sBox = './body/en/' + HTML[oSelectNum.value] + '.html'
}
} else {
var sBox = oSelectBox.value;
}
oBody.contentDocument.location.replace(sBox);
document.getElementById('uni1').innerHTML = 'Iwate University'
document.getElementById('uni2').innerHTML = 'Faculty of Science and Engineering, Graduate School of Engineering'
document.getElementById('uni3').innerHTML = 'Department of Chemistry and Biological Sciences Chemistry'
document.getElementById('lab').innerHTML = 'Shirai Laboratory'
document.getElementById('upl').innerHTML = 'Final Updated'
}
}