
function Ajax_GetXMLHttpRequest() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else {
		if (window.Ajax_XMLHttpRequestProgID) {
			return new ActiveXObject(window.Ajax_XMLHttpRequestProgID);
		} else {
			var progIDs = ["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
			for (var i = 0; i < progIDs.length; ++i) {
				var progID = progIDs[i];
				try {
					var x = new ActiveXObject(progID);
					window.Ajax_XMLHttpRequestProgID = progID;
					return x;
				} catch (e) {
				}
			}
		}
	}
	return null;
}

function Ajax_CallBack(url, type, id, method, args, clientCallBack, clientCallBackArg, debugRequestText, debugResponseText, debugErrors, includeControlValuesWithCallBack, updatePageAfterCallBack) {
	var x = Ajax_GetXMLHttpRequest();
	var result = null;
	if (!x) {
		result = { "value":null, "error":"NOXMLHTTP" };
		if (debugErrors) {
			alert("error: " + result.error);
		}
		if (clientCallBack) {
			clientCallBack(result, clientCallBackArg);
		}
		return result;
	}
	x.open("POST", url ? url : Ajax_DefaultURL, clientCallBack ? true : false);
	x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
	if (clientCallBack) {
		x.onreadystatechange = function() {
			if (x.readyState != 4) {
				return;
			}
			if (debugResponseText) {
				alert(x.responseText);
			}
			result = Ajax_GetResult(x);
			if (debugErrors && result.error) {
				alert("error: " + result.error);
			}
			if (updatePageAfterCallBack) {
				Ajax_UpdatePage(result);
			}
			clientCallBack(result, clientCallBackArg);
			delete x.onreadystatechange;
			x = null;
		}
	}
	var encodedData = "Ajax_CallBackType=" + type;
	if (id) {
		encodedData += "&Ajax_CallBackID=" + id.split(":").join("_");
	}
	encodedData += "&Ajax_CallBackMethod=" + method;
	if (args) {
		for (var argsIndex = 0; argsIndex < args.length; ++argsIndex) {
			if (args[argsIndex] instanceof Array) {
				for (var i = 0; i < args[argsIndex].length; ++i) {
					encodedData += "&Ajax_CallBackArgument" + argsIndex + "=" + encodeURIComponent(args[argsIndex][i]);
				}
			} else {
				encodedData += "&Ajax_CallBackArgument" + argsIndex + "=" + encodeURIComponent(args[argsIndex]);
			}
		}
	}
	if (updatePageAfterCallBack) {
		encodedData += "&Ajax_UpdatePage=true";
	}
	if (includeControlValuesWithCallBack && document.forms.length > 0) {
		var form = document.getElementById(Ajax_FormID);
		for (var elementIndex = 0; elementIndex < form.length; ++elementIndex) {
			var element = form.elements[elementIndex];
			if (element.name) {
				var elementValue = null;
				if (element.nodeName == "INPUT") {
					var inputType = "TEXT";
					if (element.getAttribute("TYPE"))
						inputType = element.getAttribute("TYPE").toUpperCase();
					if (inputType == "TEXT" || inputType == "PASSWORD" || inputType == "HIDDEN") {
						elementValue = element.value;
					} else if (inputType == "CHECKBOX" || inputType == "RADIO") {
						if (element.checked) {
							elementValue = element.value;
						}
					}
				} else if (element.nodeName == "SELECT") {
					if (element.multiple) {
						elementValue = [];
						for (var i = 0; i < element.length; ++i) {
							if (element.options[i].selected) {
								elementValue.push(element.options[i].value);
							}
						}
					} else {
						elementValue = element.value;
					}
				} else if (element.nodeName == "TEXTAREA") {
					elementValue = element.value;
				}
				if (elementValue instanceof Array) {
					for (var i = 0; i < elementValue.length; ++i) {
						encodedData += "&" + element.name + "=" + encodeURIComponent(elementValue[i]);
					}
				} else if (elementValue) {
					encodedData += "&" + element.name + "=" + encodeURIComponent(elementValue);
				}
				elementValue = null;
			}
		}
		if (typeof form.__VIEWSTATE == "undefined" || form.__VIEWSTATE.value.length == 0) {
			encodedData += "&__VIEWSTATE=";
		}
		if (typeof form.__EVENTTARGET == "undefined" || form.__EVENTTARGET.value.length == 0) {			
			encodedData += "&__EVENTTARGET=";
		}
	}
	if (debugRequestText) {
		alert(encodedData.split("&").join("\n&"));
	}
	x.send(encodedData);
	if (!clientCallBack) {
		if (debugResponseText) {
			alert(x.responseText);
		}
		result = Ajax_GetResult(x);
		if (debugErrors && result.error) {
			alert("error: " + result.error);
		}
		if (updatePageAfterCallBack) {
			Ajax_UpdatePage(result);
		}
	}
	delete x;
	return result;
}

function Ajax_GetResult(x) {
	var result = { "value": null, "error": "BADRESPONSE"};
	try {
		result = eval("(" + x.responseText + ")");
	} catch (e) {
		alert("error evaluating response text:\n" + x.responseText);
	}
	return result;
}

function Ajax_FireEvent(eventTarget, clientCallBack, clientCallBackArg, includeControlValuesWithCallBack, updatePageAfterCallBack) {
	var form = document.getElementById(Ajax_FormID);
	var eventTargetControl = null;
	if (form.__EVENTTARGET) {
		var input = form.__EVENTTARGET;
		input.value = eventTarget;
	} else {
		var input = document.createElement("input");
		input.setAttribute("name", "__EVENTTARGET");
		input.setAttribute("type", "hidden");
		input.setAttribute("value", eventTarget);
		form.appendChild(input);
		form.__EVENTTARGET = input;
	}
	Ajax_CallBack(null, "Ajax.Manager", null, "FireEvent", [], clientCallBack, clientCallBackArg, false, false, false, includeControlValuesWithCallBack, updatePageAfterCallBack);
	form.__EVENTTARGET.value = "";
}

function Ajax_UpdatePage(result) {
	if (result.viewState) {
		var form = document.getElementById(Ajax_FormID);
		form.__VIEWSTATE.value = result.viewState;
	}
	if (result.controls) {
		for (var id in result.controls) {
			var control = document.getElementById("__" + id + "__");
			if (control) {
				control.innerHTML = result.controls[id];
			}
		}
	}
}

var ASP = {
"default_aspx": {

"DeleteArticleComment": function(commentid, clientCallBack, clientCallBackArg) {
	return Ajax_CallBack(null, 'ASP.default_aspx', null, 'DeleteArticleComment', [commentid], clientCallBack, clientCallBackArg, false, false, false, true, true);
},

"ApproveArticleComment": function(commentid, clientCallBack, clientCallBackArg) {
	return Ajax_CallBack(null, 'ASP.default_aspx', null, 'ApproveArticleComment', [commentid], clientCallBack, clientCallBackArg, false, false, false, true, true);
}

}};
