XmlHttpRequest = {
	getInstance: function() {
		var instance = false;
		if (typeof XMLHttpRequest != "undefined") {
			instance = new XMLHttpRequest();
		}		
		if (!instance) {		
			try {
				instance = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				try {
					instance = new ActiveXObject("Microsoft.XMLHTTP");
				} catch(e) {
					instance = false;
				}
			}		
		}	
		return instance;
	}
}

var bison = new Bison();

function calculate() {
	var obj = {
		a: document.getElementById("box1").value,
		b: document.getElementById("box2").value
	}
	var bisonStr = bison.serialize(obj);
	var xmlHttp = XmlHttpRequest.getInstance();
	xmlHttp.open("POST", "./bisonserver.php", true);
	xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState == 4) {
			var result = bison.deserialize(xmlHttp.responseText);
			document.getElementById("box3").value = result;
		}
	}
	xmlHttp.send(bisonStr);	
}
