// JavaScript Document
/**
* Check current slide and set slide.
**/
function currentSlide() {
	check = new createXMLHttpRequest();
	var randomnumber=Math.random()*100;
	/**
	* Set a random variable for $_GET array, using putting a random numebr is the $_GET params 
	* keeps IE from caching the response.
	*/
	var stuff = "?IE="+randomnumber;
	check.open('GET','./php/current.php'+stuff,true);
	function parseStatus() {
		if (check.readyState == 4) {
			if (check.status == 200) {
				// set window.slideIndex to the ID of the current slide set in the admin panel
				window.slideIndex = check.responseText;
				document.getElementById('slideImg').style.backgroundImage = "url('./slides/"+window.slideIndex+".jpg')";
			} else {
				// server error
			}
		}
	}
	check.onreadystatechange = parseStatus;
	check.send(null);
}
