﻿        //用户登录
        var popupStatus3 = 0;
        function CenterPopup3() {
            var windowWidth = document.documentElement.clientWidth;
            var windowHeight = document.documentElement.clientHeight;
            var popuHeight = $("#MediaContentFloat3").height();
            var popuWidth = $("#MediaContentFloat3").width();
            $("#MediaContentFloat3").css({
                "position": "absolute",
                "top": windowHeight / 2 - popuHeight / 2,
                "left": windowWidth / 2 - popuWidth / 2
            });
            //针对IE6.0进行设置
            $("#backGroundPopup").css({
                "height": windowHeight
            });
        }
        function LoadPopup3() {
            if (popupStatus3 == 0) {
                $("#backGroundPopup").css({
                    "opacity": "0.6"
                });
                $("#MediaContentFloat3").fadeIn("slow");
                $("#backGroundPopup").fadeIn("slow");
                popupStatus3 = 1;
            }
        }

        function disablePopup3() {
            if (popupStatus3 == 1) {
                $("#MediaContentFloat3").fadeOut("slow")
                $("#backGroundPopup").fadeOut("slow")
                popupStatus3 = 0;
            }
        }
        $(document).ready(function() {
            $.ajax({
                url: 'indexTool/CheackLogin.ashx',
                type: 'post',
                timeout: 2000,
                success: function(html) {
                if (html == '1') {
                    $("#loginF").hide();
                    $("#loginL").show();
                    }
                    else {
                    }
                }
            });
            $("#loginButton").click(function() {
                CenterPopup3();
                LoadPopup3();
            });
            $("#closeImg3").click(function() {
                disablePopup3();
            });

            $("#backGroundPopup").click(function() {
                disablePopup3();
            });
            $("#loginSbutton").click(function() {
                var urls = "/indexTool/userlogin.ashx?id=" + $("#username").val() + "&pwd=" + $("#userpwd").val();

                $.ajax({
                    url: urls,
                    type: 'post',
                    timeout: 2000,
                    success: function(html) {
                        if (html == '1') {
                            disablePopup3();
                            $("#loginF").hide();
                            $("#loginL").show();
                        }
                        else {
                            alert('登录失败');
                        }
                    }
                });

            });
            $("#LoginOutB").click(function() {
                $.get('indexTool/LoingOut.ashx');
                $("#loginF").show();
                $("#loginL").hide();
            });
            $(document).keypress(function(e) {
                if (e.keyCode == 27 && popupStatus3 == 1) {
                    disablePopup3();
                }
            });
        });

