<%@ page autoeventwireup="false" inherits="WebExam.Web.Index, App_Web_jvwg1jie" title="首页" language="VB" masterpagefile="~/Page.master" enableviewstate="False" enableviewstatemac="False" %>

<%@ MasterType VirtualPath="~/Page.master" %>

<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="ContentHead" EnableViewState="False">
    <link href="elearning/style/page_default.css" rel="stylesheet" type="text/css" />
 
    <link href="/jslib/jquery/plugins/jquery-validate/css.css" rel="stylesheet"
        type="text/css" />
    <script src="/jslib/jquery/plugins/jquery-validate/jquery.validate.min.js" type="text/javascript"></script>
     <script type="text/javascript">
         // <!CDATA[
         if (top != self) { top.location = self.location; self.close(); }
         function GetCookie(sName) {
             var aCookie = document.cookie.split("; ");
             for (var i = 0; i < aCookie.length; i++) {
                 var aCrumb = aCookie[i].split("=");
                 if (sName == aCrumb[0])
                     return DecodeCookie(decodeURIComponent(aCrumb[1]));
             }
             return null;
         }
         function CodeCookie(str) {
             var strRtn = "";

             for (var i = str.length - 1; i >= 0; i--) {
                 strRtn += str.charCodeAt(i);
                 if (i) strRtn += "a";
             }
             return strRtn;
         }
         function DecodeCookie(str) {
             var strArr;
             var strRtn = "";
             strArr = str.split("a");
             for (var i = strArr.length - 1; i >= 0; i--)
                 strRtn += String.fromCharCode(eval(strArr[i]));
             return strRtn;
         }
         function SetCookie(name, value, expires) {


             if (expires == 1) {
                 var exp = new Date("December 31, 3666"); ; //长期有效的办法//;new Date()//
                 document.cookie = name + "=" + encodeURIComponent(CodeCookie(value)) + " ;  expires=" + exp.toGMTString() + " ; path=/";
             }
             else {
                 var exp = new Date()
                 exp.setTime(exp.getTime() - exp.getTime());
                 document.cookie = name + "=" + encodeURIComponent(CodeCookie(value)) + " ;  expires=" + exp.toGMTString() + " ; path=/";

             } 
         }
         function rememberMe() {
             SetCookie("client:myId", document.getElementById("username").value, 1)


             return true;
         }
         function isNew(creatStr) {
             var createArr = creatStr.split("-");
             var creatDate = new Date(createArr[0], parseInt(createArr[1]) - 1, createArr[2]);
             var today = new Date();
             var c, t, ch;
             var MinMilli = 1000 * 60;
             var HrMilli = MinMilli * 60;
             var DyMilli = HrMilli * 24;
             t = Date.parse(today);
             c = Date.parse(creatDate);
             ch = t - c; document.write(creatStr);
             if (Math.round(Math.abs(ch / DyMilli)) < 2) {
                 //window.event.srcElement.style.background="";
                 document.write("\<img src=\"images\/new.gif\"\>");
             }
         }
         function openNews(p, f) {
             if (p.charAt(0) == "~") {
                 p = root + p.substr(2, p.length - 2);

             }

             var newwin = window.open(p + f, "news");
             newwin.focus();
             return;
         }
         // ]]>
    </script>

<script type="text/javascript">
    $.validator.setDefaults({
        submitHandler: function() {
            var userName = encodeURIComponent($("#username").val());
            var pwd = encodeURIComponent($("#password").val());
            var p = document.getElementById("ck_remember").checked ? "1" : "0";
          
            self.location = "secure/logon.aspx?userid=" + userName + "&pwd=" + pwd + "&p=" + p;
            return false;
        }
    });

    $().ready(function() {
    var strUI = GetCookie("client:myId");
    var yh = document.getElementById("username"); if (yh == null) return;
    //yh.focus();
    if (strUI != null) {
        yh.value = strUI;
    }
        // validate signup form on keyup and submit
        $(document.forms[0]).validate({
            rules: {
                username: {
                    required: true
                },
                password: {
                    required: true
                }
                
            },
            messages: {
               
                username: {
                required: "*"
                },
                password: {
                required: "*"
                }
            }
        });

    });
</script>

</asp:Content>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="mainCopy">

   
    <table style="margin:10px;">
        <tbody>
            <tr>
                <td style="vertical-align: top;">
                   
                    <table id="login" style="display:none" border="0">
                        <tr>
                            <td>
                                <img id="serverView" alt="照片要求150*200像素，JPG格式。" height="200" onerror="this.src='data/usersphoto/nophoto.gif'"
                                    width="150" />

                                <script type="text/javascript">

					       document.getElementById("serverView").src ="data\/usersphoto\/"+getUserId()+".jpg";
                                </script>

                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                             <b>

                                    <script language="javascript">
                                     
					                                document.write(getUserId());
                                    </script>

                                </b>
                            </td>
                        </tr>
                    </table>
                    <table id="notLogin" style="display:none" cellspacing="0" cellpadding="0" width="188" border="0">
                        <tr>
                            <td style="height: 40px;">
                                用户帐号
                            </td>
                            <td style="height: 40px;">
                                <input id="username" style="width: 105px" tabindex="1" maxlength="20" size="14" name="username"
 autocomplete="off" />
                                
                            </td>
                        </tr>
                        <tr>
                            <td style="height: 40px; letter-spacing:25px">
                                密码
                            </td>
                            <td style="height: 40px;">
                                <input id="password" style="width: 105px" tabindex="2" type="password" maxlength="16"
                                    name="password" />        </td>
                        </tr>
                        <tr>
                            <td align="right" colspan="2" style="padding-right: 23px">
                                <input type="checkbox" id="ck_remember" tabindex="3" /><label for="ck_remember">记住为我自动登录</label>
                            </td>
                            
                        </tr>
                        <tr>
                            <td align="center" colspan="2">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                            <input type="submit" onclick="rememberMe();" value="登录" />
                   
                                &nbsp; &nbsp;<a href="secure/RecoverPasswd.aspx">忘记密码</a>
                                &nbsp;&nbsp;<a href="selfreg.aspx">注册</a>
                            </td>
                        </tr>
                        
                    </table>
                </td>
                <td class="HotNews" style="width: 100%; vertical-align: top; padding-right: 15px">
                    <div class="newsDiv" style="height:333px">
                        <dl>
                            <dt style="margin-right: 0px; padding-right: 0; border-bottom-color: #000000; border-width: 0;
                                border-bottom: 1px; width: 100%; border-style: solid;">新闻公告<span style="float: right"><a
                                    href="news/index.aspx" style="text-decoration: none; font-size: 11px; color: blue;
                                    font-weight: normal">更多>></a>&nbsp;&nbsp;</span></dt>
                            <asp:Repeater ID="Repeater_news" runat="server">
                                <ItemTemplate>
                                    <dd>
                                        <a href='javascript:openNews("<%# DataBinder.Eval(Container, "DataItem.path") %>","<%# DataBinder.Eval(Container, "DataItem.defaultFile") %>")'>
                                            <%#CStr(DataBinder.Eval(Container, "DataItem.topic"))%>
                                        </a><span style="font-size: .8em;">

                                            <script type="text/javascript">
						isNew("<%# cstr(DataBinder.Eval(Container, "DataItem.updateTime","{0:yyyy-MM-dd}")) %>")
                                            </script>

                                        </span>
                                    </dd>
                                </ItemTemplate>
                            </asp:Repeater>
                        </dl>
                    </div>

                </td>
            </tr>
        </tbody>
    </table>
    <script type ="text/javascript" >
       var loginUserId=getUserId();
       if(loginUserId==null){
          document.getElementById("notLogin").style.display="block"
          document.getElementById("login").style.display="none"
       }
       else{
          document.getElementById("login").style.display="block"
          document.getElementById("notLogin").style.display="none"
       
       }
    </script>
</asp:Content>
