// JavaScript Document

function getxmlhttp() {
	var xmlhttp = false;
	
	try {
		xmlhttp = new ActiveXOject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}	catch (E) {
			xmlhttp = false;
		}
	}

	if(!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	
	return xmlhttp;
}

function ajaxGet(serverPage, obj, goal) {
	xmlhttp = new getxmlhttp();
	
	xmlhttp.open("GET", serverPage);
	xmlhttp.onreadystatechange = function() {
		//alert(xmlhttp.readyState);
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			//alert(xmlhttp.responseText);
			if(goal == 1) {
				obj.value = xmlhttp.responseText;
			}
			else {
				obj.style.display = "block";
				obj.innerHTML = xmlhttp.responseText;
			}
		}
	}
	xmlhttp.send(null);
}

function ajaxPost(serverPage, obj, str) {
	xmlhttp = new getxmlhttp();
	
	xmlhttp.open("POST", serverPage, true);
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
	xmlhttp.onreadystatechange = function() {
		//alert(xmlhttp.readyState);
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.style.display = "block";
			obj.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(str);
}