<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="Web.share.login1._default" %>
<%@ Register src="/share/foot.ascx" tagname="foot" tagprefix="uc1" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
       <title>OA标题页</title>
      <script type="text/ecmascript" src="/js/md5.js"></script>
     <link href="/css/defaultfloatdiv.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        window.onload = function () {

            var oInput = document.getElementById('tbPassword_lan');
            oInput.value = '';
            oInput.onkeyup = function () {
                //强度状态设为默认
                document.getElementById('tbPassword_lan').style.color = "grey";
                var pwd = this.value;
                var result = 0;
                for (var i = 0, len = pwd.length; i < len; ++i) {
                    result |= charType(pwd.charCodeAt(i));
                }

                var level = 0;
                //对result进行四次循环，计算其level
                for (var i = 0; i <= 4; i++) {
                    if (result & 1) {
                        level++;
                    }
                    //右移一位
                    result = result >>> 1;
                }
                if (pwd.length >= 6) {
                    switch (level) {
                        case 1:
                            document.getElementById('tbPassword_lan').style.color = "red";
                            break;
                        case 2:
                            document.getElementById('tbPassword_lan').style.color = "orange";
                            break;
                        case 3:
                            document.getElementById('tbPassword_lan').style.color = "blue";
                            break;
                        case 4:
                            document.getElementById('tbPassword_lan').style.color = "green";
                            break;
                    }
                }
            }
        }
        /*
            定义一个函数，对给定的数分为四类(判断密码类型)，返回十进制1，2，4，8
            数字 0001 -->1  48~57
            小写字母 0010 -->2  97~122
            大写字母 0100 -->4  65~90
            特殊 1000 --> 8 其它
        */
        function charType(num) {
            if (num >= 48 && num <= 57) {
                return 1;
            }
            if (num >= 97 && num <= 122) {
                return 2;
            }
            if (num >= 65 && num <= 90) {
                return 4;
            }
            return 8;
        }
    </script>
    <script>
    if ((function () {
        var u = navigator.userAgent;
        var b = !!u.match(/AppleWebKit.*Mobile.*/);
        b = b || u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
        b = b || u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1;
        return b;
    })()) location ='/m/default.aspx';
</script>
<script language="JavaScript">
    if (window != top)
        top.location.href = location.href; 
</script> 
</head>
<body style =" height :100%" >
    <form id="form1" runat="server"  style ="height :100%; ">
    <div id="main-c" style ="height :96%; ">
<div id="main-c-01"><asp:Label ID="biaoti" runat="server"></asp:Label></div>
<div id="main-c-02" >
    
    <div id="main-c-02-01" >

<div class="denglu">  <asp:LinkButton ID="lbWechat" runat="server" OnClick="lbWechat_Click" ForeColor ="White"  Visible ="false" >微信登录</asp:LinkButton>
	&nbsp;&nbsp;<a href="javascript:showDialog();"><span style ="color :white;">密码登录</span></a>  
   
</div>
<div class="ui-mask" id="mask" onselectstart="return false"></div>
<div class="dialog" id="dialogMove" onselectstart='return false;'>
	<div class="dialog-title" id="dialogDrag"  onselectstart="return false;" >
		
		登录系统

		<a class="dialog-closebutton" href="javascript:hideDialog();"></a>

	</div>
	<div class="dialog-content">
    

 
		<div class="dialog-l40 dialog-pt15">
              <asp:TextBox ID="tbUserName_lan" runat="server" style="height:36px;padding-left: 3px;padding-top: 
    3px;background-color:#fff ;border: 1px solid #000000;" MaxLength="25" placeholder="人员编号/登录名/邮箱/电话" 
                  CssClass="dialog-input dialog-input-username"></asp:TextBox>

		
		</div>
		<div class="dialog-l40 dialog-pt15">
               <asp:TextBox ID="tbPassword_lan" runat="server" placeholder="请输入密码" autocomplete="off"  onblur="cal()" onfocus="c()"
                   style="height: 36px;padding-left: 3px;padding-top: 3px;background-color:#fff ;
border: 1px solid #000000;" TextMode="Password"  CssClass="dialog-input dialog-input-password"></asp:TextBox>  
       


		</div>
          	<div style ="margin :5px;" >
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                    ControlToValidate="tbUserName_lan" Display="Dynamic" ErrorMessage="请输入登录名。" 
                                    ValidationGroup="lan" ForeColor="Red"></asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                                    ControlToValidate="tbUserName_lan" Display="Dynamic" ErrorMessage="登录名不合规范。" 
                                    ValidationExpression="^[^%&gt;&lt;'&amp;*=!&quot;?]{2,25}$" 
                                    ValidationGroup="lan" ForeColor="Red"></asp:RegularExpressionValidator>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                    ControlToValidate="tbPassword_lan" Display="Dynamic" ErrorMessage="请输入密码。" 
                                    ValidationGroup="lan" ForeColor="Red"></asp:RequiredFieldValidator>
        </div>
		<div class="dialog-l40">
		<a href ="/m/forget/default.aspx" target ="_blank" >找回密码</a>
		</div>
		<div>
            <asp:LinkButton ID="LinkButton2" runat="server" CssClass="dialog-submit" ValidationGroup="lan" OnClick="LinkButton2_Click" Font-Size="Large" Font-Bold="False" Font-Names="微软雅黑" ForeColor="White">登   录</asp:LinkButton>
       
	
		</div>

<%--		<div class="dialog-l40">
			<a href="#">立即注册</a>
		</div>--%>
	</div>
</div>


          
</div></div>
<div id="main-c-03">


<!--  一组内容模块开始   --> 
<div id ="table_NoticeList" runat ="server">
 
            <div style ="text-align :left " ><asp:Label ID="lbMessage" runat="server"></asp:Label></div>
<table width="960" border="0" cellpadding="0" cellspacing="1" >
  

  <tr>
    <td >
    <asp:GridView ID="GridView1" runat="server" 
            onrowdatabound="GridView1_RowDataBound" Width="100%" 
                BorderWidth="1px" CssClass="gv" AutoGenerateColumns="False" 
                            onselectedindexchanging="GridView1_SelectedIndexChanging" 
            onrowcreated="GridView1_RowCreated">
            <RowStyle BorderWidth="1px" CssClass="gvrow" Font-Size="12px" />
                        <Columns>
                              <asp:BoundField DataField="id" HeaderText="序号" ReadOnly="True" />
                <asp:TemplateField HeaderText="公告标题" ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                            CommandName="Select" Text='<%# Bind("noticetitle") %>'></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="department" HeaderText="查阅所属机构" ReadOnly="True" />
                <asp:BoundField DataField="noticedate" HeaderText="发布时间" ReadOnly="True" />
                <asp:BoundField DataField="noticemanages" HeaderText="发布人" ReadOnly="True" />

                        </Columns>
            <HeaderStyle BorderWidth="1px" CssClass="gvhead" Font-Size="14px" />
        </asp:GridView>
    </td>
  </tr>
        <tr><td  >
          <table cellpadding="0" cellspacing="0" style ="width :100%">
              <tr>
                  <td style =" padding-left :5px; padding-top :5px; text-align :left  ">
                         </td>
                  <td  id ="allowpage" runat ="server" style ="text-align :right ;  padding-right  :5px"> &nbsp;</td>
              </tr>
          </table>
          </td></tr>
</table>
</div> 
<!-- 一组内容模块结束 --> 


<!--  一组内容模块开始   --> 
<div  id="table_NoticeView" runat ="server"  visible ="false" >

<table style ="width :100%; " border="0"  cellpadding="0" cellspacing="0" class="ziti04">

                <tr>
                    <td  colspan="4" style="font-weight:bolder; height :10px"></td>
                </tr>
            </table>
<table width="960" border="0" cellpadding="0" cellspacing="1">
  

  <tr>
    <td  >
    <table  style =" width :100%"    border = "0"  cellpadding ="" cellspacing ="0">
                <tr>
                    <td style =" background-color :White " >
                    <div style = " font-size :large ; font-weight :bold ; text-align :center;width :100%; ; padding :20px 5px 5px 5px  " id = "viewbiaoti" runat ="server" ></div>
                    <div id ="viewneirong" runat ="server"  style ="width :100%; padding :5px 5px 5px 5px"  ></div>
</td>
                </tr>
                <tr>
                    <td  style =" padding :20px 5px 5px 5px; text-align :left " >
                        <asp:Label ID="lbFujian" runat="server" Text="附件："></asp:Label>
                      
                       <asp:BulletedList 
                            ID="BulletedList1" runat="server" DisplayMode="LinkButton" 
                            onclick="BulletedList1_Click">

                        </asp:BulletedList>
                      <div style =" text-align :right ">                         发 布 人:<asp:Label ID="lbNoticemanages" runat="server"></asp:Label>
                        &nbsp;   &nbsp; 
                        发布时间：<asp:Label ID="lbNoticedate" runat="server"></asp:Label>   &nbsp;   &nbsp; 
                        查阅所属机构：
                        <asp:Label ID="lbDepartment" runat="server"></asp:Label></div> 
                    </td>
                </tr>
                <tr>
                     <td style =" text-align :center; padding:20px 20px 20px 20px " >
                        <asp:Button ID="btBack" runat="server" onclick="btBack_Click" Text="返回" />
                    </td>
                </tr>
            </table>
    </td>
  </tr>

</table>

</div>
<!-- 一组内容模块结束 -->  


</div>


</div>
<div id="footer-a" style ="height :20px ;font-size:12px">  <uc1:foot id="foot1" runat="server" /></div>
    </form>
    <script type="text/javascript">

        var dialogInstace, onMoveStartId, mousePos = { x: 0, y: 0 };	//	用于记录当前可拖拽的对象

        // var zIndex = 9000;

        //	获取元素对象	
        function g(id) { return document.getElementById(id); }

        //	自动居中元素（el = Element）
        function autoCenter(el) {
            var bodyW = document.documentElement.clientWidth;
            var bodyH = document.documentElement.clientHeight;

            var elW = el.offsetWidth;
            var elH = el.offsetHeight;

            el.style.left = (bodyW - elW) / 2 + 'px';
            el.style.top = (bodyH - elH) / 2 + 'px';

        }

        //	自动扩展元素到全部显示区域
        function fillToBody(el) {
            el.style.width = document.documentElement.clientWidth + 'px';
            el.style.height = document.documentElement.clientHeight + 'px';
        }

        //	Dialog实例化的方法
        function Dialog(dragId, moveId) {

            var instace = {};

            instace.dragElement = g(dragId);	//	允许执行 拖拽操作 的元素
            instace.moveElement = g(moveId);	//	拖拽操作时，移动的元素

            instace.mouseOffsetLeft = 0;			//	拖拽操作时，移动元素的起始 X 点
            instace.mouseOffsetTop = 0;			//	拖拽操作时，移动元素的起始 Y 点

            instace.dragElement.addEventListener('mousedown', function (e) {

                var e = e || window.event;

                dialogInstace = instace;
                instace.mouseOffsetLeft = e.pageX - instace.moveElement.offsetLeft;
                instace.mouseOffsetTop = e.pageY - instace.moveElement.offsetTop;

                onMoveStartId = setInterval(onMoveStart, 10);
                return false;
                // instace.moveElement.style.zIndex = zIndex ++;
            })

            return instace;
        }

        //	在页面中侦听 鼠标弹起事件
        document.onmouseup = function (e) {
            dialogInstace = false;
            clearInterval(onMoveStartId);
        }
        document.onmousemove = function (e) {
            var e = window.event || e;
            mousePos.x = e.clientX;
            mousePos.y = e.clientY;


            e.stopPropagation && e.stopPropagation();
            e.cancelBubble = true;
            e = this.originalEvent;
            e && (e.preventDefault ? e.preventDefault() : e.returnValue = false);

            document.body.style.MozUserSelect = 'none';
        }

        function onMoveStart() {


            var instace = dialogInstace;
            if (instace) {

                var maxX = document.documentElement.clientWidth - instace.moveElement.offsetWidth;
                var maxY = document.documentElement.clientHeight - instace.moveElement.offsetHeight;

                instace.moveElement.style.left = Math.min(Math.max((mousePos.x - instace.mouseOffsetLeft), 0), maxX) + "px";
                instace.moveElement.style.top = Math.min(Math.max((mousePos.y - instace.mouseOffsetTop), 0), maxY) + "px";

            }

        }





        //	重新调整对话框的位置和遮罩，并且展现
        function showDialog() {
            g('dialogMove').style.display = 'block';
            g('mask').style.display = 'block';
            autoCenter(g('dialogMove'));
            fillToBody(g('mask'));
        }

        //	关闭对话框
        function hideDialog() {
            g('dialogMove').style.display = 'none';
            g('mask').style.display = 'none';
        }

        //	侦听浏览器窗口大小变化
        window.onresize = showDialog;

        Dialog('dialogDrag', 'dialogMove');
        //showDialog();

</script>
</body>
</html>


<script type="text/javascript">  
    function cal() {
        var t1 = document.getElementById("<%=tbPassword_lan.ClientID%>").value;
        if (t1.trim().length > 5) {
            var hash = hex_md5(t1);
            var tbcolor = document.getElementById('tbPassword_lan').style.color;
            switch (tbcolor) {
                case 'red':
                    hash = hash + '1';
                    break;
                case 'orange':
                    hash = hash + '2';
                    break;
                case 'blue':
                    hash = hash + '3';
                    break;
                case 'green':
                    hash = hash + '4';
                    break;
            }
            document.getElementById("<%=tbPassword_lan.ClientID%>").value = hash;
        }
        else {
            if (document.getElementById("<%=tbUserName_lan.ClientID%>").value != "")
            alert("请输入正确的密码");
        }
    }
</script>  
<script type="text/javascript">  
    function c() {
        document.getElementById("<%=tbPassword_lan.ClientID%>").value = "";
    }
</script>  

