var sAX="MSXML2.XMLHTTP.6.0 MSXML2.XMLHTTP.3.0 Msxml2.XMLHTTP Microsoft.XMLHTTP";
(function(){var x=window.XMLHttpRequest;if(!x){var o=s=null,a=sAX.split(" ");for(var i=0,j=a.length;i<j;s=a[i],i++){try{if(o=new ActiveXObject(s))break}catch(e){}}}window.XMLHttpRequest=x?x:o?function(){return new ActiveXObject(s)}:null;o=null;sAX=undefined})();
function gE(id,D){return (D?D:document).getElementById(id)};
function gAt(o,tN){return o.getElementsByTagName(tN)};
function sE(o,t,f){if(o.addEventListener)o.addEventListener(t,f,false);else if(o.attachEvent)o.attachEvent("on"+t,function(){f.apply(o)});else if(typeof o["on"+t]=="function"){var x=o["on"+t];o["on"+t]=function(){x.apply(o,arguments);f.apply(o,arguments)};}else o["on"+t]=f};

var oDispl = oHead = aLines = oHttp = null;

function reqCallback() {
	var oResp = null;
	if (oHttp.readyState==4) {
		//return alert(oHttp.responseText)
		eval("oResp = " + oHttp.responseText);
		oHead.firstChild.nodeValue = oResp.head;
		for (var i=0; i<5; i++) {
			aLines[i].firstChild.nodeValue = oResp.lines[i];
		}
		oDispl.style.visibility = "visible";
		oResp = null;
		oHttp = null;
	}
}
function showQuote() {
	if (oHttp) return;
	oDispl.style.visibility = "hidden";
	oHttp = new XMLHttpRequest();
	oHttp.open("POST", "response.php", true);
	oHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
	oHttp.onreadystatechange = reqCallback;
	oHttp.send("contxt=getNewQuote");
}

function init() {
	oDispl = gE("quote");
	oHead = gAt(oDispl, "h3")[0];
	aLines = gAt(oDispl, "div");
}
sE(window, "load", init);