function getRequestBody(oForm) {
	var aParams = new Array();
	
	for (var i=0; i < oForm.elements.length; i++) {
		var sParam = encodeURIComponent(oForm.elements[i].name);
		sParam += "=";
		sParam += encodeURIComponent(oForm.elements[i].value);
		aParams.push(sParam);
	}
	
	return aParams.join("&");
}

function sendRequest(oForm) {
	//var oForm = document.forms[0];
	var sBody = getRequestBody(oForm);

	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("post", oForm.action, true);
	oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4) {
			if (oXmlHttp.status == 200) {
				alert(oXmlHttp.responseText);
				if(oXmlHttp.responseText == "Login Successful.") {
					//alert('ok');
					window.location.reload();
				}
				//saveResult(oXmlHttp.responseText);
			} else {
				//saveResult("An error occurred: " + oXmlHttp.statusText);
				alert("An error occurred: " + oXmlHttp.statusText);
			}
		}            
	};
	oXmlHttp.send(sBody); 
}
