/*
    名称：Ajax
    编写：GeSen
    时间：06-06-06
    功能：利用异步xml来实现无刷新更新数据。
*/

// 生成Ajax对象
var xmlHttp = getHttpObject();
// 处理请求的页面
var pageUrl = "/Common/AjaxData.aspx";

function getHttpObject()
{
    var xmlHttp = false;
    if(window.xmlHttpRequest)
    {   
        xmlHttp = new xmlHttpRequest();   
        if(xmlHttp.overrideMimeType)
        {    
            xmlHttp.overrideMimeType('text/xml');   
        }  
    }  
    else
    {   
        try
        {    
            xmlHttp = new ActiveXObject("Msxml2.xmlHttp");   
        }
        catch(e)
        {    
            try
            {
                xmlHttp = new ActiveXObject("Microsoft.xmlHttp");
            }
            catch(e)
            {
                xmlHttp = false;    
            }   
        }
    }  
    return xmlHttp;
}

////////////////////////////
function sendAjax(queryString, fun)
{
    xmlHttp.open("post", pageUrl + queryString, true);
    xmlHttp.send(null);
    //xmlHttp.onReadyStateChange = fun;
}
function sendAjaxByBigData(formString, fun)
{
    xmlHttp.open("post", pageUrl, true);
    xmlHttp.setRequestHeader("content-length", formString.length);
    xmlHttp.setRequestHeader("content-type","application/x-www-form-urlEncoded");
    xmlHttp.send(formString);
    xmlHttp.onReadyStateChange = fun;
}
function sendAjaxWithXml(queryString, fun)
{
    
    xmlHttp.open("post", pageUrl + queryString, true);
    xmlHttp.send(null);
    xmlHttp.onReadyStateChange = fun;
}
function sendAjaxByBigDataWithXml(formString, fun)
{
    xmlHttp.open("post", pageUrl, true);
    xmlHttp.setRequestHeader("content-length", formString.length);
    xmlHttp.setRequestHeader("content-type","application/x-www-form-urlEncoded");
    xmlHttp.send(formString);
    xmlHttp.onReadyStateChange = fun;
}

// 下载计数
function calcDownCount()
{
	sendAjax("?type=calcDownCount", null);
}






































































































