
var ajaxLoadTxt	=	"";
ajaxLoadTxt	+=	"<table width=\"100%\" height=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
ajaxLoadTxt	+=	"<tr>";
ajaxLoadTxt	+=	"<td class=\"center dotum11 orange\">";
ajaxLoadTxt	+=	"<img src=\"/Images/default/ajax_waiting.gif\">";
ajaxLoadTxt	+=	"</td>";
ajaxLoadTxt	+=	"</tr>";
ajaxLoadTxt	+=	"</table>";

function aChimAjax(target, url, str, isload, loading) {
	if(isload && (!loading || loading == "")) document.getElementById(target).innerHTML		=	ajaxLoadTxt;
	else if(isload && loading != "") document.getElementById(target).innerHTML				=	loading;
	link = url + '.php?target=' + target + '&' + str;
	query = '';
	this.link	=	link;
	this.query	=	query;
	this.target	=	target;
	setTimeout("sendAjaxRequest(link, query, target)", 300);
	//sendAjaxRequest(link, query, target);
}

function sendAjaxRequest(link, query, target) {
	var req = newXMLHttpRequest();
	var handlerFunction = getReadyStateHandler(req, target);
	req.onreadystatechange = handlerFunction;
	req.open("POST", link, true);
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	req.send("q="+query);
}

function newXMLHttpRequest() {
	var xmlreq = false;
	if (window.XMLHttpRequest) {
		xmlreq = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		try {
			xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			window.alert("Failed to create required ActiveXObject");
			try {
				xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				window.alert("Unable to create an XMLHttpRequest with ActiveX");
			}
		}
	}
	return xmlreq;
}
function getReadyStateHandler(req, target) {
	return function () {
		switch (req.readyState) {
		case 0 :
		case 1 :
		case 2 :
		case 3 :
		break;
		case 4 :
			if(req.status == 200) {
				printData(req, target);
			}
			else {
				//alert("HTTP error: "+req.status);
			}
		break;
		}
	}
}

function printData(req, target){
	document.getElementById(target).innerHTML = req.responseText;
}
