function GetXmlHttpObject (handler) {

	var objXmlHttp = null;
	
	if (navigator.userAgent.indexOf("MSIE") >= 0) {
		
		var strName="Msxml2.XMLHTTP";
		
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0) {
			strName="Microsoft.XMLHTTP";
		}
		
		try {
			objXmlHttp = new ActiveXObject(strName);
			objXmlHttp.onreadystatechange = handler;
			return objXmlHttp;
		} catch(e) {
			alert("Error. Scripting for ActiveX might be disabled");
			return;
		}
		
	}
	
	if (navigator.userAgent.indexOf("Mozilla") >= 0) {
		objXmlHttp = new XMLHttpRequest();
		objXmlHttp.onload = handler;
		objXmlHttp.onerror = handler;
		return objXmlHttp;
	}
	
}


function PostVote (iPollID, iAnswerID) {

	var POSTurl = "/_build/_widgets/_poll/_post_vote.asp?p="  + iPollID + "&a=" + iAnswerID;
	xmlHttpPOSTVOTE = GetXmlHttpObject(DisplayPollResults);
	xmlHttpPOSTVOTE.open("GET", POSTurl , true);
	xmlHttpPOSTVOTE.send(null);
	
}


function DisplayPollResults () {

	if (xmlHttpPOSTVOTE.readyState==4 || xmlHttpPOSTVOTE.readyState=="complete") {
		document.getElementById('PollResults').innerHTML = xmlHttpPOSTVOTE.responseText;
	} else if (xmlHttpPOSTVOTE.readyState==1 || xmlHttpPOSTVOTE.readyState=="loading") {
		document.getElementById('PollResults').innerHTML = "<br /><div align='center' class='text_widget_poll_answer'>Posting Vote<br /><img src='/_images/_template/poll_loading.gif' /></div>";
	}
	
}