<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="col_Header.ascx.cs" Inherits="MTCUN.Mobile.User_Col.col_Header" %>
<%@ Import Namespace="MTCUN" %>
<link id="Link1" runat="server" href="../themes/bottom.css" rel="stylesheet"
    type="text/css" />
<script src="../JScript/Cookie.js" type="text/javascript"></script>
<script type="text/javascript">

    var xmlHttp = null;
    //var newcount = 0;


    //接收消息并返回本地未读消息数。
    function ReceiveMsg() {
        try {
            if (window.XMLHttpRequest) {
                xmlHttp = new XMLHttpRequest();
            }
            else if (window.ActiveXObject) {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlHttp.open("GET", __mt_requesturl + "&action=1&s=" + Math.random(), false);
            xmlHttp.send("");

            var text = xmlHttp.responseText;
            var count = parseInt(text);

            if (count > 0) {
                var sound = true;

                var chat = document.getElementById("__mt_chat");
                if (chat != null) {
                    doRefresh(); //刷新消息列表或对话窗。
                    sound = false;
                }

                //显示消息数。
                setMsgCount(count, sound);
            }
        }
        catch (ex) {
            alert(ex);
        }
    }

    //心跳程序，保持与服务器连接。
    function HeartRequest() {
        try {

            if (window.XMLHttpRequest) {
                xmlHttp = new XMLHttpRequest();
            }
            else if (window.ActiveXObject) {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }

            //连接心跳程序。
            xmlHttp.open("GET", __mt_requesturl + "&action=0&s=" + Math.random(), false);
            xmlHttp.send("");

            //存在新消息，需要更新。
            if (xmlHttp.responseText == "1") {
                ReceiveMsg();
            }

            window.setTimeout(HeartRequest, 15000);
        }
        catch (ex) {
            alert(ex);
            window.setTimeout(HeartRequest, 15000);
        }
    }
    window.setTimeout(HeartRequest, 15000);

    //显示消息数。
    function setMsgCount(num, sound) {
        if (num > 0) {

            if (num > 99) {
                divNum.innerHTML = "<span style='font-size:9px'>99+</span>";
            }
            else {
                divNum.innerHTML = "<span>" + num + "</span>";
            }

            divNumBg.style.display = "block";
            if (sound)
                PaySound();
        } else {
            divNum.innerHTML = "";
            divNumBg.style.display = "none";
        }
    }

    //播放声音。
    function PaySound() {
        try {
            document.getElementById('bgaudio').play();
        } catch (e) {
        }
    }
</script>
<style type="text/css">
    .header_menu {
        text-align: right;
    }

    #header {
        text-align: right;
    }

    #header_menu, #header_menu ul {
        text-align: right;
    }

    #header_sub {
        right: 0px;
        left: auto;
        bottom: auto;
    }

        #header_sub .dian {
            right: 20px;
            left: auto;
        }


    .sub_menus {
        padding: 0px;
        margin: 0px;
        list-style: none;
    }

    .sanjiao {
        position: absolute;
        bottom: 5px;
        right: 5px;
        width: 0;
        height: 0;
        border: 5px solid transparent;
        border-right: 5px solid #000;
        border-bottom: 5px solid #000;
        opacity: .5;
    }
</style>

<div class="btn3 clearfix">

    <div class="menu">
        <div class="bt-name"><a href="../frame/index.aspx">首页</a></div>
    </div>
    <!--menu-->


    <div class="menu">
        <div class="bt-name" onclick="window.location='../msg/topic.aspx';">

            <div style="position: relative; max-width: 80px; height: 100%; border: 0px dashed red; padding-left: 20px; padding-right: 20px; margin-left: auto; margin-right: auto">
                消息

                            <div id="divNumBg" style="display: none; border-radius: 10px; position: absolute; background-color: rgba(255, 0, 0,0.9); color: #ffffff; width: 18px; height: 18px; left: 1px; top: 5px"></div>
                <div id="divNum" style="position: absolute; color: #ffffff; width: 18px; height: 18px; line-height: 18px; vertical-align: middle; text-align: center; left: 1px; top: 5px"></div>
            </div>


        </div>


    </div>
    <!--menu-->


    <div class="menu">
        <div class="bt-name">菜单</div>
        <div class="sanjiao"></div>
        <div class="new-sub">

            <div id="menu_1" style="text-align: right" runat="server" visible="false">

                <ul style="margin: 0px; padding: 0px">
                    <li style="border-top-width: 0px">
                        <a href="../Consultant/PostPotential.aspx">意向登记</a>
                    </li>
                    <li>
                        <a href="../Consultant/PotentialList.aspx">咨询回访</a>
                    </li>
                    <li style="height: 2px; background-color: #c0c0c0"></li>
<%--                    <li>
                        <a href="../Register/PostStudent.aspx">学员报名</a>
                    </li>
                    <li>
                        <a href="../Register/StudentList.aspx">学员查询</a>
                    </li>--%>
                    <li>
                        <a href="../Register/ClassList.aspx">开班查询</a></li>
                    <li>
                        <a href="../frame/exit.aspx">退出系统</a></li>
                </ul>
            </div>
            <div id="menu_2" style="text-align: right" runat="server" visible="false">
                <ul style="margin: 0px; padding: 0px">
                    <li style="border-top-width: 0px">
                        <a href="../Teacher/ClassList.aspx">我的班级</a>
                    </li>
                    <li>
                        <a href="../Teacher/LessonTable.aspx">我的课表</a>
                    </li>
<%--                    <li>
                        <a href="../Tools/IDSignIn.aspx">学员签到</a>
                    </li>--%>
                    <li>
                        <a href="../frame/exit.aspx">退出系统</a></li>
                </ul>
            </div>
            <div id="menu_3" style="text-align: right" runat="server" visible="false">
                <ul style="margin: 0px; padding: 0px">
                    <li style="border-top-width: 0px">
                        <a href="../Class/PostClass.aspx">开设班级</a>
                    </li>
                    <li>
                        <a href="../Class/ClassList.aspx">班级查询</a>
                    </li>
                    <li>
                        <a href="../Class/LessonTable.aspx">课程总表</a>
                    </li>
                    <li>
                        <a href="../Class/LessonDay.aspx">今日班级</a>
                    </li>
                    <li>
                        <a href="../Affairs/TeacherLessons.aspx">课时统计</a>
                    </li>
                    <li>
                        <a href="../frame/exit.aspx">退出系统</a></li>
                </ul>
            </div>
            <div id="menu_4" style="text-align: right" runat="server" visible="false">
                <ul style="margin: 0px; padding: 0px">
                    <li style="border-top-width: 0px">
                        <a href="../Finance/Bills.aspx">消费单</a>
                    </li>
                    <li>
                        <a href="../Finance/Payments.aspx">充值单</a></li>
                                        <li>
                        <a href="../Finance/loan.aspx">借款查询</a></li>
                    <li>
                        <a href="../Finance/Arrearage.aspx">欠费查询</a></li>
                    <li>
                        <a href="../Finance/FeeTable.aspx">对账单</a></li>
                    <li>
                        <a href="../frame/exit.aspx">退出系统</a></li>
                </ul>
            </div>
            <div id="menu_7" style="text-align: right" runat="server" visible="false">
                <ul style="margin: 0px; padding: 0px">
                    <li style="border-top-width: 0px">
                        <a href="../Report/Analysis.aspx">今日分析</a>
                    </li>
                    <li>
                        <a href="../frame/exit.aspx">退出系统</a></li>
                </ul>
            </div>
            <div id="menu_8" style="text-align: right" runat="server" visible="false">
            </div>
            <div id="menu_9" style="text-align: right" runat="server" visible="false">
                <ul style="margin: 0px; padding: 0px">
<%--                    <li style="border-top-width: 0px">
                        <a href="../media/sms/SendToUser.aspx?app=true">发给员工</a>
                    </li>--%>
                    <li>
                        <a href="../sms/SendToUser.aspx">发给员工</a>
                    </li>
                    <li>
                        <a href="../sms/SmsReceive.aspx">接收短信</a>
                    </li>
                    <li>
                        <a href="../frame/exit.aspx">退出系统</a></li>
                </ul>
            </div>
            <div id="menu10" style="text-align: right" runat="server" visible="false">
            </div>

            <div class="tiggle"></div>
            <div class="innertiggle"></div>
        </div>

    </div>

    <!--menu-->

</div>
<!--btn3-->
<script type="text/javascript">
    //弹出垂直菜单
    $(".menu").click(function () {
        if ($(this).hasClass("cura")) {
            $(this).children(".new-sub").hide(); //当前菜单下的二级菜单隐藏
            $(".menu").removeClass("cura"); //同一级的菜单项
        } else {
            $(".menu").removeClass("cura"); //移除所有的样式
            $(this).addClass("cura"); //给当前菜单添加特定样式
            $(".menu").children(".new-sub").slideUp("fast"); //隐藏所有的二级菜单
            $(this).children(".new-sub").slideDown("fast"); //展示当前的二级菜单
        }
    });
</script>

<span style="display: none; visibility: hidden">
    <audio id="bgaudio">
        <source src='<%=swq.SystemVirtualPath + "Sound/msg.mp3" %>' type="audio/mpeg">
    </audio>
</span>

<script type="text/javascript">
    //初始化数目。
    setMsgCount(__mt_newmsgcount, true);
</script>
