//创建AJAX
function initxmlhttp(){
	var xmlhttp;
	try{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(e){
			xmlhttp = false;
		}
	}
	if(!xmlhttp && typeof XMLHttpRequest != "undefined"){
		try{
			xmlhttp = new XMLHttpRequest();
		}catch(e){
			xmlhttp = false;
		}
	}
	if(!xmlhttp && window.createRequest){
		try{
			xmlhttp = new window.createRequest();
		}catch(e){
			xmlhttp = false;
		}
	}
	return xmlhttp;
}


//从文本文件中读取文件并且显示
function readText(url,parm){
	var showContent = document.getElementById(parm);
	var parmHTML = "正在读取……";
	var arg = arguments;
	if(arg){
		if(arg.length>2){
			parmHTML = arg[2];
		}
	}
	
	showContent.innerHTML = parmHTML;
	var xmlhttp = initxmlhttp();
	xmlhttp.open("GET",url,true);
	xmlhttp.onreadystatechange = function(){
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
			showContent.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}

//从文本文件中读取文件但不显示
function readOnly(url){
	var xmlhttp = initxmlhttp();
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
