if (window.XMLHttpRequest){ var xmlHttp = new XMLHttpRequest(); } else { if (window.ActiveXObject){ var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } }
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') { xmlHttp = new XMLHttpRequest(); }

function updateSlide() {
	var url = "xml/randomExpositie.php";
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = updateResults;
	xmlHttp.send(null);
}

function updateResults() {
	if (xmlHttp.readyState == 4) {
		response = xmlHttp.responseXML;
		HTMLcode = "<h2>Huidige expositie</h2>";
		HTMLcode += "<a href=\"?c=3&id=" + response.getElementsByTagName('expoid')[0].firstChild.data + "\"><div id=\"kader\"><img src=\"images/werken/" + response.getElementsByTagName('id')[0].firstChild.data + "_middel.jpg\" width=\"" + response.getElementsByTagName('imagewidth')[0].firstChild.data + "px\" height=\"" + response.getElementsByTagName('imageheight')[0].firstChild.data + "px\" />";
		HTMLcode += "<br />" + response.getElementsByTagName('kunstenaar')[0].firstChild.data;
		if (response.getElementsByTagName('type')[0].firstChild.data != 'undefined'){ HTMLcode += "<br />" + response.getElementsByTagName('type')[0].firstChild.data; }
		HTMLcode += "</div></a>";
		document.getElementById('slidecontainer').innerHTML = HTMLcode;
	}
}

if (window.XMLHttpRequest){ var xmlHttp2 = new XMLHttpRequest(); } else { if (window.ActiveXObject){ var xmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP"); } }
if (!xmlHttp2 && typeof XMLHttpRequest != 'undefined') { xmlHttp2 = new XMLHttpRequest(); }

function updateSlide2() {
	var url = "xml/randomKunstwerk.php";
	xmlHttp2.open("GET", url, true);
	xmlHttp2.onreadystatechange = updateResults2;
	xmlHttp2.send(null);
}

function updateResults2() {
	if (xmlHttp2.readyState == 4) {
		response2 = xmlHttp2.responseXML;
		if (response2.getElementsByTagName('stat')[0].firstChild.data != 'undefined'){ HTMLcode2 = "<h2>Kunstwerken (" + response2.getElementsByTagName('stat')[0].firstChild.data + ")</h2>"; } else { HTMLcode2 = "<h2>Kunstwerken</h2>"; }
		HTMLcode2 += "<a href=\"?c=4&k=1&wid=" + response2.getElementsByTagName('id')[0].firstChild.data + "\"><div id=\"kader\"><img src=\"images/werken/" + response2.getElementsByTagName('id')[0].firstChild.data + "_middel.jpg\" width=\"" + response2.getElementsByTagName('imagewidth')[0].firstChild.data + "px\" height=\"" + response2.getElementsByTagName('imageheight')[0].firstChild.data + "px\" />";
		HTMLcode2 += "<br />" + response2.getElementsByTagName('kunstenaar')[0].firstChild.data;
		if (response2.getElementsByTagName('type')[0].firstChild.data != 'undefined'){ HTMLcode2 += "<br />" + response2.getElementsByTagName('type')[0].firstChild.data; }
		HTMLcode2 += "</div></a>";
		document.getElementById('slidecontainer2').innerHTML = HTMLcode2;
	}
}

updateSlide();
updateSlide2();
setInterval('updateSlide();updateSlide2();',5000);