var isie = false;

function xmlhttp_start(){
 var xmlhttp;
	
 if (window.XMLHttpRequest){
  xmlhttp = new XMLHttpRequest();
 }
 else if (window.ActiveXObject){
  xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
  isie = true;
 }
 else{
  alert('Cannot Load XMLHTTPRequest Object');
 }
 
 return xmlhttp;
}

function hentLinjer(liveid,div){
 var loading = document.getElementById('loading'+div);
 loading.style.visibility="visible";
 xmlhttp = xmlhttp_start();
 var random_num = (Math.round((Math.random()*1000)+1));
 xmlhttp.open('GET', 'livelinjer.php?liveid='+liveid+'&rand='+random_num, true);
 if(!isie)
  xmlhttp.overrideMimeType("text/html; charset=ISO-8859-1");
 xmlhttp.send(null);
	
 xmlhttp.onreadystatechange = function (){
  if (xmlhttp.readyState == 4){
   if (xmlhttp.status == 200){
    loading.style.visibility="hidden";
    document.getElementById(div).innerHTML = xmlhttp.responseText;
   }
   else{
    loading.style.visibility="hidden";
    document.getElementById(div).innerHTML = "Der opstod en fejl ved indlęsning af liveopdatering";
   }
  }
 }
}
