﻿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") {
                if(document.getElementById("UserHasLogin")!=null){
                document.getElementById("UserHasLogin").style.display = 'none';
                }
                var btnwszl =document.getElementById("btnwszl")
                if(btnwszl != null){
                    btnwszl.innerHTML="<img src='/images/jdjsNew/List_about.gif' width='120' height='34' border='0' onclick='javascript:alert(\"您还没有登录，请登录\")'> "
                }
                 //头部的登录信息
                if(document.getElementById("HeadUserHasLoginWord")!=null && document.getElementById("headnotLogin")!=null) {
                    document.getElementById("HeadUserHasLoginWord").style.display = 'none';
                    document.getElementById("headnotLogin").style.display = 'block';    
                }
                         
            } else {
            
                //document.getElementById("UserNotLogin").style.display = 'none';
                if(document.getElementById("UserHasLoginWord")!=null){
                document.getElementById("UserHasLoginWord").innerHTML = "欢迎：" + xmlHttp5.responseText.split("||")[0] + " 留言   <a href='javascript:LoginOut()'>退出</a>";
                }
                if(document.getElementById("UserHasLogin")!=null){
                document.getElementById("UserHasLogin").style.display = 'block';
                }
                if(document.getElementById("txtLoginName")!=null){
                document.getElementById("txtLoginName").value = "";
                }
                if(document.getElementById("txtLoginPwd")!=null){
                document.getElementById("txtLoginPwd").value = "";
                }
                if(document .getElementById ("login11")!=null)
                {
                    document .getElementById ("login11").style .display ="none"
                }
                 if(document .getElementById ("login22")!=null)
                {
                    document .getElementById ("login22").style .display ="none"
                }
                if(document .getElementById ("login33")!=null)
                {
                    document .getElementById ("login33").style .display ="none"
                }
                if(document .getElementById ("login44")!=null)
                {
                    document .getElementById ("login44").style .display ="none"
                }
                if(document .getElementById ("login55")!=null)
                {
                    document .getElementById ("login55").style .display ="none"
                }
                if(document .getElementById ("tableniMing")!=null)
                {
                    document .getElementById ("tableniMing").style .display ="none"
                }
               
                //头部的登录信息
                if(document.getElementById("HeadUserHasLoginWord")!=null && document.getElementById("headnotLogin")!=null) {
                    document.getElementById("HeadUserHasLoginWord").innerHTML= "<div style ='text-align :left'>&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>】</div>";
                    document.getElementById("headnotLogin").style.display = 'none';    
                }

                var btnwszl =document.getElementById("btnwszl")
                if(btnwszl != null){
                    tempurl="http://sb.nbtravel.gov.cn/ScenicFileUpload.aspx?Url="+location.href+"&UID="+xmlHttp5.responseText.split("||")[1]
                   
                    btnwszl.innerHTML="<img src='/images/jdjsNew/List_about.gif' width='120' height='34' border='0' onclick=wszl('"+tempurl+"')> "
                }                
            }
        }
        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;
}




