var xmlHttp
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function tilfoejafstemning()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="addpoll.php";
url=url+"?sid="+Math.random();
url=url+"&spm="+document.poll.spm.value+"&valg1="+document.poll.valg1.value+"&valg2="+document.poll.valg2.value+"&valg3="+document.poll.valg3.value+"&valg4="+document.poll.valg4.value;
xmlHttp.onreadystatechange=pollch;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 
function pollch() 
{ 
   if (xmlHttp.readyState==4)
   { 
      document.getElementById("addpoll").innerHTML=xmlHttp.responseText;
   }
   else
   {
       document.GetElementById("addpoll").innerHTML="Loading...";
   }

}
///////////////////
function stem(stemme)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="addvote.php";
url=url+"?sid="+Math.random();
url=url+"&valget="+stemme+"&ip="+document.voteform.ip.value+"&id="+document.voteform.voteid.value;
xmlHttp.onreadystatechange=votech;
xmlHttp.open("GET",url,true);
xmlHttp.setRequestHeader( 'Accept-Charset', 'iso-8859-1'); 
xmlHttp.setRequestHeader( 'Accept-Language', 'da'); 
xmlHttp.send(null);
} 
function votech() 
{ 
   if (xmlHttp.readyState==4)
   { 
      document.getElementById("votepoll").innerHTML=xmlHttp.responseText;
   }
   else
   {
       document.GetElementById("votepoll").innerHTML="Loading...";
   }

}
function setStem(vote) 
{ 
      document.getElementById("stemknap").innerHTML="<span onclick='stem("+vote+")'><img src='stem.jpg'></span>";
}