function smileys(smiley) {
	var value = document.getElementById('bericht').value + " "
	document.getElementById('bericht').value= value + smiley
}

function dichtdoen(naam) {
	document.getElementById(naam).className='hidden'
}
function latenzien(naam) {
	if (document.getElementById(naam).className == 'visible') {
		document.getElementById(naam).className='hidden'
	} else {
		document.getElementById(naam).className='visible'
	}
}

function blurAnchors(){
if(document.getElementsByTagName) {
var a = document.getElementsByTagName("a");
//collect all anchors A
for(var i = 0; i < a.length; i++){
// mouse onfocus, blur anchors
a[i].onfocus = function(){this.blur();};
}
}
}
window.onload = blurAnchors;

function shownews(item) {

		document.getElementById(item).className = 'news'
	
}

function menu_hover(vak) {
	document.getElementById(vak).style.width = '0px';
	var width = 100;
	var slidewidth = 0;
	var time = 0;
	while (slidewidth < width) {
		setTimeout("document.getElementById('"+vak+"').style.width = '"+slidewidth+"px';", time);time = time + 5; slidewidth = slidewidth + 2; document.getElementById(vak).style.borderRight="2px solid #E8A400";
	}
}

function ajaxfunction() {
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("Your browser does not support AJAX!");
    	  return false;
   	  }
    }
  }
  
  xmlHttp.onreadystatechange=function()
  {
  if(xmlHttp.readyState==4)
    {
    	document.getElementById('shoutbox').innerHTML=xmlHttp.responseText;
    // Get the data from the server's response
    }
  }

  xmlHttp.open("GET","shoutsberichten.php",true);
  xmlHttp.send(null);
}
function ajaxje() {
	ajaxfunction();
	t=setTimeout("ajaxje()",15000);
}
ajaxje();

function ajaxsubmit() {
	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("Your browser does not support AJAX!");
    		  return false;
   		  }
          }
	  }
	var bericht = document.getElementById('bericht').value;
	var params = "bericht="+bericht;
	xmlHttp.open("POST", 'shout_submit.php', true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.onreadystatechange = function() {//Call a function when the state changes.
	if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
		xmlHttp.responseText;
 		document.getElementById('bericht').value = '';
 		ajaxfunction();
	}
	}

 	xmlHttp.send(params);
}


function submit_poll() {
	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("Your browser does not support AJAX!");
    		  return false;
   		  }
          }
	  }
	for (i=0; i<10; i++) {
	   if (document.forms['poll'].elements[i].checked) {
	      bericht = document.forms['poll'].elements[i].value;
	      break;
	   }
	} 
	var params = "stem="+bericht;
	xmlHttp.open("POST", 'poll_submit.php', true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.onreadystatechange = function() {//Call a function when the state changes.
	if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
		document.getElementById("poll").innerHTML = xmlHttp.responseText;
	}
}

 	xmlHttp.send(params);
}

