var xpos = -4000;
var ypos = -1600;
var step = 50;
var zoom = 3;
var scale = 8;
var width = 3296;
var height = 2526;
var winwidth = 320;
var winheight = 240;

function setup_map() {
	update();
	update_image();
}

function move_left() {
	xpos += step * scale;
	update();
}

function move_right() {
	xpos -= step * scale;
	update();
}

function move_up() {
	ypos += step * scale;
	update();
}

function move_down() {
	ypos -= step * scale;
	update();
}

function zoom_out() {
	if (zoom < 4) {
		zoom++;
		scale = scale * 2;
		update_image();
		update();
	}
}

function zoom_in() {
	if (zoom > 1) {
		zoom--;
		scale = scale / 2;
		update_image();
		update();
	}
}

function update_image() {
	style = document.getElementById("maparea").style;
	backgroundImage = "Url(images/forum/kernzeist0" + zoom + ".gif)";
	style.backgroundImage = backgroundImage;
}

function update() {
	div = document.getElementById("debug");
	pos = "" +  ((xpos/scale)+(winwidth/2)) + "px " + ((ypos/scale)+(winheight/2)) + "px"
	style = document.getElementById("maparea").style;
	style.backgroundPosition = pos;
	div.innerHTML = "<p>" + xpos + "," + ypos + "," + zoom + "</p>";
}
