function unload() {
}

function load() {
    var directory = getDirectoryname();
    var filename = getFilename();
    var fileLocation = getFileLocation(filename);
    var group = getGroup(directory, filename);

    if (document.getElementById("sitemap_header")!=null) {
        renderSitemap(fileLocation);
    }

    if (document.getElementById("location_header")!=null) {
        renderLocation(group, directory, filename, fileLocation);
    }

    if (document.getElementById("menubar")!=null) {
        renderMenubar(fileLocation);
    }
    
    if (document.getElementById("header_cat")!=null) {
        renderHeader(group, fileLocation);
    }

    if (document.getElementById("menu")!=null) {
        renderMenu(group, filename, fileLocation);
    }

    if (document.getElementById("banner")!=null) {
        renderBanner(group, fileLocation);
    }

    if (document.getElementById("policy_header")!=null) {
        renderPolicy(fileLocation);
    }

    adjustMenuHeight();
	displayContainer();
}

function adjustMenuHeight() {
    var menuHeight= document.getElementById("container").clientHeight
                     - document.getElementById("head").clientHeight
                     - document.getElementById("v1").clientHeight
                     - document.getElementById("v2").clientHeight
                     -15;

    if (menuHeight > 600) {
        if (document.getElementById("menu")!=null) {
            document.getElementById("menu").style.height = menuHeight + "px";
        }
        document.getElementById("main").style.height = menuHeight -75 + "px";
    }
    else {
        if (document.getElementById("topmovie")==null) {
            if (document.getElementById("menu")!=null) {
                document.getElementById("menu").style.height = "650px";
            }
            document.getElementById("main").style.height = "575px";
        }
    }
    
}

function hideContainer() {
    document.getElementById("container").style.visibility = "hidden";
}

function displayContainer() {
    //document.getElementById("container").style.visibility = "visible";
    document.getElementById("v1").style.visibility = "visible";
	document.getElementById("v2").style.visibility = "visible";
	document.getElementById("v3").style.visibility = "visible";

}

function getReferer(i) {
    var ref = document.referrer.split("/").reverse()[i];
    return ref;
}

function getLocationHref() {
    var baseObj = document.getElementsByTagName('base');
    if (baseObj && baseObj.length && baseObj[0].href) {
        location_url = baseObj[0].href;
    }
    else {
        location_url = document.location.href;
    }
    return location_url;
}

function getFilename() {
    var n;
    var location_url = getLocationHref();
    var filename = location_url.split("/").reverse()[0];

    if ((n = filename.indexOf("#")) != -1) {
         filename = filename.substring(0, n);
    }

    if ((n = filename.indexOf("?")) != -1) {
         filename = filename.substring(0, n);
    }

    if (filename=="") {
        filename ="index.html";
    }
    return filename;
}

function getDirectoryname() {
    var location_url = getLocationHref();
    var directoryname = location_url.split("/").reverse()[1];
    return directoryname;
}

function isToppage(filename) {
    if (filename =="students.html"
     || filename =="examinee.html"
     || filename =="parents.html"
     || filename =="company.html"
     || filename =="public.html"
     || filename =="alumni.html"
     || filename =="faculty.html"
     || filename =="pharmacy.html"
     || filename =="lifesciences.html"
    ) {
        return true;
    }
    else {
        if (document.getElementById("verify-v1")!=null) {
            return true;
        }
        else {
            return false;
        }
    }
}

function getGroup(directory, filename) {
    var g ="group";
    var gr = document.forms[0].groupid.value;

    if (gr =="") {
        gr = loadData(g);

        if (!isToppage(filename)) {
            if (gr =="pharmacy.html" && (directory!="news" && directory!="pharmacy" && directory!="gp")) {
                gr ="students.html";
            }
            else if (gr =="lifesciences.html" && directory!="news" && directory!="gp") {
                gr ="students.html";
            }
        }
        document.forms[0].groupid.value = gr;
    }
    else {
        //back button
        saveData(g, gr);
    }
    return gr;
}

function saveData(g, v)
{
    theName  = g;
    theValue = v;
    theDay   = 7;
    thePath  = "/";
    setDay = new Date();
    setDay.setTime(setDay.getTime()+(theDay*1000*60*60*24));
    expDay = setDay.toGMTString();
    document.cookie = theName + "="+escape(theValue)+";expires="+expDay+";path="+thePath;
}

function loadData(g)
{
    theData   = "";
    theName   = g+"=";
    theCookie = document.cookie+";";
    start = theCookie.indexOf(theName);
    if (start != -1)
    {
        end = theCookie.indexOf(";",start);
        theData = unescape(theCookie.substring(start+theName.length,end));
    }
    return theData;
}

function getFileLocation(filename) {
    var location_url = getLocationHref();
    var u = location_url.split("/").reverse();
    var fileLocation;
    //toppage

    if (isToppage(filename))
    {
        fileLocation ="./";
    }
    else if (u[2] =="toexaminee" || u[2]=="university" || u[2]=="news" || u[2] =="campus" || (u[2] =="lifesciences" && u[1] =="syllabus") || u[1] =="data" || u[1]=="lab" )
    {
        fileLocation ="../../";
    }
    else if (u[2]=="event") {
        fileLocation ="../../../";
    }
    else
    {
        fileLocation ="../";
    }
    
    return fileLocation;
}

function contentHandlerJob() {
    var directory = getDirectoryname();
    var filename = getFilename();
    var a = getGroup(directory, filename);

    document.write("<ul class=\"list\">");
    document.write("<li><a href=\"./careercenter.html\">キャリアセンター</a></li>");
    document.write("<li><a href=\"./careersupport.html\">キャリアサポート</a></li>");
    document.write("<li><a href=\"./internship.html\">インターンシップ</a></li>");
    document.write("<li><a href=\"./slideshow.html\">目で見るキャリアサポート</a></li>");
    document.write("<li><a href=\"./schedule.html\">キャリアサポート年間スケジュール</a></li>");
    document.write("<li><a href=\"./course.html\">薬学部・生命科学部出身者の進路</a></li>");
    document.write("<li><a href=\"./data/index.html\">進路・就職データ</a></li>");
    if (a =="company.html") {
        document.write("<li><a href=\"./application.html\">求人申し込み</a></li>");
    }
    else if (a =="students.html" || a =="") { 
        document.write("<li><a href=\"./search.html\">進路支援システム</a></li>");
        document.write("<li><a href=\"./link.html\">進路・就職関連リンク集</a></li>");
    }
    document.write("</ul>");
}

function randomNumber(i) {
    var rand = Math.floor(Math.random() * i ) + 1;
    return rand;
}

function showPicture() {
    document.getElementById("head_pict").src= "images/" + randomNumber(10) + ".jpg";
}

//banner------------------------------------------------------------------------
function renderBanner(group, fileLocation) {
	document.getElementById("banner").innerHTML = bannerText(group, fileLocation);
}

function bannerText(group, fileLocation) {
    var banner;
    var addr_portal ="http://tupls-portal.toyaku.ac.jp/portal/";
    var addr_library ="http://libnews.bus.toyaku.ac.jp/";
    var addr_gb = fileLocation + "gp/index.html";
    var addr_syllabus ="http://www.toyaku.nanaop-web.com/syllabus/";
    var addr_event = fileLocation + "toexaminee/event/index.html";
    var addr_opencampus = fileLocation + "toexaminee/opencampus/index.html";

    var addr_internet_application = "http://exam.52school.com/toyaku/guidance.html";
    var addr_announcement_result  = fileLocation + "toexaminee/nyushi/sokuhou.html";

    if (group =="students.html" || group =="") { 
        banner ="<ul class=\"banner\">";
        banner +="<li><a href=\"" + addr_library + "\" target=\"_blank\"><img src=\"" + fileLocation + "images/banner_library.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_gb + "\"><img src=\"" + fileLocation + "images/banner_gp.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_portal +"\"><img src=\"" + fileLocation + "images/banner_portal.png\" width=\"200\"></a></li>";
        banner +="<li><img src=\"" + fileLocation + "images/banner_portal_qr.png\" width=\"200\" alt=\"東薬学生ポータルサイト http://tupls-portal.toyaku.ac.jp/\"></li>";
        banner +="</ul>";
    }
    else if (group =="examinee.html") {
        banner ="<ul class=\"banner\">";
        banner +="<li><a href=\"" + addr_announcement_result + "\"><img src=\"" + fileLocation + "images/banner_announcement_result.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_event + "\"><img src=\"" + fileLocation + "images/banner_admevent.png\" width=\"200\"></a></li>"
        banner +="<li><a href=\"" + addr_library + "\" target=\"_blank\"><img src=\"" + fileLocation + "images/banner_library.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_gb + "\"><img src=\"" + fileLocation + "images/banner_gp.png\" width=\"200\"></a></li>";
        banner +="</ul>";
    }
    else if (group =="pharmacy.html") {
        banner ="<ul class=\"banner\">";
        banner +="<li><a href=\"" + addr_portal +"\"><img src=\"" + fileLocation + "images/banner_portal.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_library + "\" target=\"_blank\"><img src=\"" + fileLocation + "images/banner_library.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_gb + "\"><img src=\"" + fileLocation + "images/banner_gp.png\" width=\"200\"></a></li>";
        banner +="</ul>";
    }
    else if (group =="lifesciences.html") {
        banner ="<ul class=\"banner\">";
        banner +="<li><a href=\"" + addr_portal +"\"><img src=\"" + fileLocation + "images/banner_portal.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_library + "\" target=\"_blank\"><img src=\"" + fileLocation + "images/banner_library.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_gb + "\"><img src=\"" + fileLocation + "images/banner_gp.png\" width=\"200\"></a></li>";
        banner +="</ul>";
    }
    else if (group =="parents.html") {
        banner ="<ul class=\"banner\">";
        banner +="<li><a href=\"" + addr_announcement_result + "\"><img src=\"" + fileLocation + "images/banner_announcement_result.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_event + "\"><img src=\"" + fileLocation + "images/banner_admevent.png\" width=\"200\"></a></li>"
        banner +="<li><a href=\"" + addr_library + "\" target=\"_blank\"><img src=\"" + fileLocation + "images/banner_library.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_gb + "\"><img src=\"" + fileLocation + "images/banner_gp.png\" width=\"200\"></a></li>";
        banner +="</ul>";
    }
    else if (group =="alumni.html") {
        banner ="<ul class=\"banner\">";
        banner +="<li><a href=\"" + addr_library + "\" target=\"_blank\"><img src=\"" + fileLocation + "images/banner_library.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_gb + "\"><img src=\"" + fileLocation + "images/banner_gp.png\" width=\"200\"></a></li>";
        banner +="</ul>";
    }
    else if (group =="company.html") {
        banner ="<ul class=\"banner\">";
        banner +="<li><a href=\"" + addr_library + "\" target=\"_blank\"><img src=\"" + fileLocation + "images/banner_library.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_gb + "\"><img src=\"" + fileLocation + "images/banner_gp.png\" width=\"200\"></a></li>";
        banner +="</ul>";
    }
    else if (group =="public.html") {
        banner ="<ul class=\"banner\">";
        banner +="<li><a href=\"" + addr_library + "\" target=\"_blank\"><img src=\"" + fileLocation + "images/banner_library.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_gb + "\"><img src=\"" + fileLocation + "images/banner_gp.png\" width=\"200\"></a></li>";
        banner +="</ul>";
    }
    else if (group =="faculty.html") {
        banner ="<ul class=\"banner\">";
        banner +="<li><a href=\"" + addr_syllabus + "\" target=\"_blank\"><img src=\"" + fileLocation + "images/banner_syllabus.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_portal +"\"><img src=\"" + fileLocation + "images/banner_portal.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_library + "\" target=\"_blank\"><img src=\"" + fileLocation + "images/banner_library.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_gb + "\"><img src=\"" + fileLocation + "images/banner_gp.png\" width=\"200\"></a></li>";
        banner +="</ul>";
    }
    else if (group =="index.html") {
        banner ="<ul class=\"banner\">";
        banner +="<li><a href=\"" + addr_announcement_result + "\"><img src=\"" + fileLocation + "images/banner_announcement_result.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_event + "\"><img src=\"" + fileLocation + "images/banner_admevent.png\" width=\"200\"></a></li>"
        banner +="<li><a href=\"" + addr_portal +"\"><img src=\"" + fileLocation + "images/banner_portal.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_library + "\" target=\"_blank\"><img src=\"" + fileLocation + "images/banner_library.png\" width=\"200\"></a></li>";
        banner +="<li><a href=\"" + addr_gb + "\"><img src=\"" + fileLocation + "images/banner_gp.png\" width=\"200\"></a></li>";
        banner +="</ul>";
    }
    return banner;
}
//banner------------------------------------------------------------------------

//header------------------------------------------------------------------------
function renderHeader(group, fileLocation) {
	document.getElementById("header_cat").innerHTML = headerText(group, fileLocation);
}

function headerText(group, fileLocation) {
    var header;
    if (group =="students.html" || group =="") { 
        header ="<div class=\"header_cat_stu\"><a href=\"" + fileLocation + "students.html\" class=\"btn_cat_stu\"><span class=\"btn_cat_stu\"></span></a></div>";
    }
    else if (group =="examinee.html") {
        header ="<div class=\"header_cat_exa\"><a href=\"" + fileLocation + "examinee.html\" class=\"btn_cat_exa\"><span class=\"btn_cat_exa\"></span></a></div>";
    }
    else if (group =="pharmacy.html") {
        header ="<div class=\"header_cat_pha\"><a href=\"" + fileLocation + "pharmacy.html\" class=\"btn_cat_pha\"><span class=\"btn_cat_pha\"></span></a></div>";
    }
    else if (group =="lifesciences.html") {
        header ="<div class=\"header_cat_ls\"><a href=\"" + fileLocation + "lifesciences.html\" class=\"btn_cat_ls\"><span class=\"btn_cat_ls\"></span></a></div>";
    }
    else if (group =="parents.html") {
        header ="<div class=\"header_cat_prt\"><a href=\"" + fileLocation + "parents.html\" class=\"btn_cat_prt\"><span class=\"btn_cat_prt\"></span></a></div>";
    }
    else if (group =="alumni.html") {
        header ="<div class=\"header_cat_alm\"><a href=\"" + fileLocation + "alumni.html\" class=\"btn_cat_alm\"><span class=\"btn_cat_alm\"></span></a></div>";
    }
    else if (group =="company.html") {
        header ="<div class=\"header_cat_cmp\"><a href=\"" + fileLocation + "company.html\" class=\"btn_cat_cmp\"><span class=\"btn_cat_cmp\"></span></a></div>";
    }
    else if (group =="public.html") {
        header ="<div class=\"header_cat_pub\"><a href=\"" + fileLocation + "public.html\" class=\"btn_cat_pub\"><span class=\"btn_cat_pub\"></span></a></div>";
    }
    else if (group =="faculty.html") {
        header ="<div class=\"header_cat_fcl\"><a href=\"" + fileLocation + "faculty.html\" class=\"btn_cat_fcl\"><span class=\"btn_cat_fcl\"></span></a></div>";
    }
    else if (group =="index.html") {
        header ="<div class=\"header_cat_stu\"><a href=\"" + fileLocation + "students.html\" class=\"btn_cat_stu\"><span class=\"btn_cat_stu\"></span></a></div>";
    }

	return header;
}
//header------------------------------------------------------------------------

//location------------------------------------------------------------------------
function changeBodyId(g, directory, filename) {
    var ref = getReferer(1);
    if (ref =="sitemap" && (filename =="scholarship.html" || filename =="dormitory.html" || filename =="fees.html")) {
        document.forms[0].groupid.value ="examinee.html";
        document.body.id = "nys";
    }
    else {
        if (directory =="calendar") {
            if (g =="company.html") {
                if (ref =="university") {
                    document.body.id = "uni";
                    saveData("ref", ref);
                }
                else if (ref =="calendar") {
                    ref = loadData("ref");
                    if (ref =="university") {
                        document.body.id = "uni";
                    }
                    else {
                        document.body.id = "cal";
                    }
                }
                else {
                    document.body.id = "cal";
                    saveData("ref", ref);
                }

            }
            else if (g =="students.html") {
                if (ref =="bbs") {
                    document.body.id = "cmp";
                    saveData("ref", ref);
                }
                else if (ref =="university") {
                    document.body.id = "uni";
                    saveData("ref", ref);
                }
                else if (ref =="calendar") {
                    ref = loadData("ref");
                    if (ref =="bbs") {
                        document.body.id = "cmp";
                    }
                    else if (ref =="university") {
                        document.body.id = "uni";
                    }

                }
            }
            else if (g =="faculty.html") {
                document.body.id = "cmp";
            }
            else {
                document.body.id = "uni";
            }
        }
        else {
            if (filename =="scholarship.html") {
                if (g !="examinee.html") { 
                    document.body.id = "scl";
                }
            }
            else if(filename =="dormitory.html") {
                if (g !="examinee.html") { 
                    document.body.id = "dmt";
                }
            }
            else if(filename =="fees.html") {
                if (g =="students.html" || g =="faculty.html" ||g =="") { 
                    document.body.id = "uni";
                }
            }
            else if(filename =="club.html") {
                if (g =="examinee.html") { 
                    document.body.id = "sup";
                }
            }
        }

        var id = document.body.id;

        if (g =="students.html" || g =="faculty.html" ||g =="") { 
            document.body.id = id;
        }
        else if (g =="examinee.html") {
            document.body.id = id;
        }
        else if (g =="pharmacy.html") {
            document.body.id = id;
        }
        else if (g =="lifesciences.html") {
            document.body.id = id;
        }
        else if (g =="parents.html" || g =="alumni.html" || g =="company.html" || g =="public.html") {
            document.body.id = id;
        }
    }
}

function renderLocation(g, directory, filename, fileLocation) {
    var location;
    var delimiter = "&nbsp;&gt;&nbsp;";

    location ="<a href=\"" + fileLocation + "index.html\">HOME</a>";
    location = location + delimiter;

    if (!isToppage(filename)) {

        changeBodyId(g, directory, filename);

        if (g =="students.html" || g=="index.html" || g =="") { 
            location = location + "<a href=\"" + fileLocation + "students.html\">在学生の皆さまへ</a>";
        }
        else if (g =="examinee.html") {
            location = location + "<a href=\"" + fileLocation + g + "\">受験生の皆さまへ</a>";
        }
        else if (g =="pharmacy.html") {
            location = location + "<a href=\"" + fileLocation + g + "\">薬学部</a>";
        }
        else if (g =="lifesciences.html") {
            location = location + "<a href=\"" + fileLocation + g + "\">生命科学部</a>";
        }
        else if (g =="parents.html") {
            location = location + "<a href=\"" + fileLocation + g + "\">保護者の皆さまへ</a>";
        }
        else if (g =="alumni.html") {
            location = location + "<a href=\"" + fileLocation + g + "\">卒業生の皆さまへ</a>";
        }
        else if (g =="company.html") {
            location = location + "<a href=\"" + fileLocation + g + "\">企業の皆さまへ</a>";
        }
        else if (g =="public.html") {
            location = location + "<a href=\"" + fileLocation + g + "\">社会人・一般の皆さまへ</a>";
        }
        else if (g =="faculty.html") {
            location = location + "<a href=\"" + fileLocation + g + "\">教職員の方々へ</a>";
        }
        location = location + delimiter;

        //サブディレクトリ
        if (directory =="university" && filename!="index.html") {
            location = location + "<a href=\"" + fileLocation + "university/index.html\">大学案内</a>";
            location = location + delimiter;
        }
        else if (directory =="audit") {
            if (filename =="guide.html" || filename =="prevent.html" || filename =="system.html" || filename =="whistle-blowing.html") {
                location = location + "<a href=\"" + fileLocation + "university/index.html\">大学案内</a>";
                location = location + delimiter;
            }
            else {
                location = location + "<a href=\"" + fileLocation + "university/index.html\">大学案内</a>";
                location = location + delimiter;
                location = location + "<a href=\"" + fileLocation + "university/audit/prevent.html\">研究費等の不正防止への取り組みについて</a>";
                location = location + delimiter;
            }
        }
        else if(directory =="campus") {
            if (g =="examinee.html") {
                location = location + "<a href=\"" + fileLocation + "toexaminee/support/index.html\">生活支援（学費・奨学金等）</a>";
                location = location + delimiter;
            }
            else {
                location = location + "<a href=\"" + fileLocation + "campus/bbs/bbs_nai.html\">キャンパスライフ</a>";
                location = location + delimiter;
            }
        }
        else if(directory =="calendar") {
            if (g =="students.html" || g=="company.html" || g =="faculty.html") {
                var ref = loadData("ref");
                if (ref == "bbs") {
                    location = location + "<a href=\"" + fileLocation + "campus/bbs/bbs_nai.html\">キャンパスライフ</a>";
                    location = location + delimiter;
                }
                else if (ref =="university") {
                    location = location + "<a href=\"" + fileLocation + "university/index.html\">大学案内</a>";
                    location = location + delimiter;
                }
                else {
                    location = location + "<a href=\"" + fileLocation + "campus/calendar/c4.html\">大学カレンダー</a>";
                    location = location + delimiter;
                }
            }
            else {
                location = location + "<a href=\"" + fileLocation + "university/index.html\">大学案内</a>";
                location = location + delimiter;
            }
        }
        else if (directory =="access" && filename!="map.html") {
            location = location + "<a href=\"" + fileLocation + "toexaminee/access/map.html\">アクセスマップ・バス時刻表</a>";
            location = location + delimiter;
        }
        else if (directory =="nyushi" && (filename!="index.html" && filename!="setsumei.html")) {
            var ref = getReferer(0);
            if (g =="examinee.html") {
                location = location + "<a href=\"" + fileLocation + "toexaminee/nyushi/index.html\">入試情報</a>";
                location = location + delimiter;
            }
            else if (g =="students.html" && ref =="index.html") {
                location = location + "<a href=\"" + fileLocation + "university/index.html\">大学案内</a>";
                location = location + delimiter;
            }
        }
        else if (directory =="event"  && (filename!="index.html")) {
            location = location + "<a href=\"" + fileLocation + "toexaminee/event/index.html\"> イベントのお知らせ</a>";
            location = location + delimiter;
        }
        else if (directory =="support"  && (filename!="index.html")) {
            if (g =="examinee.html") {
                location = location + "<a href=\"" + fileLocation + "toexaminee/support/index.html\">生活支援（学費・奨学金等）</a>";
                location = location + delimiter;
            }
            else {
                location = location + "<a href=\"" + fileLocation + "university/index.html\">大学案内</a>";
                location = location + delimiter;
            }
        }
        else if (directory =="plant") {
            location = location + "<a href=\"" + fileLocation + "link/index.html\">リンク</a>";
            location = location + delimiter;
            if (filename!="index.html") {
                location = location + "<a href=\"" + fileLocation + "plant/index.html\">薬用植物園</a>";
                location = location + delimiter;
            }

        }
        else if (directory =="syllabus" && filename!="index.html") {
            location = location + "<a href=\"" + fileLocation + "lifesciences/syllabus/index.html\">シラバス</a>";
            location = location + delimiter;
        }
        else if (directory =="bbs" && filename!="bbs_nai.html") {
            location = location + "<a href=\"" + fileLocation + "campus/bbs/bbs_nai.html\">キャンパスライフ</a>";
            location = location + delimiter;
        }
        else if (directory =="alumni" && filename!="index.html" /*  */ && filename!="2008_HyogikaiSenkyo.html" /* */ ) {
            location = location + "<a href=\"" + fileLocation + "alumni/index.html\">証明書の申込方法</a>";
            location = location + delimiter;
        }
        else if (directory =="job" && filename!="index.html") {
            location = location + "<a href=\"" + fileLocation + "job/index.html\">進路・就職情報</a>";
            location = location + delimiter;
        }
        else if (directory =="data") {
            location = location + "<a href=\"" + fileLocation + "job/index.html\">進路・就職情報</a>";
            location = location + delimiter;
            if (filename!="index.html") {
                location = location + "<a href=\"" + fileLocation + "job/data/index.html\">進路・就職データ</a>";
                location = location + delimiter;
            }
        }
        else if (directory =="inquiry" && filename!="index.html") {
            location = location + "<a href=\"" + fileLocation + "inquiry/index.html\">お問合せ</a>";
            location = location + delimiter;
        }
        else if (directory =="lab" && filename!="index.html") {
            if (g =="pharmacy.html") {
                location = location + "<a href=\"" + fileLocation + "pharmacy/lab/index.html\">研究室案内</a>";
                location = location + delimiter;
            }
            else if (g =="lifesciences.html") {
                location = location + "<a href=\"" + fileLocation + "lifesciences/lab/index.html\">研究室案内</a>";
                location = location + delimiter;
            }
        }
        else if (directory =="gp" && filename!="index.html") {
            location = location + "<a href=\"" + fileLocation + "gp/index.html\">文部科学省 大学教育改革支援事業 (GP)</a>"; /* , COE)</a>"; */
            location = location + delimiter;
        }
        else if (directory =="facilities" && filename!="index.html") {
            location = location + "<a href=\"" + fileLocation + "university/facilities/index.html\">本学全景と施設紹介</a>";
            location = location + delimiter;
        }
        else if (directory =="public" && !(filename=="recruit.html" || filename=="close.html")) {
            location = location + "<a href=\"" + fileLocation + "public/recruit.html\">職員公募</a>";
            location = location + delimiter;
        }
        else {
            var location_url = getLocationHref();
            var parentdirectoryname = location_url.split("/").reverse()[2];
            if (parentdirectoryname =="news") {
                location = location + "<a href=\"" + fileLocation + "news/newsntopics.html\">News &amp; Topics</a>";
                location = location + delimiter;
            }
        }
    }
    document.getElementById("location_header").innerHTML = location;
}
//location------------------------------------------------------------------------

//menu------------------------------------------------------------------------
var dinamicWebServer = 'http://tupls-portal.toyaku.ac.jp/';

function renderMenu(group, filename, fileLocation) {
    //toppage
    if (isToppage(filename)) {
        saveData("group", filename);
        document.getElementById("menu").innerHTML = menuText(group, fileLocation, true);
    }
    else {
        document.getElementById("menu").innerHTML = menuText(group, fileLocation, false);
    }
}

function menuText(group, fileLocation, isTop) {
    if (group =="students.html" || group =="") { 
        return menuForStudents(fileLocation);
    }
    else if (group =="examinee.html") {
        return menuForExaminees(fileLocation);
    }
    else if (group =="pharmacy.html") {
        return menuForPharmacy(fileLocation);
    }
    else if (group =="lifesciences.html") {
        return menuForLifeSciences(fileLocation);
    }
    else if (group =="parents.html") {
        return menuForParents(fileLocation);
    }
    else if (group =="alumni.html") {
        return menuForAlumni(fileLocation);
    }
    else if (group =="company.html") {
        return menuForCompany(fileLocation);
    }
    else if (group =="public.html") {
        return menuForPublic(fileLocation);
    }
    else if (group =="faculty.html") {
        return menuForFaculty(fileLocation);
    }
    else if (group =="index.html") {
        if (isTop) {
            return menuForTop(fileLocation);
        }
        else {
            return menuForStudents(fileLocation);
        }
    }
}

function menuForTop(fileLocation) {
    var menu;

    menu = "<ul class=\"menu\">";
    menu += "<li><a class=\"uni\" href=\"" + fileLocation + "university/index.html\">大学案内</a></li>";
    menu += "<li><a class=\"ins\" href=\"" + fileLocation + "university/facilities/index.html\">本学全景と施設紹介</a></li>";
    menu += "<li><a class=\"pha\" href=\"" + fileLocation + "pharmacy.html\">薬学部</a></li>";
    menu += "<li><a class=\"ls\" href=\"" + fileLocation + "lifesciences.html\">生命科学部</a></li>";
    menu += "<li><a class=\"gra\" href=\"" + fileLocation + "pharmacy/graduate_info.html\">大学院薬学研究科</a></li>";
    menu += "<li><a href=\"http://www.ls.toyaku.ac.jp/graduate/\" target=\"_blank\">大学院生命科学研究科</a></li>";
    menu += "<li><a class=\"job\" href=\"" + fileLocation + "job/index.html\">進路・就職情報</a></li>";
    menu += "<li><a class=\"acc\" href=\"" + fileLocation + "toexaminee/access/map.html\">アクセスマップ・バス時刻表</a></li>";
    menu += "<li><a class=\"cnt\" href=\"" + fileLocation + "toexaminee/contact/form.html\">資料請求</a></li>";
    menu += "<li><a class=\"inq\" href=\"" + fileLocation + "inquiry/index.html\">お問合せ</a></li>";
    menu += "</ul>";

    return menu;
}

function menuForExaminees(fileLocation) {
    var menu;

    menu = "<div><a href=\"" + fileLocation + "pharmacy.html\"><img src=\"" + fileLocation + "images/btn_menu_pha.png\" class=\"menu_img\"></a></div>";
    menu += "<div><a href=\"" + fileLocation + "lifesciences.html\"><img src=\"" + fileLocation + "images/btn_menu_ls.png\" class=\"menu_img\"></a></div>";
    menu += "<ul class=\"menu\">";
    menu += "<li><a class=\"nys\" href=\"" + fileLocation + "toexaminee/nyushi/index.html\">入試情報</a></li>";
    menu += "<li><a class=\"evn\" href=\"" + fileLocation + "toexaminee/event/index.html\">入試イベント</a></li>";
    menu += "<li><a class=\"tur\" href=\"" + fileLocation + "toexaminee/event/campus_tour.html\">キャンパス見学について</a></li>";
    menu += "<li><a class=\"cnt\" href=\"" + fileLocation + "toexaminee/contact/form.html\">資料請求（案内・願書等）</a></li>";
    menu += "<li><a class=\"uni\" href=\"" + fileLocation + "university/index.html\">大学案内</a></li>";
    menu += "<li><a class=\"ins\" href=\"" + fileLocation + "university/facilities/index.html\">本学全景と施設紹介</a></li>";
    menu += "<li><a class=\"pha\" href=\"" + fileLocation + "pharmacy.html\">薬学部</a></li>";
    menu += "<li><a class=\"ls\" href=\"" + fileLocation + "lifesciences.html\">生命科学部</a></li>";
    menu += "<li><a class=\"sup\" href=\"" + fileLocation + "toexaminee/support/index.html\">生活支援（学費・奨学金等）</a></li>";
    menu += "<li><a class=\"job\" href=\"" + fileLocation + "job/index.html\">進路・就職情報</a></li>";
    menu += "<li><a class=\"pem\" href=\"" + fileLocation + "pharmacy/employment.html\">薬学部で取得できる資格</a></li>";
    menu += "<li><a href=\"http://www.ls.toyaku.ac.jp/cate03/sub01_cate03/sub01_cate03.html\" target=\"_blank\">生命科学部で取得できる資格</a></li>";
    menu += "<li><a class=\"acc\" href=\"" + fileLocation + "toexaminee/access/map.html\">アクセスマップ・バス時刻表</a></li>";
    menu += "<li><a class=\"inq\" href=\"" + fileLocation + "inquiry/index.html\">お問合せ</a></li>";
    menu += "<li><a class=\"lnk\" href=\"" + fileLocation + "link/index.html\">リンク</a></li>";
    menu += "<li><a class=\"nws\" href=\"" + fileLocation + "news/newsntopics.html\">News &amp; Topics</a></li>";
    menu += "</ul>";

    return menu;
}

function menuForStudents(fileLocation) {
    var menu;

    menu = "<div><a href=\"" + fileLocation + "pharmacy.html\"><img src=\"" + fileLocation + "images/btn_menu_pha.png\" class=\"menu_img\"></a></div>";
    menu += "<div><a href=\"" + fileLocation + "lifesciences.html\"><img src=\"" + fileLocation + "images/btn_menu_ls.png\" class=\"menu_img\"></a></div>";
    menu += "<ul class=\"menu\">";
    menu += "<li><a class=\"uni\" href=\"" + fileLocation + "university/index.html\">大学案内</a></li>";
    menu += "<li><a class=\"ins\" href=\"" + fileLocation + "university/facilities/index.html\">本学全景と施設紹介</a></li>";
    menu += "<li><a class=\"gra\" href=\"" + fileLocation + "pharmacy/graduate_info.html\">大学院薬学研究科</a></li>";
    menu += "<li><a href=\"http://www.ls.toyaku.ac.jp/graduate/\" target=\"_blank\">大学院生命科学研究科</a></li>";
    menu += "<li><a class=\"cmp\" href=\"" + fileLocation + "campus/bbs/bbs_nai.html\">キャンパスライフ</a></li>";
    menu += "<li><a class=\"scl\" href=\"" + fileLocation + "toexaminee/support/scholarship.html\">奨学金</a></li>";
    menu += "<li><a class=\"dmt\" href=\"" + fileLocation + "toexaminee/support/dormitory.html\">学生寮</a></li>";
    menu += "<li><a class=\"job\" href=\"" + fileLocation + "job/index.html\">進路・就職情報</a></li>";
    menu += "<li><a class=\"acc\" href=\"" + fileLocation + "toexaminee/access/map.html\">アクセスマップ・バス時刻表</a></li>";
    menu += "<li><a class=\"inq\" href=\"" + fileLocation + "inquiry/index.html\">お問合せ</a></li>";
    menu += "<li><a class=\"lnk\" href=\"" + fileLocation + "link/index.html\">リンク</a></li>";
    menu += "<li><a class=\"nws\" href=\"" + fileLocation + "news/newsntopics.html\">News &amp; Topics</a></li>";
    menu += "</ul>";

    return menu;
}

function menuForPharmacy(fileLocation) {
    var menu;

    menu = "<div><a href=\"" + fileLocation + "lifesciences.html\"><img src=\"" + fileLocation + "images/btn_menu_ls.png\" class=\"menu_img\"></a></div>";
    menu += "<ul class=\"menu\">";
    menu += "<li><a class=\"dea\" href=\"" + fileLocation + "pharmacy/dean.html\">学部長からのメッセージ</a></li>";
    menu += "<li><a class=\"gui\" href=\"" + fileLocation + "pharmacy/guidance.html\">学部案内</a></li>";
    menu += "<li><a class=\"lab\" href=\"" + fileLocation + "pharmacy/lab/index.html\">研究室案内</a></li>";
    menu += "<li><a class=\"gra\" href=\"" + fileLocation + "pharmacy/graduate_info.html\">大学院薬学研究科</a></li>";
    menu += "<li><a class=\"cur\" href=\"" + fileLocation + "pharmacy/curriculum.html\">特色・教育カリキュラム</a></li>";
    menu += "<li><a class=\"syl\" href=\"" + fileLocation + "pharmacy/syllabus.html\">薬学部シラバス</a></li>";
    menu += "<li><a class=\"tsc\" href=\"" + fileLocation + "pharmacy/timeschedule.html\">時間割表</a></li>";
    menu += "<li><a class=\"pem\" href=\"" + fileLocation + "pharmacy/employment.html\">薬学部で取得できる資格</a></li>";
    menu += "<li><a class=\"nws\" href=\"" + fileLocation + "news/newsntopics.html\">News &amp; Topics</a></li>";
    menu += "</ul>";

    return menu;
}

function menuForLifeSciences(fileLocation) {
    var menu;

    menu = "<div><a href=\"" + fileLocation + "pharmacy.html\"><img src=\"" + fileLocation + "images/btn_menu_pha.png\" class=\"menu_img\"></a></div>";
    menu += "<ul class=\"menu\">";
    menu += "<li><a class=\"dea\" href=\""+ fileLocation + "lifesciences/dean.html\">学部長からのメッセージ</a></li>";
    menu += "<li><a href=\"http://www.ls.toyaku.ac.jp/\" target=\"_blank\">学部案内</a></li>";
    menu += "<li><a class=\"lab\" href=\"" + fileLocation + "lifesciences/lab/index.html\">研究室案内</a></li>";
    menu += "<li><a href=\"http://www.ls.toyaku.ac.jp/graduate/\" target=\"_blank\">大学院生命科学研究科</a></li>";
    menu += "<li><a class=\"syl\" href=\""+ fileLocation + "lifesciences/syllabus/index.html\">生命科学部シラバス</a></li>";
    menu += "<li><a class=\"tsc\" href=\""+ fileLocation + "lifesciences/timeschedule.html\">時間割表</a></li>";
    menu += "<li><a href=\"http://www.ls.toyaku.ac.jp/cate03/sub01_cate03/sub01_cate03.html\" target=\"_blank\">生命科学部で取得できる資格</a></li>";
    menu += "<li><a href=\"http://www.ls.toyaku.ac.jp/esl/index.html\" target=\"_blank\">海外研修HP</a></li>";
    menu += "<li><a class =\"nws\" href=\"" + fileLocation + "news/newsntopics.html\">News &amp; Topics</a></li>";
    menu += "</ul>";

    return menu;
}

function menuForParents(fileLocation) {
    var menu;

    menu = "<ul class=\"menu\">";
    menu += "<li><a class=\"uni\" href=\"" + fileLocation + "university/index.html\">大学案内</a></li>";
    menu += "<li><a class=\"ins\" href=\"" + fileLocation + "university/facilities/index.html\">本学全景と施設紹介</a></li>";
    menu += "<li><a class=\"pha\" href=\"" + fileLocation + "pharmacy.html\">薬学部</a></li>";
    menu += "<li><a class=\"ls\" href=\"" + fileLocation + "lifesciences.html\">生命科学部</a></li>";
    menu += "<li><a class=\"gra\" href=\"" + fileLocation + "pharmacy/graduate_info.html\">大学院薬学研究科</a></li>";
    menu += "<li><a href=\"http://www.ls.toyaku.ac.jp/graduate/\" target=\"_blank\">大学院生命科学研究科</a></li>";
    menu += "<li><a class=\"job\" href=\"" + fileLocation + "job/index.html\">進路・就職情報</a></li>";
    menu += "<li><a class=\"acc\" href=\"" + fileLocation + "toexaminee/access/map.html\">アクセスマップ・バス時刻表</a></li>";
    menu += "<li><a class=\"inq\" href=\"" + fileLocation + "inquiry/index.html\">お問合せ</a></li>";
    menu += "<li><a class=\"lnk\" href=\"" + fileLocation + "link/index.html\">リンク</a></li>";
    menu += "<li><a class=\"nws\" href=\"" + fileLocation + "news/newsntopics.html\">News &amp; Topics</a></li>";
    menu += "</ul>";

    return menu;
}

function menuForAlumni(fileLocation) {
    var menu;

    menu = "<ul class=\"menu\">";
    menu += "<li><a class=\"uni\" href=\"" + fileLocation + "university/index.html\">大学案内</a></li>";
    menu += "<li><a class=\"ins\" href=\"" + fileLocation + "university/facilities/index.html\">本学全景と施設紹介</a></li>";
    menu += "<li><a class=\"nop\" href=\"" + fileLocation + "alumni/index.html\">証明書の申込方法</a></li>";
    menu += "<li><a class=\"job\" href=\"" + fileLocation + "job/index.html\">進路・就職情報</a></li>";
    menu += "<li><a class=\"acc\" href=\"" + fileLocation + "toexaminee/access/map.html\">アクセスマップ・バス時刻表</a></li>";
    menu += "<li><a class=\"inq\" href=\"" + fileLocation + "inquiry/index.html\">お問合せ</a></li>";
    menu += "<li><a class=\"lnk\" href=\"" + fileLocation + "link/index.html\">リンク</a></li>";
    menu += "<li><a class=\"nws\" href=\"" + fileLocation + "news/newsntopics.html\">News &amp; Topics</a></li>";
    menu += "</ul>";

    return menu;
}

function menuForCompany(fileLocation) {
    var menu;

    menu = "<ul class=\"menu\">";
    menu += "<li><a class=\"job\" href=\"" + fileLocation + "job/index.html\">進路・就職情報</a></li>";
    menu += "<li><a class=\"cal\" href=\"" + fileLocation + "campus/calendar/c4.html\">大学カレンダー</a></li>";
    menu += "<li><a class=\"pem\" href=\"" + fileLocation + "pharmacy/employment.html\">薬学部で取得できる資格</a></li>";
    menu += "<li><a href=\"http://www.ls.toyaku.ac.jp/cate03/sub01_cate03/sub01_cate03.html\" target=\"_blank\">生命科学部で取得できる資格</a></li>";
    menu += "<li><a class=\"ind\" href=\"" + fileLocation + "industry/index.html\">産学協同研究</a></li>";
    menu += "<li><a class=\"uni\" href=\"" + fileLocation + "university/index.html\">大学案内</a></li>";
    menu += "<li><a class=\"ins\" href=\"" + fileLocation + "university/facilities/index.html\">本学全景と施設紹介</a></li>";
    menu += "<li><a class=\"pha\" href=\"" + fileLocation + "pharmacy.html\">薬学部</a></li>";
    menu += "<li><a class=\"ls\" href=\"" + fileLocation + "lifesciences.html\">生命科学部</a></li>";
    menu += "<li><a class=\"gra\" href=\"" + fileLocation + "pharmacy/graduate_info.html\">大学院薬学研究科</a></li>";
    menu += "<li><a href=\"http://www.ls.toyaku.ac.jp/graduate/\" target=\"_blank\">大学院生命科学研究科</a></li>";
    menu += "<li><a class=\"acc\" href=\"" + fileLocation + "toexaminee/access/map.html\">アクセスマップ・バス時刻表</a></li>";
    menu += "<li><a class=\"inq\" href=\"" + fileLocation + "inquiry/index.html\">お問合せ</a></li>";
    menu += "<li><a class=\"lnk\" href=\"" + fileLocation + "link/index.html\">リンク</a></li>";
    menu += "<li><a class=\"nws\" href=\"" + fileLocation + "news/newsntopics.html\">News &amp; Topics</a></li>";
    menu += "</ul>";

    return menu;
}

function menuForPublic(fileLocation) {
    var menu;

    menu = "<ul class=\"menu\">";
    menu += "<li><a class=\"nws\" href=\"" + fileLocation + "news/newsntopics.html\">News &amp; Topics</a></li>";
    menu += "<li><a class=\"uni\" href=\"" + fileLocation + "university/index.html\">大学案内</a></li>";
    menu += "<li><a class=\"pha\" href=\"" + fileLocation + "pharmacy.html\">薬学部</a></li>";
    menu += "<li><a class=\"ls\" href=\"" + fileLocation + "lifesciences.html\">生命科学部</a></li>";
    menu += "<li><a class=\"gra\" href=\"" + fileLocation + "pharmacy/graduate_info.html\">大学院薬学研究科</a></li>";
    menu += "<li><a href=\"http://www.ls.toyaku.ac.jp/graduate/\" target=\"_blank\">大学院生命科学研究科</a></li>";
    menu += "<li><a class=\"ins\" href=\"" + fileLocation + "university/facilities/index.html\">本学全景と施設紹介</a></li>";
    menu += "<li><a class=\"job\" href=\"" + fileLocation + "job/index.html\">進路・就職情報</a></li>";
    menu += "<li><a class=\"rec\" href=\"" + fileLocation + "public/recruit.html\">職員公募</a></li>";
    menu += "<li><a class=\"acc\" href=\"" + fileLocation + "toexaminee/access/map.html\">アクセスマップ・バス時刻表</a></li>";
    menu += "<li><a class=\"inq\" href=\"" + fileLocation + "inquiry/index.html\">お問合せ</a></li>";
    menu += "<li><a class=\"lnk\" href=\"" + fileLocation + "link/index.html\">リンク</a></li>";
    menu += "</ul>";

    return menu;
}

function menuForFaculty(fileLocation) {
    var menu;

    menu = "<ul class=\"menu\">";
    menu += "<li><a href=\"http://tupls-portal.toyaku.ac.jp/lec_info/input/\">事務課専用画面</a></li>";
    menu += "<li><a class=\"cmp\" href=\"" + fileLocation + "campus/bbs/bbs_nai.html\">キャンパスライフ</a></li>";
    menu += "<li><a class=\"nws\" href=\"" + fileLocation + "news/newsntopics.html\">News &amp; Topics</a></li>";
    menu += "</ul>";

    return menu;
}
//menu------------------------------------------------------------------------

//menubar------------------------------------------------------------------------
function renderMenubar(fileLocation) {
    document.getElementById("menubar").innerHTML = menubarText(fileLocation);
}

function menubarText(fileLocation) {
    var menubar;
    
    menubar ="<div class=\"linkbtn3_exa\"><a href=\"" + fileLocation + "examinee.html\"><span class=\"btn_exa\"></span></a></div>";
    menubar +="<div class=\"linkbtn3_stu\"><a href=\"" + fileLocation + "students.html\"><span class=\"btn_stu\"></span></a></div>";
    menubar +="<div class=\"linkbtn3_prt\"><a href=\"" + fileLocation + "parents.html\"><span class=\"btn_prt\"></span></a></div>";
    menubar +="<div class=\"linkbtn3_alm\"><a href=\"" + fileLocation + "alumni.html\"><span class=\"btn_alm\"></span></a></div>";
    menubar +="<div class=\"linkbtn3_cmp\"><a href=\"" + fileLocation + "company.html\"><span class=\"btn_cmp\"></span></a></div>";
    menubar +="<div class=\"linkbtn3_pub\"><a href=\"" + fileLocation + "public.html\"><span class=\"btn_pub\"></span></a></div>";
    menubar +="<div class=\"linkbtn3_fcl\"><a href=\"" + fileLocation + "faculty.html\"><span class=\"btn_fcl\"></span></a></div>";

    return menubar;
}
//menubar------------------------------------------------------------------------

//policy------------------------------------------------------------------------
function renderPolicy(fileLocation) {
    var policy;

    policy = "<ul class=\"list_menu\">";
    policy = policy + "<li><a href=\"" + fileLocation + "policy/privacypolicy.html\">プライバシーポリシー</a></li>";
    policy = policy + "<li><a href=\"" + fileLocation + "policy/sitepolicy.html\">サイトポリシー</a></li>";
    policy = policy + "</ul>";
    document.getElementById("policy").innerHTML = policy;
}
//policy------------------------------------------------------------------------

//sitemap------------------------------------------------------------------------
function renderSitemap(fileLocation) {
    var sitemap;
    sitemap ="<ul class=\"sitemap\">";
    sitemap = sitemap + "<li><a href=\"" + fileLocation + "sitemap/index.html\">サイトマップ</a></li>";
    sitemap = sitemap + "<li><a href=\"" + fileLocation + "campus/index_E.html\" target=\"_blank\">English</a><span class=\"link_blank_white\">&nbsp;</span></li>";
    sitemap = sitemap + "</ul>";
    document.getElementById("sitemap").innerHTML = sitemap;
}
//sitemap------------------------------------------------------------------------
