	var ContentHeight = 180;
	var TimeToSlide = 250.0;

	var openAccordion = '';

	function runAccordion(index)
	{
	  var nID = "News" + index + "Content";
	  if(openAccordion == nID)
		nID = '';
		
	  setTimeout("animate(" + new Date().getTime() + "," + TimeToSlide + ",'" 
		  + openAccordion + "','" + nID + "')", 33);
	  
	  openAccordion = nID;
	}
	
	function animate(lastTick, timeLeft, closingId, openingId)
	{  
	  var curTick = new Date().getTime();
	  var elapsedTicks = curTick - lastTick;
	  
	  var opening = (openingId == '') ? null : document.getElementById(openingId);
	  var closing = (closingId == '') ? null : document.getElementById(closingId);
	 
	  if(timeLeft <= elapsedTicks)
	  {
		if(opening != null)
		  opening.style.height = ContentHeight + 'px';
		
		if(closing != null)
		{
		  closing.style.display = 'none';
		  closing.style.height = '0px';
		}
		return;
	  }
	 
	  timeLeft -= elapsedTicks;
	  var newClosedHeight = Math.round((timeLeft/TimeToSlide) * ContentHeight);

	  if(opening != null)
	  {
		if(opening.style.display != 'block')
		  opening.style.display = 'block';
		opening.style.height = (ContentHeight - newClosedHeight) + 'px';
	  }
	  
	  if(closing != null)
		closing.style.height = newClosedHeight + 'px';

	  setTimeout("animate(" + curTick + "," + timeLeft + ",'" 
		  + closingId + "','" + openingId + "')", 33);
	}
	
	var ContentHeight2 = 180;
	var TimeToSlide2 = 250.0;

	var openAccordion2 = '';

	function runAccordion2(index)
	{
	  var nID2 = "agenda" + index + "Content";
	  if(openAccordion2 == nID2)
		nID2 = '';
		
	  setTimeout("animate2(" + new Date().getTime() + "," + TimeToSlide2 + ",'" 
		  + openAccordion2 + "','" + nID2 + "')", 33);
	  
	  openAccordion2 = nID2;
	}
	
	function animate2(lastTick, timeLeft, closingId, openingId)
	{  
	  var curTick = new Date().getTime();
	  var elapsedTicks = curTick - lastTick;
	  
	  var opening = (openingId == '') ? null : document.getElementById(openingId);
	  var closing = (closingId == '') ? null : document.getElementById(closingId);
	 
	  if(timeLeft <= elapsedTicks)
	  {
		if(opening != null)
		  opening.style.height = ContentHeight2 + 'px';
		
		if(closing != null)
		{
		  closing.style.display = 'none';
		  closing.style.height = '0px';
		}
		return;
	  }
	 
	  timeLeft -= elapsedTicks;
	  var newClosedHeight = Math.round((timeLeft/TimeToSlide2) * ContentHeight2);

	  if(opening != null)
	  {
		if(opening.style.display != 'block')
		  opening.style.display = 'block';
		opening.style.height = (ContentHeight2 - newClosedHeight) + 'px';
	  }
	  
	  if(closing != null)
		closing.style.height = newClosedHeight + 'px';

	  setTimeout("animate(" + curTick + "," + timeLeft + ",'" 
		  + closingId + "','" + openingId + "')", 33);
	}
	
		function vote(vraagid)
	{
	var radioObj = document.forms['poll'].elements['answer'];
	var vote;
	if(!radioObj)
		alert("ERROR: geen radioObj");
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			vote = radioObj.value;
		else
			alert("niks gechecked");
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			vote = radioObj[i].value;
		}
	}
	if (!vote) {
		alert("U heeft geen antwoord geselecteerd.");
		}
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
		document.getElementById("pollanswers").innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.open("GET","pollvote.php?vraagid="+vraagid+"&antwoordid="+vote+"",false);
	xmlhttp.send();
	}
	
	function nowplaying(){ 
	  $.ajax({
	  timeout: 10000,
	  url: "/streaminfo.php", 
	  cache: false,
	  success: function(html){ 
	   $("#nowplaying").html(html); 
	  }
	 }); 
	}
	nowplaying();
	setInterval( "nowplaying()", 10000 );
	
	function popitup(url) {
		newwindow=window.open(url,'name','height=200,width=300,top=0,left=0');
		if (window.focus) {newwindow.focus()}
		return false;
	}
