function checkStream() {
document.getElementById('stream-details').innerHTML="Checking W212CC Audio Stream ...
Scanning Radio Station ID: 201904159";
var xmlhttp;
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else { // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
console.log(xmlhttp.responseText);
document.getElementById("stream-details").innerHTML=xmlhttp.responseText;
if(xmlhttp.responseText.match(/-- ON AIR/)){
document.getElementById("stream-status").src="https://radiostationnet.com/images/rsn-on-air.gif";
document.getElementById("stream-last").innerHTML='';
}
if(!xmlhttp.responseText.match(/-- ON AIR/) && !xmlhttp.responseText.match(/STREAMERROR/)){
document.getElementById("stream-status").src="https://radiostationnet.com/images/rsn-offline.gif";
document.getElementById("stream-last").innerHTML='';
}
if(xmlhttp.responseText.match(/-- MMS/) && !xmlhttp.responseText.match(/STREAMERROR/)){
document.getElementById("stream-status").src="https://radiostationnet.com/images/rsn-error.gif";
document.getElementById("stream-last").innerHTML='';
}
if(xmlhttp.responseText.match(/-- RTMP/) && !xmlhttp.responseText.match(/STREAMERROR/)){
document.getElementById("stream-status").src="https://radiostationnet.com/images/rsn-error.gif";
document.getElementById("stream-last").innerHTML='';
}
if(xmlhttp.responseText.match(/STREAMERROR/)){
document.getElementById("stream-status").src="https://radiostationnet.com/images/rsn-error.gif";
document.getElementById("stream-last").innerHTML='W212CC stream malfunction.';
}
}
if (xmlhttp.readyState==4 && xmlhttp.status!=200) {
document.getElementById("stream-details").innerHTML="Error processing stream. It may be down. Status:"+xmlhttp.status+"
"+xmlhttp.responseText;
document.getElementById("stream-status").src="https://radiostationnet.com/images/rsn-error.gif";
}
}
xmlhttp.open("GET","/fetchinfo/201904159/20708/",true);
xmlhttp.send();
}