var xmlHttp1
var divIdName4
function PollResults(block,poll_id,option_id1)
{ 

if(option_id1==0)
{
	option_id=0;
}
else
{
var form = document.getElementById("form1");
  for ( var i = 0; i < form.length; i++ ) {
    if ( form[i].checked ){
       option_id= form[i].value;
       break;
    }
  }
}

divIdName4= block



xmlHttp1=GetXmlHttpObject1()
if (xmlHttp1==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url1="polling.php"
url1=url1+"?block="+block
url1=url1+"&poll_id="+poll_id
url1=url1+"&option_id="+option_id


url1=url1+"&sid1="+Math.random()
xmlHttp1.onreadystatechange=stateChanged1 
xmlHttp1.open("GET",url1,true)
xmlHttp1.send(null)
}

function stateChanged1() 
{ 
if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete")
 { 
 
 
 
 			if (divIdName4==1)
		{
			
			document.getElementById("showform").innerHTML=""
			
			
				longstring=xmlHttp1.responseText
  				brokenstring=longstring.split("---")
			
				   if (brokenstring[0]==1)
				   {
					  
						document.getElementById("showform").innerHTML=" "
				   }
				  		document.getElementById("showresults").innerHTML=brokenstring[1]

		}
		else if (divIdName4==2)
		{
		document.getElementById("showform").innerHTML=""
 		document.getElementById("showresults").innerHTML=xmlHttp1.responseText 
			
		}
		
 } 
}

function GetXmlHttpObject1()
{
var xmlHttp1=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp1=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp1=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp1=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp1;
}
