text: 
  var gImages = [];
  var gButtons = [];
  var gCurrentAct;
  var gSVG;
  var gActImage;
  let gWidth = 592;
  let gHeight = 376;
  var gQuestList;
  
  
  function setup() {
  	prepare_canvas();
  	preload_images();
  	setbuttons();
  }
  
  function prepare_canvas() {
  	gSVGQuest = document.getElementById("actquestsvg");
  	gSVGMap = document.getElementById("actmapsvg");
  	gActImage = document.getElementById("actbg");
  	gQuestList = document.getElementById("questlist");
  }
  
  function preload_images() {
  	for (var i = 1; i <= 10; i++) {
  		var img = new Image();
  		img.src = "img/act" + i + ".jpg"; 
  		gImages.push(img);
  	}	
  }
  
  
  function setbuttons() {
  	var menu = document.getElementById("actmenu");
  	for (var i = 1; i <= 10; i++ ){
  		var btn = document.createElement("button");
  		btn.name = "act" + i;
  		btn.innerHTML = "Act " + i;
  		btn.className = "btn";
  		btn.onclick = function() {
  			showact(this);
  			var current = document.getElementsByClassName("active");
  			if (current.length > 0) { current[0].classList.remove("active"); }
  			this.classList.add("active");
  		};
  		menu.appendChild(btn);
  		gButtons.push(btn);
  	}
  	// we run this function only once at the start, set first act to active
  	gButtons[0].classList.add("active");
  	setTimeout(function() { drawact(1); }, 0);	
  }
  
  function showact(btn) {
  	// get act number from button name
  	var num = parseInt(btn.name.slice(3));
  	drawact(num);
  }
  
  function drawact(num) {
  	imgsrc = gImages[num-1].src;
  	gActImage.src = imgsrc;
  	if (num <= actdata.length) {
  		actdata[num-1].drawquests(gSVGQuest);
  		actdata[num-1].drawmap(gSVGMap);
  		actdata[num-1].makelists(gQuestList);
  	}
  	if (num == 2) { document.getElementById("banditreminder").style.display = "block"; }
  	else { document.getElementById("banditreminder").style.display = "none"; }
  }
  
  function showbandit (bandit) {
  	var svg = document.getElementById("banditreminder");
  	svg.innerHTML = "<text x=\"20\" y=\"350\">" + bandit.replace(/-/g, " ").toUpperCase() + "</text>";
  }