function updateOrientation()
{
	var orientation=window.orientation;
	switch(orientation)
	{
	
		case 0:
				document.body.setAttribute("class","portrait");
				
		case 90:
		case -90:	
				
				document.body.setAttribute("class","landscape");
				break;
	}

}

// Point to the updateOrientation function when iPhone switches between portrait and landscape modes.
window.onorientationchange=updateOrientation;

function poll()
{
	// Provide the XMLHttpRequest class for IE 5.x-6.x:
	// Other browsers (including IE 7.x-8.x) ignore this
	//   when XMLHttpRequest is predefined
	if (typeof XMLHttpRequest  === "undefined") {
	  XMLHttpRequest = function() {
		try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }
		catch(e) {}

		try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }
		catch(e) {}

		try { return new ActiveXObject("Msxml2.XMLHTTP"); }
		catch(e) {}

		try { return new ActiveXObject("Microsoft.XMLHTTP"); }
		catch(e) {}

		return false;
	  };
	}

	var req = new XMLHttpRequest();
	if(req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4 && req.status == 200)
			{
				if( req.responseText == '1' )
				{
					window.location.href='poll-passagier.php';
				}
				else if( req.responseText == '2' )
				{
					window.location.href='poll-bestuurder.php';
				}

				setTimeout(poll, 45000);
			}
			
			return true;
		};
		req.open("GET", "poll-ajax.php", true);
		req.send("");
	}
}

setTimeout(poll, 45000);
