/**
 * The async request used within see-online.
 */
var xhttp;

/**
 * This function calls the update method to get the actual webcam picture from
 * Ueberlingen.
 * @return void
 */
function send_webcam_refresh(){	
    if (typeof XMLHttpRequest != "undefined") {
       xhttp = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
       xhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xhttp.open("GET", '/admin/webcam_ueberlingen/webcams/update_picture/name:ueberlingen', true);
    xhttp.onreadystatechange = refreshWebcamPicture;
    xhttp.send(null);
}

/**
 * Will be called if the new webcam picture is loaded.
 */
function refreshWebcamPicture(){
	// Only on full loaded request load the picture new.
	if ((xhttp.readyState == 4) && (xhttp.status == 200)){
        document.getElementById("webcam_ueberlingen").src = "/wp-content/uploads/webcam_ueberlingen.jpg";
	}
}

