﻿var xmlHttp;
var returnValue;

function doajax(url)
{
    var xh;
    if (window.ActiveXObject) // code for IE 
    {
       xh = new ActiveXObject("MSXML2.XMLHTTP");
       xh.open("POST",url,false);
       xh.send(null);
    }
    else if(window.XMLHttpRequest) //mf
    {
       xh=new XMLHttpRequest();
       xh.open("POST",url,false);
       xh.send(null);
    }
}

function doajaxstring(url)
{
//    var xh;
//    if (window.ActiveXObject) // code for IE 
//    {
//       xh = new ActiveXObject("MSXML2.XMLHTTP");
//       xh.open("POST",url,false);
//       xh.send(null);
//    }
//    else if(window.XMLHttpRequest) //mf
//    {
//       xh=new XMLHttpRequest();
//       xh.open("POST",url,false);
//       xh.send(null);
//    }
//	if(xh.readyState == 4 && xh.status == 200)
//	{ 
//		return xh.responseText;
//	}
//	else
//	{
//		return "加载失败";
//	}

if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) { }
}
}
xmlHttp.onreadystatechange = GetData;
xmlHttp.open("POST", url, false);
xmlHttp.send(null);
return returnValue;
}

function doajaxdata(url,data)
{
    var xh;
    if (window.ActiveXObject) // code for IE 
    {
       xh = new ActiveXObject("MSXML2.XMLHTTP");
       xh.open("POST",url,false);
       xh.send(data);
    }
    else if(window.XMLHttpRequest) //mf
    {
       xh=new XMLHttpRequest();
       xh.open("POST",url,false);
       xh.send(data);
    }
}

function doajaxdatastring(url,data)
{
    var xh;
    if (window.ActiveXObject) // code for IE 
    {
       xh = new ActiveXObject("MSXML2.XMLHTTP");
       xh.open("POST",url,false);
       xh.send(data);
    }
    else if(window.XMLHttpRequest) //mf
    {
       xh=new XMLHttpRequest();
       xh.open("POST",url,false);
       xh.send(data);
    }
    if(xh.readyState == 4 && xh.status == 200)
	{ 
		return xh.responseText;
	}
	else
	{
		return "加载失败";
	}
}

function GetData()
{
if (typeof (window.ActiveXObject) != 'undefined') {
//ie
try {
var res = xmlHttp.responseText;
returnValue = res;
} catch (e) { }
}
else if (document.implementation && document.implementation.createDocument) {
//ff
try {
returnValue  = xmlHttp.responseText;
} catch (e) { }
}
}