function walk(room, exit)
{
	var i = 0;
	var j = 0;


	function shuffle() {
		var i = 0;
		var tmp;
		var pick;

		while(i < room.length)
			{
				pick = i + Math.floor((room.length - i) * Math.random());
				tmp = room[i];
				room[i] = room[pick];
				room[pick] = tmp;
				i++;				
			}		
	}

	function displayRoom()
	{
		var wrapper = document.createElement("wrapper");
		wrapper.setAttribute("id", "wrapper");
		document.body.appendChild(wrapper);

		while (j < room[i].length)
			displayImage(room[i][j++]);
	}

	function displayImage(image)
	{
		var wrapper = document.getElementById("wrapper");
		var a = document.createElement("a");
		var img = document.createElement("img");
		a.appendChild(img);

		img.src = image.file;
		img.title = image.title;
		img.width = image.width;
		img.height = image.height;
		a.style.position = "relative";
		a.style.left = image.left;
		a.style.top = image.top;

		img.onclick = function()
			{
				if (++i == room.length)
					window.location = exit;
				else
					{
						j = 0;
						document.body.removeChild(wrapper);
						displayRoom();
					}
			}
		
		wrapper.appendChild(a);
	}

	// sort randomly the room array
	shuffle();

	displayRoom();	
}