var switchtime = 3000;  //2 sec in millisec
var boolContinue = true;
var id = 0;
var provider = "";

function ajaxFunction(id,providernaam) {
  if(providernaam != undefined && provider == ""){
	provider = providernaam;
  } else {
	providernaam = provider;
  }
  var xmlHttp;
  try {
  // Firefox Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  } catch (e) {
  // Internet Explorer
     try {
       xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
     } catch (e) {
       try {
         xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
       } catch (e) {
         alert("Uw browser ondersteunt geen AJAX!");
         return false;
       }
    }
  }
  this.id = id;
  xmlHttp.onreadystatechange=function() {
    if(xmlHttp.readyState==4) { 
     document.getElementById("FRONT_AB").innerHTML = xmlHttp.responseText;
     for(i = 1; i <= 4; i++) {
       document.getElementById("top" + i).className = "";
     }
     document.getElementById("top" + id).className = "active";

    }
  }

  xmlHttp.open("GET","/logic/getfrontab.php?id=" + id + "&provider=" + providernaam,true);
 
  xmlHttp.send(null);
}

function loopTabs(providernaam){
	if(id == undefined){
		id = 1;
	}
	
	if( boolContinue ){
		if(id >= 4){
			id = 1;
		}else {
			id++;
		}
	ajaxFunction(id,providernaam);

	}
	setTimeout("loopTabs('" + providernaam + "')" , switchtime);
}
function tabOver(){
	boolContinue = false;
}

function tabOut(){
	if(!boolContinue){
		boolContinue = true;
	}
}