function createMenu(currentPage, currentSubPage, toRoot) {
    resultHtml = "<td width='155' align=right><!-- MENU -->"
          + "<p><img src='" + toRoot + "common/images/sp.gif' width='1' height='39'><br>"
          + "  <a href='" + toRoot + "index.html'><img src='" + toRoot + "common/images/logo_econe.gif' alt='EC-One' width='128' height='32' border='0' style='margin-right:9px'></a><br>";
          
    resultHtml += createDynamicMenu(currentPage, currentSubPage, toRoot);

    resultHtml += ""
          + "<table width='137' border='0' cellspacing='0'>"
          + "<tr>"
          + "<td><div align='center'><a href='http://www.opencbank.net/' target='_blank'><img src='" + toRoot + "images/cbank_logo.gif' border='0' alt='cBank'></a></div></td>"
          + "</tr>"
          + "<tr>"
          + "<td><div align='center'><span class='mn-c'><a href='http://www.opencbank.net/' target='_blank'>"
          + "<img src='" + toRoot + "images/top_cbank.gif' width='130' height='40' border='0' alt='cBank'></a></span> </div></td>"
          + "</tr>"
          + "<tr><td><br></td></tr>"
          + "<tr><!-- RBCリンク -->"
          + " <td><div align='center'><a href='http://www.rubybizcommons.jp/' target='_blank'><img src='" + toRoot + "images/rbc_logo.gif' border='0' alt='Ruby Business Commons'></a></div></td>"
          + "</tr><!-- /RBCリンク -->"
          + "<tr><!-- RBC説明 -->"
          + " <td><div align='center'><span class='mn-c'><img src='" + toRoot + "common/images/sp.gif' width='10' height='1'><a href='http://www.rubybizcommons.jp/' target='_blank'> <img src='" + toRoot + "images/rbc_message.gif'  border='0' alt='Ruby Business Commons'></a></span></div></td>"
          + "</tr><!-- /RBC説明 -->"
          + "<tr><td><br></td></tr>"
          + "<tr><!-- JavaEdgeリンク -->"
          + " <td><div align='center'><img src='" + toRoot + "images/java_edge_logo.png' border='0' alt='Java Edge'></div></td>"
          + "</tr><!-- /JavaEdgeリンク -->"
          + "<tr><!-- JavaEdge説明 -->"
          + " <td><div align='center'><span class='mn-c'><img src='" + toRoot + "images/java_edge_message.gif'  border='0' alt='JavaEdge'></span></div></td>"
          + "</tr><!-- /JavaEdge説明 -->"
          + "</table>"
          + ""
          + "<p>　</p>"
          + "<table width='137' border='0' cellspacing='0'>"
          + "<tr>"
          + "<td><div align='center'><a href='http://www.adobe.co.jp/products/acrobat/readstep2.html' target='_blank'>"
          + "<img src='" + toRoot + "images/get_adobe_reader.gif' width='88' height='31' border='0'></a></div></td>"
          + "</tr>"
          + "  <tr>"
          + " <td><p class='mn-c'><a href='http://www.adobe.co.jp/products/acrobat/readstep2.html' target='_blank'>"
          + "<img src='" + toRoot + "images/top_adobe.gif' width='130' height='28' border='0'></a></p>"
          + "</td></tr></table>"
          + "<p><br>    <br></p></td>";
    return resultHtml;
}



function createDynamicMenu(currentPage, currentSubPage, toRoot) {
    //読込先が表示しているメニューを指し示す矢印
    var arrow = "<img src='" + toRoot + "common/images/mn_arw.gif' alt='' width='8' height='13' border='0' style='margin-left:5px; margin-right:6px'>";
    topArrow = "";
    productArrow = "";
    rubyArrow = "";
    irArrow = "";
    companyArrow = "";
    recruitArrow = "";
    blogArrow = "";
    eventArrow = "";
    communityArrow = "";
    knowledgeArrow = "";
    contactArrow = "";

    //矢印が無いとき、各メニューに左からのマージンを設定
    margin = " style='margin-left:19px'";
    topMargin = margin;
    productMargin = margin;
    irMargin = margin;
    companyMargin = margin;
    recruitMargin = margin;
    blogMargin = margin;
    eventMargin = margin;
    communityMargin = margin;
    knowledgeMargin = margin;
    contactMargin = margin;
    blogMargin = margin;

    if (currentPage == "top") {
        topArrow = arrow;
        topMargin = "";
    } else if (currentPage == "product") {
        productArrow = arrow;
        productMargin = "";
    } else if (currentPage == "recruit") {
        recruitArrow = arrow;
        recruitMargin = "";
    } else if (currentPage == "company") {
        companyArrow = arrow;
        companyMargin = "";
    } else if (currentPage == "ir") {
        irArrow = arrow;
        irMargin = "";
    } else if (currentPage == "blog") {
        blogArrow = arrow;
        blogMargin = "";
    } else if (currentPage == "event") {
        eventArrow = arrow;
        eventMargin = "";
    } else if (currentPage == "community") {
        communityArrow = arrow;
        communityMargin = "";
    } else if (currentPage == "knowledge") {
        knowledgeArrow = arrow;
        knowledgeMargin = "";
    } else if (currentPage == "contact") {
        contactArrow = arrow;
        contactMargin = "";
    } else if (currentPage == "aws_service") {
        contactArrow = arrow;
        contactMargin = "";
    }

    dynamicMenuHtml = "<div  align=left style='margin-left:18px'><img src='" + toRoot + "common/images/sp.gif' width='1' height='27'><br>"
                + "<img src='" + toRoot + "common/images/line_menu.gif' width='137' height='1' vspace='10'><br>"
                + "<a href='" + toRoot + "index.html'>"
                + topArrow
                + "<img src='" + toRoot + "common/images/mn_top.gif' width='28' height='14' border='0' alt='TOP'" + topMargin + "></a><br>"
    //読込先が新着情報のページならTOPの下に新着情報のサブメニュー作成
    if (currentPage == "top" && currentSubPage != "top") {
        dynamicMenuHtml += createTopSubMenu(currentSubPage, toRoot);
    }
    dynamicMenuHtml += "<img src='" + toRoot + "common/images/line_menu.gif' width='137' height='1' vspace='10'><br>"
                + "<a href='" + toRoot + "product/index.html'>"
                + productArrow
                + "<img src='" + toRoot + "common/images/mn_product.gif' width='86' height='17' border='0' alt='サービス・製品'" + productMargin + "></a><br>";

    //読込先が製品・サービスのページなら製品・サービスのサブメニュー作成
    if (currentPage == "product") {
        dynamicMenuHtml += createProductSubMenu(currentSubPage, toRoot);
    }
    
    dynamicMenuHtml += "<img src='" + toRoot + "common/images/line_menu.gif' width='137' height='1' vspace='10'><br>"
                 + "<a href='" + toRoot + "recruit/index.html'>"
                 + recruitArrow
                 + "<img src='" + toRoot + "common/images/mn_recruit.gif' width='50' height='15' border='0' alt='採用情報'" + recruitMargin + "></a><br>";
    //同様に採用情報のサブメニュー作成
    if (currentPage == "recruit") {
        dynamicMenuHtml += createSubRecruitMenu(currentSubPage, toRoot);
    }
    dynamicMenuHtml += "<img src='" + toRoot + "common/images/line_menu.gif' width='137' height='1' vspace='10'><br>"
                 + "<a href='" + toRoot + "company/index.html'>"
                 + companyArrow
                 + "<img src='" + toRoot + "common/images/mn_company.gif' width='52' border='0' height='14' alt='会社概要'" + companyMargin + "></a><br>";
    //同様に会社情報のサブメニュー作成
    if (currentPage == "company") {
        dynamicMenuHtml += createSubCompanyMenu(currentSubPage, toRoot);
    }
    dynamicMenuHtml += "<img src='" + toRoot + "common/images/line_menu.gif' width='137' height='1' vspace='10'><br>"
                + "<a href='" + toRoot + "knowledge/index.html'>"
                + knowledgeArrow
                + "<img src='" + toRoot + "common/images/mn_knowledge.gif' width='84' height='14' border='0' alt='OpenKnowledge'" + knowledgeMargin + "></a><br>";
    //読込先がナレッジのページならナレッジのサブメニュー作成
    if (currentPage == "knowledge") {
        dynamicMenuHtml += createKnowledgeSubMenu(currentSubPage, toRoot);
    }
    
    
    //以下のイベント、お問い合わせ、社長ブログはサブメニューなし
    dynamicMenuHtml += "<img src='" + toRoot + "common/images/line_menu.gif' width='137' height='1' vspace='10'><br>"
                     + "<a href='http://blog.saishu.jp/' target='_blank'>"
                     + blogArrow
                     //社長ブログは矢印もマージンも動的に変化させる必要なし（リンクのみだから）
                     + "<img src='" + toRoot + "common/images/mn_blog.gif' width='61' height='13' border='0' alt='社長ブログ'" + blogMargin + "></a><br>"
                     + "<img src='" + toRoot + "common/images/line_menu.gif' width='137' height='1' vspace='10'><br>"
                     + "<a href='" + toRoot + "event/index.html'>"
                     + eventArrow
                     + "<img src='" + toRoot + "common/images/mn_event.gif' width='48' height='16' border='0' alt='イベント'" + eventMargin + "></a><br>"
                     + "<img src='" + toRoot + "common/images/line_menu.gif' width='137' height='1' vspace='10'><br>"
                     + "<a href='" + toRoot + "community/index.html'>"
                     + communityArrow
                     + "<img src='" + toRoot + "common/images/mn_community.gif' width='67' height='17' border='0' alt='コミュニティ'" + communityMargin + "></a><br>"
                     + "<img src='" + toRoot + "common/images/line_menu.gif' width='137' height='1' vspace='10'><br>"
                     + "<a href='" + toRoot + "contact/index.html'>"
                     + contactArrow
                     + "<img src='" + toRoot + "common/images/mn_contact.gif' width='74' height='15' border='0' alt='お問い合わせ'" + contactMargin + "></a><br>"
                     + "<img src='" + toRoot + "common/images/line_menu.gif' width='137' height='1' vspace='10'></p></div>";
    return dynamicMenuHtml;
}


//TOPのサブメニュー
function createTopSubMenu(currentSubPage, toRoot) {
    newStyle = "mn-sub2";
    
    if (currentSubPage == "new") {
        newStyle = "mn-sub2-s";
    }

    resultHtml = "<div class='mn-sub2'>"
               + "<a href='" + toRoot + "new/new.html' class='" + newStyle + "'>新着情報</a></div>";
    return resultHtml;
}




//製品・サービスのサブメニュー
function createProductSubMenu(currentSubPage, toRoot) {

    //プロフェッショナルサービス
    pro_serviceStyle = "mn-sub2";
    consultantStyle = "mn-subsub";
    serviceStyle = "mn-subsub";
	//プロダクトサービス
	productStyle = "mn-sub2";
    idmStyle = "mn-subsub";
    service_merchandiseStyle = "mn-subsub";
    cframeworkStyle = "mn-subsub";
    wilyStyle = "mn-subsub";
    grainStyle = "mn-subsub";
    federationStyle = "mn-subsub";
    //ナレッジセンター
	knowledge_centerStyle = "mn-sub2";
	rescueStyle = "mn-subsub";
    //ECソリューション
	ec_solutionStyle = "mn-sub2";
	ec_riderStyle = "mn-subsub";
	item_bridgeStyle = "mn-subsub";
	//事例紹介
	case_reportStyle = "mn-sub2"
	//Rubyへの取り組み
    ruby_indexStyle = "mn-sub2";
    ruby_rubyStyle = "mn-subsub";
    
	//AWSアプリケーション最適化サービス
	aws_serviceStyle = "mn-sub2"

    if (currentSubPage == "pro_service") {
        pro_serviceStyle = "mn-sub2-s";
    }
    if (currentSubPage == "knowledge_center") {
        knowledge_centerStyle = "mn-sub2-s";
    }
    if (currentSubPage == "ec_solution") {
        ec_solutionStyle = "mn-sub2-s";
    }
    if (currentSubPage == "product" || currentSubPage == "service") {
        productStyle = "mn-sub2-s";
    }
    if (currentSubPage == "case_report")  {
        case_reportStyle = "mn-sub2-s";
    }
    if (currentSubPage == "pro_service_menu") {
        serviceStyle = "mn-subsub-s";
    }
    if (currentSubPage == "con_service_menu") {
        consultantStyle = "mn-subsub-s";
    }
    if (currentSubPage == "idm") {
        idmStyle = "mn-subsub-s";
    }
    if (currentSubPage == "service_merchandise") {
        service_merchandiseStyle = "mn-subsub-s";
    }
    if (currentSubPage == "cframework") {
        cframeworkStyle = "mn-subsub-s";
    }
    if (currentSubPage == "wily") {
        wilyStyle = "mn-subsub-s";
    }
    if (currentSubPage == "grain") {
        grainStyle = "mn-subsub-s";
    }
    if (currentSubPage == "federation") {
        federationStyle = "mn-subsub-s";
    }
    if (currentSubPage == "rescue") {
        rescueStyle = "mn-subsub-s";
    }
    if (currentSubPage == "ec_rider") {
        rescueStyle = "mn-subsub-s";
    }
    if (currentSubPage == "item_bridge") {
        rescueStyle = "mn-subsub-s";
    }
	
    if (currentSubPage == "ruby_index") {
        ruby_indexStyle = "mn-sub2-s";
    }
    if (currentSubPage == "ruby_ruby") {
        ruby_rubyStyle = "mn-subsub-s";
    }

    if (currentSubPage == "aws_service") {
        aws_serviceStyle = "mn-sub2-s";
    }

    resultHtml = "<div class='mn-sub2'>"
               + "<a href='" + toRoot + "product/pro_service.html' class='" + pro_serviceStyle + "'>プロフェッショナル・サービス</a><br>"
               + "<a href='" + toRoot + "product/pro_service_menu.html' class='" + serviceStyle + "'>-&nbsp;プロフェッショナル</a><br>"
               + "<a href='" + toRoot + "product/pro_service_menu.html' class='" + serviceStyle + "'>&nbsp;&nbsp;サービスメニュー</a><br>"
               + "<a href='" + toRoot + "product/con_service_menu.html' class='" + consultantStyle + "'>-&nbsp;コンサルティング</a><br>"
               + "<a href='" + toRoot + "product/con_service_menu.html' class='" + consultantStyle + "'>&nbsp;&nbsp;メニュー</a><br>"
               + "<a href='" + toRoot + "product/product.html' class='" + productStyle + "'>プロダクト・サービス</a><br>"
               + "<a href='" + toRoot + "product/id.html' class='" + idmStyle + "'>-&nbsp;ID管理</a><br>"
               + "<a href='" + toRoot + "product/service.html' class='" + service_merchandiseStyle + "'>-&nbsp;サービス</a><br>"
               + "<a href='" + toRoot + "product/cframework.html' class='" + cframeworkStyle + "'>-&nbsp;J2EE フレームワーク</a><br>"
               + "<a href='" + toRoot + "product/wily.html' class='" + wilyStyle + "'>-&nbsp;J2EE パフォーマンス</a><br>"
               + "<a href='" + toRoot + "product/wily.html' class='" + wilyStyle + "'>&nbsp;&nbsp;性能監視</a><br>"
               + "<a href='" + toRoot + "product/grain.html' class='" + grainStyle + "'>-&nbsp;モバイルソリューション</a><br>"
               + "<a href='" + toRoot + "product/federation.html' class='" + federationStyle + "'>-&nbsp;フェデレーション</a><br>"
               + "<a href='" + toRoot + "product/federation.html' class='" + federationStyle + "'>&nbsp;&nbsp;サービス</a><br>"
			   
               + "<a href='" + toRoot + "product/ec_solution.html' class='" + ec_solutionStyle + "'>ECソリューション</a><br>"
               + "<a href='http://www.ec-rider.net/' target='_blank' class='" + ec_riderStyle + "'>-&nbsp;EC-Rider</a><br>"
               + "<a href='http://www.ec-bridge.net/' target='_blank' class='" + item_bridgeStyle + "'>-&nbsp;ITEM BRIDGE</a><br>"
			   
               + "<a href='" + toRoot + "product/knowledge_center.html' class='" + knowledge_centerStyle + "'>ナレッジセンター・サービス</a><br>"
               + "<a href='" + toRoot + "product/rescue.html' class='" + rescueStyle + "'>-&nbsp;ナレッジセンター</a><br>"
               + "<a href='" + toRoot + "product/rescue.html' class='" + rescueStyle + "'>&nbsp;&nbsp;レスキューサービス</a><br>"
               + "<a href='" + toRoot + "product/aws_service.html' class='" + aws_serviceStyle + "'>AWSアプリケーション<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;最適化サービス</a><br>"
			   
               + "<a href='" + toRoot + "product/case_report.html' class='" + case_reportStyle + "'>事例紹介</a><br>"
               + "<a href='" + toRoot + "ruby/index.html' class='" + ruby_indexStyle + "'>Rubyへの取り組み</a><br>"
               + "<a href='" + toRoot + "ruby/ruby.html' class='" + ruby_rubyStyle + "'>-&nbsp;Rubyとは</a><br>"
               + "<a href='http://www.opencbank.net/' target='_blank' class='mn-sub2'>cBankサイトへ</a><br>"
               + "</div>";
    return resultHtml;
}


//会社概要のサブメニュー
function createSubCompanyMenu(currentSubPage, toRoot) {
    indexStyle = "mn-sub2";
    strategy_visionStyle = "mn-sub2";
    settle_publicStyle = "mn-sub2";

    if (currentSubPage == "index" || currentSubPage == "profile_map" || currentSubPage == "profile_history") {
        indexStyle = "mn-sub2-s";
    }
    if (currentSubPage == "strategy_vision") {
        strategy_visionStyle = "mn-sub2-s";
    }
    if (currentSubPage == "settle_public") {
        settle_publicStyle = "mn-sub2-s";
    }

    resultHtml = "<div class='mn-sub2'>"
               + "<a href='" + toRoot + "company/index.html' class='" + indexStyle + "'>会社基本情報</a><br>"
               + "<a href='" + toRoot + "company/strategy_vision.html' class='" + strategy_visionStyle + "'>経営理念</a><br>"
               + "<a href='" + toRoot + "company/settle_public.html' class='" + settle_publicStyle + "'>決算公告</a><br></div>";
    return resultHtml;
}


//採用情報のサブメニュー
function createSubRecruitMenu(currentSubPage, toRoot) {
    indexStyle = "mn-sub2";
    juniorStyle = "mn-subsub";
    seniorStyle = "mn-subsub";
    personnelStyle = "mn-subsub";
    recruit_newStyle = "mn-sub2";
    recruit_expStyle = "mn-sub2";
    seminar_newStyle = "mn-sub2";
    
    if (currentSubPage == "index") {
        indexStyle = "mn-sub2-s";
    }
    if (currentSubPage == "junior") {
        juniorStyle = "mn-subsub-s";
    }
    if (currentSubPage == "senior") {
        seniorStyle = "mn-subsub-s";
    }
    if (currentSubPage == "personnel") {
        personnelStyle = "mn-subsub-s";
    }
    if (currentSubPage == "recruit_new") {
        recruit_newStyle = "mn-sub2-s";
    }
    if (currentSubPage == "recruit_exp") {
        recruit_expStyle = "mn-sub2-s";
    }
    if (currentSubPage == "seminar_new") {
        seminar_newStyle = "mn-sub2-s";
    }

    resultHtml = "<div class='mn-sub2'>"
               + "<a href='" + toRoot + "recruit/index.html' class='" + indexStyle + "'>採用情報</a><br>"
               + "<a href='" + toRoot + "recruit/junior.html' class='" + juniorStyle + "'>-&nbsp;新卒社員の紹介</a><br>"
               + "<a href='" + toRoot + "recruit/senior.html' class='" + seniorStyle + "'>-&nbsp;キャリア社員の紹介</a><br>"
               + "<a href='" + toRoot + "recruit/personnel.html' class='" + personnelStyle + "'>-&nbsp;教育研修体系／</a><br>"
               + "<a href='" + toRoot + "recruit/personnel.html' class='" + personnelStyle + "'>&nbsp;&nbsp;キャリアパス</a><br>"                              
               + "<a href='" + toRoot + "recruit/recruit_new.html' class='" + recruit_newStyle + "'>新卒採用</a><br>"
               + "<a href='" + toRoot + "recruit/recruit_exp.html' class='" + recruit_expStyle + "'>中途採用</a><br>"
               + "<a href='" + toRoot + "recruit/seminar_new.html' class='" + seminar_newStyle + "'>セミナー</a><br>"
               + "</div>";
    return resultHtml;

}


//OpenKnowledgeのサブメニュー
function createKnowledgeSubMenu(currentSubPage, toRoot) {
    tipsStyle = "mn-sub2";
    pj_visitStyle = "mn-sub2";
    tax_sysStyle = "mn-sub2";
    
//    if (currentSubPage == "tips") {
//        tipsStyle = "mn-sub2-s";
//    }
    if (currentSubPage == "pj_visit") {
        pj_visitStyle = "mn-sub2-s";
    }

    resultHtml = "<div class='mn-sub2'>"
//               + "<a href='" + toRoot + "knowledge/tips.html' class='" + tipsStyle + "'>Tips集</a><br>"
               + "<a href='" + toRoot + "knowledge/pj_visit.html' class='" + pj_visitStyle + "'>プロジェクト探訪</a><br>"
               + "</div>";
    return resultHtml;
}



//社長ブログのサブメニュー なし
//イベントのサブメニュー なし
//お問い合わせのサブメニュー なし