<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="menu.aspx.cs" Inherits="MYAPP.General.menu" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<link rel="stylesheet" type="text/css" href="/theme/2/style.css">
<link rel="stylesheet" type="text/css" href="/theme/2/menu.css">
<link rel="stylesheet" type="text/css" href="/theme/2/pheader.css">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<title>Main Menu</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body class="panel" onLoad="menu_expand();">
<div>
  <div id="tabs">
    <ul id="nav_menu">
      <li><a id="menu_1" href="javascript:parent.view_menu(1);" title="Menu" class="active"> <span> <%=_board_title%></span></a></li>
    </ul>
  </div>
  <div id="body"> <a id="expand_link" href="javascript:menu_expand();"><u><span id="expand_text">Ex</span></u></a>
    <ul id="menu">
      <asp:Repeater ID="rp_board" runat="server">
        <ItemTemplate>
          <li class="L1"><a href="javascript:c(m<%#XPath("@id")%>);" id="m<%#XPath("@id")%>"> <span> <img src="<%#COE.Components.MyFun.ReplaceNullString(XPath("@icon").ToString().Trim(),"/manage/menuimages/tree/folder.gif")%>"> <%#XPath("@name")%></span></a></li>
          <ul id="m<%#XPath("@id")%>d" style="display: none;" class="U1">
            <ul style="background:none">
              <asp:Repeater ID="rp_title" runat="server" DataSource='<%# GetChildRelation(Convert.ToInt32(XPath("@id")))%>'>
                <ItemTemplate>
                  <li class="L22"><a href="javascript:a('<%#COE.Components.MyFun.ReplaceNullString(XPath("@url").ToString().Trim(),"main.aspx")%>','<%#XPath("@id")%>');" id="f<%#XPath("@id")%>"><span><img src="<%#COE.Components.MyFun.ReplaceNullString(XPath("@icon").ToString().Trim(),"/images/arrow_right.gif")%>" align="absMiddle" /> <%#XPath("@name")%></span></a></li>
                </ItemTemplate>
              </asp:Repeater>
            </ul>
          </ul>
        </ItemTemplate>
      </asp:Repeater>
    </ul>
  </div>
  <div id="bottom"> </div>
</div>
<script language="JavaScript">
var cur_id="";
var flag=0,sflag=0;

//-------- 菜单点击事件 -------
function c(srcelement)
{
  var targetid,srcelement,targetelement;
  var strbuf;

  //-------- 如果点击了展开或收缩按钮---------
  targetid=srcelement.id+"d";
  targetelement=document.getElementById(targetid);

  if (targetelement.style.display=="none")
  {
     srcelement.className="active";
     targetelement.style.display='';

     menu_flag=0;
     expand_text.innerHTML="InEx";
  }
  else
  {
     srcelement.className="";
     targetelement.style.display="none";

     menu_flag=1;
     expand_text.innerHTML="Ex";
     var links=document.getElementsByTagName("A");
     for (i=0; i<links.length; i++)
     {
       srcelement=links[i];
       if(srcelement.parentNode.className.toUpperCase()=="L1" && srcelement.className=="active" && srcelement.id.substr(0,1)=="m")
       {
          menu_flag=0;
          expand_text.innerHTML="InEx";
          break;
       }
     }
  }
}
function set_current(id)
{
   cur_link=document.getElementById("f"+cur_id)
   if(cur_link)
      cur_link.className="";
   cur_link=document.getElementById("f"+id);
   if(cur_link)
      cur_link.className="active";
   cur_id=id;
}
//-------- 打开网址 -------
function a(URL,id)
{
   set_current(id);
   if(URL.substr(0,7)!="http://" && URL.substr(0,6)!="ftp://" && URL.substr(0,1)!="/")
      URL = "/manage/"+URL;
    parent.openURL(URL,0);
}
function b(URL,id)
{
   set_current(id);
   URL = "/app/"+URL;
    parent.openURL(URL,0);
}
//-------- 菜单全部展开/收缩 -------
var menu_flag=1;
function menu_expand()
{
  if(menu_flag==1)
     expand_text.innerHTML="InEx";
  else
     expand_text.innerHTML="Ex";

  menu_flag=1-menu_flag;

  var links=document.getElementsByTagName("A");
  for (i=0; i<links.length; i++)
  {
    srcelement=links[i];
    if(srcelement.parentNode.className.toUpperCase()=="L1" || srcelement.parentNode.className.toUpperCase()=="L21")
    {
      targetelement=document.getElementById(srcelement.id+"d");
      if(menu_flag==0)
      {
        targetelement.style.display='';
        srcelement.className="active";
      }
      else
      {
        targetelement.style.display="none";
        srcelement.className="";
      }
    }
  }
}
    </script>
</body>
</html>