function switchOption(optie)
{
	document.pollform.keuze.value = optie;
	for(i=1;i<=3;i++)
	{
		currentId= "optie"+i;
		document.getElementById(currentId).src  = "layout/radio.gif";
	}
		document.getElementById("optie"+optie).src  = "layout/radio_.gif";		
}

function setCheck()
{

	if(document.pollform.nieuwsbrief.value ==0)
	{
		document.getElementById("checkmail").src  = "layout/checkbox_.gif";		
		document.pollform.nieuwsbrief.value = 1;
	}
	else
	{
		document.getElementById("checkmail").src  = "layout/checkbox.gif";		
		document.pollform.nieuwsbrief.value = 0;
	}
}

function checkVote()
{
	if(!document.pollform.pollemail.value.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/))
	{
		alert("Je hebt nog een geldig mail-adres ingevuld");
		document.pollform.pollemail.focus();
		return false;
	}
	else if(document.pollform.keuze.value == 0)
	{
		alert("Je hebt nog geen keuze gemaakt");
		return false;
	}
}

function showStats()
{
	document.getElementById('stats').style.display = 'block';
}

function nieuwsBrief(email){

  var xmlHttp;
  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }
  catch (e) {
    // Internet Explorer
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
      try {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e) {
        alert("Je browser gebruikt ondersteunt geen javascript");
        return false;
      }
    }
  }


  var rand = Math.round(100*Math.random());

  url = "email="+email+"&format=h&rand="+rand;
  xmlHttp.open("post", 'http://www.wakkerdier.nl/nieuwsbrief/form.php?form=3', true);
  xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  xmlHttp.send(url);
}