
function showPoll()
{
	http=ajaxInitiate();

	
	http.open("GET", "ajax/show_poll.php", true);

	http.onreadystatechange=function()
	{
		if(http.readyState == 4)
		{
			document.getElementById("SurveyDiv").innerHTML="";
			document.getElementById("SurveyDiv").innerHTML=http.responseText;;

		}
	}
	http.send(null);


}
function getPollResult()
{
	http=ajaxInitiate();

	var checkbox_choices = 0;
	var radios=document.getElementsByTagName('input');

	var selected_radio=0;
	
	for (counter = 0; counter < radios.length; counter++)
	{
		if(((radios[counter].type=="radio"))&&(radios[counter].checked))
		{
			if(radios[counter].value)
			{
				selected_radio=radios[counter].value;
			}
		}
	}


	var poll_id=document.getElementById("poll_id").value;


	var ip=document.getElementById("ip").value;

	if(selected_radio=='')
	{
		selected_radio=0;
	}

	http.open("GET", "ajax/get_poll_results.php?poll_id="+poll_id+"&ip="+ip+"&selected_radio="+selected_radio, true);

	http.onreadystatechange=function()
	{
		if(http.readyState == 4)
		{
			document.getElementById("Survey_Internal").innerHTML="";
			document.getElementById("Survey_Internal").innerHTML=http.responseText;;

		}
	}
	http.send(null);


}
function ajaxInitiate()
{
	var http = false;

	if(navigator.appName == "Microsoft Internet Explorer")
	{
		http = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		http = new XMLHttpRequest();
	}


	http.abort();

	return http;
}