var activeSub=0;
var SubNum=0;
var AantalLayers=4; // Geeft het aantal genummerde layers aan.
var LayerVoorvoegsel="menulayer_"; // Gebruik samen met de variabele AantalLayers
                                  // LayerVoorvoegsel+AantalLayers 
function reDo(){ window.location.reload() }
    window.onresize = reDo;


//Define global variables

var timerID = null;
var timerOn = false;
var timecount = 1000;
var what = null;
var newbrowser = true;
var check = false;

function init(){
//  alert ("Running Init");
    if (document.layers) {
                  //alert ("Running Netscape 4");
                  layerRef="document.layers";
                  styleSwitch="";
                  visibleVar="show";
		screenSize = window.innerWidth;
		what ="ns4";


    }else if(document.all){
                  //alert ("Running IE");
                  layerRef="document.all";
                  styleSwitch=".style";
                  visibleVar="visible";
		screenSize = document.body.clientWidth + 18;
		what ="ie";

	  }else if(document.getElementById){
                  //alert ("Running Netscape 6");
                  layerRef="document.getElementByID";
                  styleSwitch=".style";
                  visibleVar="visible";
		what="moz";
	  
	  }else{
	  	//alert("Browserversie < 4.0");
		what="none";
		newbrowser = false;
	  }
	  

	//window.status='status bar text to go here';
	check = true;
}

// Turns the layers on and off
function showLayer(layerName){
if(check){
	if (what =="none"){
		return;
		}
  	else if (what == "moz"){
		document.getElementById(layerName).style.visibility="visible";
		}
	else{
      eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
      }
 }
else {// alert ("Please wait for the page to finish loading.");
	return;}
}

function hideLayer(layerName){
if(check){
	if (what =="none"){
		return;
	}
	else if (what == "moz"){
		document.getElementById(layerName).style.visibility="hidden";
	}
	else{
            eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
	}

}
else {
	return;}
}


function hideAll(layername,layercount){
      for (teller=0;teller<=(layercount);teller++) {
            hideLayer(layername+teller);
			hideLayer('picturelayer');
            //alert(layername+teller);
      }
}
function hideOthers(layername){
            hideLayer(layername+0);
            hideLayer(layername+1);
            hideLayer(layername+2);
            hideLayer(layername+4);
}


/*function startTime() {
  if (timerOn == false) {
    timerID=setTimeout( "hideAll(LayerVoorvoegsel,AantalLayers)" , timecount);
    timerOn = true;
  }

}*/
function startTime() {
	//alert("starttime");
  if (timerOn == false) {
    timerID=setTimeout( "hideLayer('picturelayer')" , timecount);
    timerOn = true;
  }

}


function stopTime() {
  if (timerOn) {
  clearTimeout(timerID);
    timerID = null;
    timerOn = false;
  }
}

function onLoad(){
	init();
}

function overstate (layer) {
      //hideAll(LayerVoorvoegsel,AantalLayers);
      showLayer(layer);
      stopTime();
}

function Menuoverstate (layer) {
      hideOthers(LayerVoorvoegsel);
      showLayer(layer);
      stopTime();
}

function centreElement(element) {
    //centreer elementen in venster
	var LayerXPos, LayerYPos, LayerHeight, LayerWidth, el, Width, Height;
      Width = WindowWidth();
      Height = WindowHeight();
	el = document.getElementById(element);
	//LayerWidth=parseInt(el.style.width);
	LayerWidth=763;
	//alert("Width: "+Width+" Height: "+Height+" LayerWidth: "+LayerWidth);
	//LayerHeight=parseInt(el.style.height);
	//alert(LayerHeight);
	LayerXPos=Math.round((Width/2)-(LayerWidth/2));
	//LayerYPos=Math.round((Height/2)-(LayerHeight/2));
	//alert("LayerXPos x LayerYPos "+LayerXPos+" x " +LayerYPos);
	el.style.left=LayerXPos+"px";
	alert(element.style.left);
	//el.top=LayerYPos;
	//el.style.visibility="visible";
	}
	
	/*
	function ShowPicturelayer(layerName, ImageName){
if(check){
	if (what =="none"){
		return;
		}
  	else if (what == "moz"){
		document.getElementById(layerName).background-image=ImageName;
		document.getElementById(layerName).style.visibility="visible";
		}
	else{
	  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.background-image= '+ImageName);
      eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
      }
 }
else {// alert ("Please wait for the page to finish loading.");
	return;}
}*/
