var xmlHttp;

function IndexAjax(cate,query_string,body_name){
	createxmlHttpRequest();

	var url = "AjaxIndex.php";
	var item = "cate="+cate+"&"+query_string+"&body_name="+body_name;

	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
	xmlHttp.onreadystatechange = callback;
	xmlHttp.send(item);
}

function createxmlHttpRequest(){
	if (xmlHttp){
		delete xmlHttp;
	}
	if (window.XMLHttpRequest){ 		// Firefox, Opera 8.0+, Mozilla, Safari,...
		xmlHttp = new XMLHttpRequest();
	} else if (window.ActiveXObject){	// IE
		try {
			xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
}

function callback(){
	if (xmlHttp.readyState == 4){
		if (xmlHttp.status == 200){
			var xmldoc = xmlHttp.responseXML;
			var mes = xmldoc.getElementsByTagName("message")[0].firstChild.data;
			var body_name = xmldoc.getElementsByTagName("bodyname")[0].firstChild.data;
			document.getElementById(body_name).innerHTML = mes;
		}
	}
}
