﻿/*网站浏览量统计AJAX方法开始*/
/* Create By LiangGuo 2009-11-05*/
var xmlHttp;

function createXMLHttpRequest() {

    if (window.ActiveXObject) {

        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

    }

    else if (window.XMLHttpRequest) {

        xmlHttp = new XMLHttpRequest();

    }

}
function refreshSpanVisits(flag) {

    var url = "http://"+location.host+"/CNEA/Visits/Visits.aspx?flag="+flag;

    createXMLHttpRequest();

    xmlHttp.onreadystatechange = handleStateChange;

    xmlHttp.open("GET", url, true);

    xmlHttp.send(null);
    
    //document.getElementById("spanVisits").innerText = 1064870;


}

function handleStateChange() {

    if(xmlHttp.readyState == 4) {

        if(xmlHttp.status == 200) {

            updateSpanVisits();

        }

    }

}


function updateSpanVisits() {

    clearSpanVisits();

    var result = xmlHttp.responseText;

    document.getElementById("spanVisits").innerText = result;

}

function clearSpanVisits() {

    document.getElementById("spanVisits").innerText = "";
}
/*网站浏览量统计AJAX方法结束*/



function loadSubNavHtml(id) 
{
    var xmlHttp1;
    if (window.ActiveXObject) {

        xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");

    }

    else if (window.XMLHttpRequest) {

        xmlHttp1 = new XMLHttpRequest();

    }
    var url = "http://"+location.host+"/Templets/MainNav.html";
    var element = document.getElementById(id);
    if (!element) 
    {
        alert("无法找到id " + id + "。" +"你的网页中必须有一个含有这个id的div 或 span 标签。");
        return;
    }

    // 同步请求，等待收到全部内容
    xmlHttp1.open('GET', url, false);
    xmlHttp1.send(null);
    element.innerHTML = xmlHttp1.responseText;
}

function loadTopHtml(id) 
{
    var xmlHttp1;
    if (window.ActiveXObject) {

        xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");

    }

    else if (window.XMLHttpRequest) {

        xmlHttp1 = new XMLHttpRequest();

    }
    var url = "http://"+location.host+"/Templets/Top.html";
    var element = document.getElementById(id);
    if (!element) 
    {
        alert("无法找到id " + id + "。" +"你的网页中必须有一个含有这个id的div 或 span 标签。");
        return;
    }

    // 同步请求，等待收到全部内容
    xmlHttp1.open('GET', url, false);
    xmlHttp1.send(null);
    element.innerHTML = xmlHttp1.responseText;
}






