$(document).ready(function() {
	setInterval( "refreshmoorsele()", 10000); 
});

function refreshmoorsele() {
		$.ajax({
   type: "POST",
   url: "/webcam/checkWebcam.php",
	 success: function(xml) { 
			processXmlmoorsele(xml);
	 }
 });
}



function processXmlmoorsele(xml) {
	$(xml).find('succes').each( function() {
		var res = $(this).text();
			if (res == "true") {
				var tmp = new Date();
  			tmp = "?"+tmp.getTime();
				var source = "http://webcam.pcv.be/moorsele/moorsele.jpg" + tmp;
				$(".webcam-container").text('');
				$(".webcam-container").html("<img id=\"webcam-moorsele-img\" src=\"http://webcam.pcv.be/moorsele/moorsele.jpg\" width=\"480\"alt=\"Webcam moorsele\" />");
				
				$("#webcam-moorsele-img").fadeTo("fast", 0.33);
				$("#webcam-moorsele-img").attr("src", source);
				$("#webcam-moorsele-img").fadeTo("slow", 1);
				
			} else {
				//$(".webcam-container").text(noWebcam);
			}
		});
}

