﻿var xmlHttp5
function ValidationUserLoginWhenOnLoad() {

    xmlHttp5 = GetXmlHttpObject5();
    if (xmlHttp5 == null) {
        alert("您的浏览器不支持AJAX！");
        return;
    }


    var url = "/Ajax/ValidationUserLoginWhenOnLoad.aspx";
    url = url + "?sid=" + Math.random();

    xmlHttp5.onreadystatechange = stateChanged5;
    xmlHttp5.open("GET", url, true);
    xmlHttp5.send(null);
}

function stateChanged5() {

    if (xmlHttp5.readyState == 4) {

        if (xmlHttp5.status == 200) {
          
            if (xmlHttp5.responseText == "False") {
                
               // document.getElementById("UserHasLogin").style.display = 'none';
                
                 //头部的登录信息
                if(document.getElementById("HeadUserHasLoginWord")!=null && document.getElementById("headnotLogin")!=null) {
                    document.getElementById("HeadUserHasLoginWord").style.display = 'none';
                    document.getElementById("headnotLogin").style.display = 'block';    
                }
                         
            } else {
            
               
                //头部的登录信息
                if(document.getElementById("HeadUserHasLoginWord")!=null && document.getElementById("headnotLogin")!=null) {
                    document.getElementById("HeadUserHasLoginWord").innerHTML= "&nbsp;&nbsp;当前在线用户：" + xmlHttp5.responseText.split("||")[0] + "&nbsp;&nbsp; ◎<a href='http://nboa.nbtravel.gov.cn/' target='_blank'>个人信息管理</a> &nbsp;&nbsp; ◎<a href='http://nboa.nbtravel.gov.cn/Personal/QzzpEdit.aspx' target='_blank'>求职招聘</a>  &nbsp;&nbsp;    &nbsp;&nbsp;  【<a href='javascript:LoginOut()'>退出</a>】";
                    document.getElementById("headnotLogin").style.display = 'none';    
                }
                      
            }
        }
        else {
            alert("HTTP 验证错误，状态码：" + xmlHttp5.status);
        }
    }
}

function GetXmlHttpObject5() {
    var xmlHttp5 = null;
    try {
        // Firefox, Opera 8.0+, Safari
        xmlHttp5 = new XMLHttpRequest();
    }
    catch (e) {
        // Internet Explorer
        try {
            xmlHttp5 = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            xmlHttp5 = new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return xmlHttp5;
}




