maps = {
	centralProcessing : {
		groundColor : "#331111",
		ceilingColor : "#EEDDCC",
		width : 22,
		height : 22,
		map : [
			[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
			[1,0,0,0,1,0,0,0,1,0,0,0,1,1,1,1,1,1,1,0,0,1],
			[1,0,0,0,1,0,0,0,2,0,0,0,0,0,0,2,0,0,0,1,0,1],
			[1,0,0,0,1,0,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,1],
			[1,1,2,1,1,1,2,1,1,1,1,1,0,0,0,1,0,0,0,1,0,1],
			[1,0,0,0,1,0,1,1,1,1,0,1,1,1,1,0,1,4,1,1,0,1],
			[1,0,0,0,1,1,1,1,0,0,1,0,0,0,0,1,0,0,1,1,1,1],
			[1,0,0,0,1,1,1,3,0,0,1,0,0,0,0,4,0,0,3,1,1,1],
			[1,1,2,1,1,1,0,0,0,0,4,0,0,3,0,1,0,0,0,0,1,1],
			[1,1,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1],
			[1,1,0,1,1,1,1,1,4,1,1,1,4,1,1,1,1,1,4,1,1,1],
			[1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1],
			[1,0,1,1,1,1,0,0,0,0,4,0,0,0,0,1,0,0,0,0,1,1],
			[1,0,0,0,0,1,0,0,3,0,1,0,0,3,0,4,0,0,3,0,1,1],
			[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1],
			[1,0,1,1,1,1,1,4,1,1,1,1,1,4,1,1,1,4,1,1,0,1],
			[1,1,0,0,0,4,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1],
			[1,1,2,1,1,1,0,0,0,0,1,0,0,0,0,4,0,0,0,0,1,1],
			[1,0,0,0,1,1,1,3,0,0,4,0,0,3,0,1,0,0,3,1,1,1],
			[2,0,0,0,1,1,1,1,0,0,1,0,0,0,0,1,0,0,1,1,1,1],
			[1,0,0,0,1,0,0,0,1,1,0,1,1,1,1,0,1,1,1,1,0,1],
			[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
		],
		tiles : ["cpuWall", "cpuDoor", "cpuPanel", "cpuDoorSpecial"],
		entities : [
			{
				type : "player",
				x : 2,
				y : 5,
				direction : 3
			},
			{ type : "eliteHunter", x : 2, y : 19 },
			{ type : "eliteHunter", x : 6, y : 2 },
			{ type : "eliteHunter", x : 17, y : 3 },
			{ type : "eliteHunter", x : 17, y : 17 },
			{ type : "eliteHunter", x : 17, y : 8 },
			{ type : "eliteHunter", x : 17, y : 12 },
			{ type : "eliteHunter", x : 12, y : 17 },
			{ type : "eliteHunter", x : 12, y : 8 },
			{ type : "eliteHunter", x : 12, y : 12 },
			{ type : "eliteHunter", x : 7, y : 17 },
			{ type : "eliteHunter", x : 7, y : 8 },
			{ type : "eliteHunter", x : 7, y : 12 },
			{ type : "door", x : 2, y : 8},
			{ type : "door", x : 2, y : 17},
			{ type : "door", x : 8, y : 2},
			{ type : "door", x : 15, y : 2},
			{
				type : "varSetter", x : 0, y : 0,
				onLoad : function(map) {
					if(!vars.cpuMap) {
						vars.cpuMap = [3,0,4,4,5,4,1,0,5];
					}
					
					prepareCPUMap(map);
				}
			},
			{ type : "door", usable : false, x : 5, y : 16},
			{ type : "door", usable : false, x : 7, y : 15},
			{ type : "door", usable : false, x : 8, y : 10},
			{ type : "door", usable : false, x : 10, y : 8},
			{ type : "door", usable : false, x : 10, y : 12},
			{ type : "door", usable : false, x : 10, y : 18},
			{ type : "door", usable : false, x : 12, y : 10},
			{ type : "door", usable : false, x : 13, y : 15},
			{ type : "door", usable : false, x : 15, y : 7},
			{ type : "door", usable : false, x : 15, y : 13},
			{ type : "door", usable : false, x : 15, y : 17},
			{ type : "door", usable : false, x : 18, y : 10},
			{ type : "door", usable : false, x : 17, y : 15},
			{ type : "door", usable : false, x : 17, y : 5},
			{
				type : "terminal", x : 7, y : 7,
				onUse : function() { terminalMenu(0); }
			},
			{
				type : "terminal", x : 13, y : 8,
				onUse : function() { terminalMenu(1); }
			},
			{
				type : "terminal", x : 18, y : 7,
				onUse : function() { terminalMenu(2); }
			},
			{
				type : "terminal", x : 8, y : 13,
				onUse : function() { terminalMenu(3); }
			},
			{
				type : "terminal", x : 13, y : 13,
				onUse : function() { terminalMenu(4); }
			},
			{
				type : "terminal", x : 18, y : 13,
				onUse : function() { terminalMenu(5); }
			},
			{
				type : "terminal", x : 7, y : 18,
				onUse : function() { terminalMenu(6); }
			},
			{
				type : "terminal", x : 13, y : 18,
				onUse : function() { terminalMenu(7); }
			},
			{
				type : "terminal", x : 18, y : 18,
				onUse : function() { terminalMenu(8); }
			},
			{
				type : "portal", x : 2, y : 4,
				onUse : function() { portal("administration", 17, 12, 1); }
			},
			{
				type : "portal", x : 6, y : 4,
				onUse : function() { portal("administration", 20, 14, 3); }
			},
			{
				type : "portal", x : 0, y : 19,
				onUse : function() { portal("bioLabs", 20, 12, 2); }
			}
		],
		scenery : []
	},
	maintenance : {
		groundColor : "#664433",
		ceilingColor : "#442211",
		width : 22,
		height : 22,
		map : [
			[1,1,1,1,1,5,3,1,1,1,3,5,3,5,1,1,1,1,1,1,1,1],
			[1,1,1,1,5,0,0,0,1,1,0,0,0,5,0,0,1,1,0,1,1,1],
			[1,1,0,0,0,0,0,0,2,0,0,0,0,6,0,0,1,0,0,0,1,1],
			[1,1,0,0,1,0,0,0,1,1,0,0,0,1,1,1,0,0,0,0,0,1],
			[1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,1],
			[1,5,6,1,1,1,0,1,1,0,0,0,1,1,1,1,0,0,0,0,0,1],
			[5,0,0,0,1,1,0,0,1,0,0,0,6,0,0,0,1,1,2,1,1,1],
			[3,0,0,0,1,1,1,1,1,0,0,0,5,1,0,0,1,0,0,0,1,1],
			[1,0,0,0,1,1,1,1,1,1,3,5,1,1,0,0,1,0,0,0,1,1],
			[1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1],
			[1,0,0,0,1,1,3,5,5,5,5,5,1,1,1,1,1,1,1,1,1,1],
			[1,0,0,0,0,0,0,0,0,0,0,5,1,1,1,1,1,1,1,1,1,1],
			[1,0,0,0,0,0,0,0,0,0,0,5,1,1,1,1,1,1,1,1,1,1],
			[1,1,1,1,1,1,1,1,1,0,0,5,1,1,5,5,5,3,5,5,5,1],
			[1,0,0,0,0,0,0,0,1,0,0,5,1,1,5,0,0,0,0,0,0,1],
			[1,0,0,0,0,0,0,0,1,0,0,3,1,1,5,0,0,0,0,0,0,1],
			[1,0,0,0,0,0,0,0,1,0,0,5,1,1,5,0,0,0,0,0,0,1],
			[1,1,2,1,1,2,1,1,1,0,0,5,1,1,5,0,0,1,1,2,1,1],
			[1,0,0,0,1,0,0,0,1,0,0,5,5,5,5,0,0,1,0,0,0,1],
			[1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1],
			[1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1],
			[1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1]
		],
		tiles : ["maintenanceWall", "maintenanceDoor", "batteryEmpty", "batteryFull", "wallCable", "maintenanceDoorSpecial"],
		entities : [
			{
				type : "player",
				x : 19,
				y : 20,
				direction : 1
			},
			{
				type : "collectable", itemName : "Soldier Armor", image : "armor",
				cid : "armor", x : 6, y : 19
			},
			{ type : "eliteHunter", x : 18, y : 2 },
			{ type : "toughHunter", x : 18, y : 8 },
			{ type : "toughHunter", x : 15, y : 2 },
			{ type : "toughHunter", x : 14, y : 8 },
			{ type : "eliteCrawler", x : 11, y : 6 },
			{ type : "toughHunter", x : 11, y : 2 },
			{ type : "toughHunter", x : 5, y : 15 },
			{ type : "eliteCrawler", x : 19, y : 15 },
			{ type : "eliteCrawler", x : 12, y : 20 },
			{ type : "eliteCrawler", x : 2, y : 11 },
			{ type : "door", x : 18, y : 6},
			{ type : "door", x : 8, y : 2},
			{ type : "door", x : 2, y : 17},
			{ type : "door", x : 5, y : 17},
			{ type : "door", x : 19, y : 17},
			{
				type : "portal", x : 2, y : 21,
				onUse : function() { portal("aboveGround", 13, 2, 3); }
			},
			{
				type : "portal", x : 19, y : 21,
				onUse : function() { portal("administration", 16, 1, 3); }
			},
			{ type : "door", usable : false, x : 2, y : 5},
			{ type : "door", usable : false, x : 4, y : 2},
			{ type : "door", usable : false, x : 12, y : 6},
			{ type : "door", usable : false, x : 13, y : 2},
			{ type : "battery", x : 18, y : 1, bid : "1" },
			{ type : "battery", x : 15, y : 1, bid : "2" },
			{ 
				type : "socket", x : 10, y : 0, sid : "1",
				varCount : {name : "sockets1", cap : 2},
				associatedBlocks : [
					{x : 13, y : 2}
				]
			},
			{ 
				type : "socket", x : 12, y : 0, sid : "2",
				varCount : {name : "sockets1", cap : 2},
				associatedBlocks : [
					{x : 13, y : 2}
				]
			},
			{ 
				type : "socket", x : 0, y : 7, sid : "3",
				associatedBlocks : [
					{x : 2, y : 5}
				]
			},
			{ 
				type : "socket", x : 6, y : 0, occupied : true, sid : "5",
				associatedRemoveEvent: function() { setSavePoint("maintenance", 6, 1, 3); },
				associatedEvent : function() { setSavePoint("administration", 1, 6, 0); },
				associatedBlocks : [
					{x : 4, y : 2}
				]
			},
			{ 
				type : "socket", x : 10, y : 8, sid : "6",
				associatedBlocks : [
					{x : 12, y : 6}
				]
			},
			{ 
				type : "socket", x : 6, y : 10, occupied : true, sid : "4",
				varCount : {name : "sockets2", cap : 3},
				associatedEvent : function() {
					alert("Power restored, you can now access Central Processing.");
					vars.cpuAccess = true;
				},
				associatedRemoveEvent : function() {
					alert("Power cut, you can no longer access Central Processing.");
					vars.cpuAccess = false;
				}
			},
			{ 
				type : "socket", x : 17, y : 13, sid : "7",
				varCount : {name : "sockets2", cap : 3},
				associatedEvent : function() {
					alert("Power restored, you can now access Central Processing.");
					vars.cpuAccess = true;
				},
				associatedRemoveEvent : function() {
					alert("Power cut, you can no longer access Central Processing.");
					vars.cpuAccess = false;
				}
			},
			{ 
				type : "socket", x : 11, y : 15, sid : "8",
				varCount : {name : "sockets2", cap : 3},
				associatedEvent : function() {
					alert("Power restored, you can now access Central Processing.");
					vars.cpuAccess = true;
				},
				associatedRemoveEvent : function() {
					alert("Power cut, you can no longer access Central Processing.");
					vars.cpuAccess = false;
				}
			}
		],
		scenery : []
	},
	bioLabs : {
		groundColor : "#666666",
		ceilingColor : "#AABB99",
		width : 22,
		height : 22,
		map : [
			[1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1],
			[1,1,0,0,0,1,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,1],
			[1,0,0,0,0,0,1,0,0,0,0,0,0,2,0,0,0,1,0,0,0,1],
			[1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1],
			[1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,1,2,1,1],
			[1,1,1,2,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1],
			[1,0,0,0,1,0,0,0,1,1,2,1,1,1,1,2,1,1,1,1,1,1],
			[1,0,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1],
			[1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,2,0,0,0,1],
			[1,1,2,1,1,1,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,1],
			[1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1],
			[1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1],
			[1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,2,0,0,0,2],
			[1,0,0,0,0,0,1,1,1,1,1,2,1,1,2,1,1,1,0,0,0,1],
			[1,0,1,1,1,2,1,0,0,0,1,0,0,1,0,0,0,1,1,1,1,1],
			[1,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,1],
			[1,1,1,2,1,1,1,0,0,0,1,1,0,1,1,1,1,1,2,1,1,1],
			[1,0,0,0,0,0,1,1,2,1,1,0,0,0,0,1,0,0,0,0,0,1],
			[1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1],
			[1,0,0,0,0,0,1,0,0,0,2,0,0,0,0,1,0,0,0,0,0,1],
			[1,1,0,0,0,1,1,0,0,0,1,0,0,0,0,1,1,0,0,0,1,1],
			[1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,1,1]
		],
		tiles : ["labsWall", "labsDoor", "labsSwitchOff", "labsSwitchOn"],
		entities : [
			{
				type : "player",
				x : 19,
				y : 1,
				direction : 3
			},
			{
				type : "collectable", itemName : "Cannon", image : "cannonWorld",
				cid : "bioCannon", x : 19, y : 8
			},
			{ type : "eliteHunter", x : 15, y : 8 },
			{ type : "hunter", x : 3, y : 1 },
			{ type : "hunter", x : 3, y : 20 },
			{ type : "hunter", x : 18, y : 20 },
			{ type : "hunter", x : 10, y : 8 },
			{ type : "hunter", x : 12, y : 10 },
			{ type : "toughCrawler", x : 5, y : 7 },
			{ type : "toughCrawler", x : 8, y : 4 },
			{ type : "toughCrawler", x : 11, y : 2 },
			{ type : "toughCrawler", x : 15, y : 3 },
			{ type : "toughCrawler", x : 2, y : 11 },
			{ type : "toughCrawler", x : 4, y : 13 },
			{ type : "toughCrawler", x : 8, y : 19 },
			{ type : "toughCrawler", x : 8, y : 15 },
			{ type : "toughCrawler", x : 12, y : 19 },
			{ type : "toughCrawler", x : 15, y : 15 },
			{ type : "door", x : 19, y : 4},
			{ type : "door", x : 13, y : 2},
			{ type : "door", x : 3, y : 5},
			{ type : "door", x : 2, y : 9},
			{ type : "door", x : 3, y : 16},
			{ type : "door", x : 5, y : 14},
			{ type : "door", x : 8, y : 17},
			{ type : "door", x : 10, y : 19},
			{ type : "door", x : 11, y : 13},
			{ type : "door", x : 14, y : 13},
			{ type : "door", x : 18, y : 16},
			{ type : "door", x : 17, y : 8},
			{ type : "door", x : 17, y : 12},
			{
				type : "door", x : 15, y : 6,
				useCheck : function() {
					var player = map.getPlayer();
					if(vars.bd1 == true) {
						return true;
					}
					
					if(player.y == 5) {
						dialog(["The door is locked from the other side."]);
						return false;
					}
					
					dialog(["You unlocked the door."]);
					vars.bd1 = true;
					return true;
				}
			},
			{
				type : "door", x : 10, y : 6,
				useCheck : function() {
					var player = map.getPlayer();
					if(vars.bd2 == true) {
						return true;
					}
					
					if(player.y == 5) {
						dialog(["The door is locked from the other side."]);
						return false;
					}
					
					dialog(["You unlocked the door."]);
					vars.bd2 = true;
					return true;
				}
			},
			{
				type : "controlSwitch", x : 3, y : 0,
				onLoad : function(map) {
					if(vars.csA) {
						map.map.map[this.y][this.x] = 4;
					}
				},
				onUse : function() {
					if(vars.csA) {
						dialog(["Environmental Control Switch A already activated."]);
						return;
					}
					
					vars.csA = true;
					if(!vars.csTotal) {
						vars.csTotal = 0;
					}
					
					vars.csTotal++;
					dialog(["Environmental Control Switch A activated."]);
					
					map.map.map[this.y][this.x] = 4;
					map.render();
					
					if(vars.csTotal == 3) {
						vars.mok = true;
						alert("Environmental System online. Maintenance area accessible.");
					}
				}
			},
			{
				type : "controlSwitch", x : 3, y : 21,
				onLoad : function(map) {
					if(vars.csB) {
						map.map.map[this.y][this.x] = 4;
					}
				},
				onUse : function() {
					if(vars.csB) {
						dialog(["Environmental Control Switch B already activated."]);
						return;
					}
					
					vars.csB = true;
					if(!vars.csTotal) {
						vars.csTotal = 0;
					}
					
					vars.csTotal++;
					dialog(["Environmental Control Switch B activated."]);
					
					map.map.map[this.y][this.x] = 4;
					map.render();
					
					if(vars.csTotal == 3) {
						vars.mok = true;
						alert("Environmental System online. Maintenance area accessible.");
					}
				}
			},
			{
				type : "controlSwitch", x : 18, y : 21,
				onLoad : function(map) {
					if(vars.csC) {
						map.map.map[this.y][this.x] = 4;
					}
				},
				onUse : function() {
					if(vars.csC) {
						dialog(["Environmental Control Switch C already activated."]);
						return;
					}
					
					vars.csC = true;
					if(!vars.csTotal) {
						vars.csTotal = 0;
					}
					
					vars.csTotal++;
					dialog(["Environmental Control Switch C activated."]);
					
					map.map.map[this.y][this.x] = 4;
					map.render();
					
					if(vars.csTotal == 3) {
						vars.mok = true;
						alert("Environmental System online. Maintenance area accessible.");
					}
				}
			},
			{
				type : "portal",
				x : 19, y : 0,
				onUse : function() {
					portal("administration", 13, 15, 1);
				}
			},
			{
				type : "portal",
				x : 21, y : 12,
				onUse : function() {
					if(vars.cpuAccess == true) {
						portal("centralProcessing", 1, 19, 0);
						return;
					}
					
					dialog(["Power to Central Processing is offline. Power can be restored in the maintenance area."])
				}
			}
		],
		scenery : []
	},
	administration : {
		groundColor : "#494055",
		ceilingColor : "#BBBBBB",
		width : 22,
		height : 22,
		map : [
			[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,8,4,1,1,1,1],
			[1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1],
			[1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1],
			[1,0,0,0,1,1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,0,1],
			[1,1,6,1,0,0,0,0,0,0,0,1,1,1,0,1,0,1,0,0,0,1],
			[1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,1,1,0,0,1],
			[2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,0,1],
			[1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,1],
			[1,1,2,1,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,1,0,1],
			[1,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,1,2,1,0,0,1],
			[1,0,0,0,2,0,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,1],
			[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1],
			[1,1,1,1,1,0,0,0,1,0,0,0,1,2,1,1,0,0,0,1,0,1],
			[1,0,0,0,0,1,0,1,1,0,0,1,0,0,0,1,1,7,1,1,2,1],
			[1,0,0,0,0,1,0,1,1,0,0,1,0,0,0,1,0,1,1,0,0,1],
			[1,0,0,0,0,2,0,1,1,0,0,1,0,0,0,1,0,1,0,0,0,1],
			[1,0,1,1,1,1,1,1,1,0,0,0,1,5,1,1,1,1,0,0,0,1],
			[1,0,1,0,0,0,0,0,1,1,1,1,0,0,0,0,1,1,0,1,1,1],
			[1,0,2,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,1],
			[1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1],
			[1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,1,0,0,1],
			[1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1]
		],
		tiles : ["adminWall", "adminDoor", "adminSignSafe", "adminSignDanger", 
				 "adminDoorBioLabs", "adminDoorClinicStore", "adminDoorCPU", 
				 "adminDoorMaintenance"
		],
		entities : [
			{
				type : "player",
				x : 1,
				y : 6,
				direction : 0
			},
			{
				type : "collectable", itemName : "Small Medkit", image : "smallHealth",
				cid : "hpadmin", x : 3, y : 19
			},
			{
				type : "signLoader", x : 15, y : 0,
				onLoad : function(map) {
					if(vars.mok == true) {
						map.map.map[this.y][this.x] = 3;
					}
				},
				onUse : function() {
					if(vars.mok == true) {
						dialog(["The maintenance area is safe to enter."]);
					} else {
						dialog(["The maintenance area is not safe to enter."]);
					}
				}
			},
			{
				type : "signLoader", x : 17, y : 0,
				onLoad : function(map) {
					if(vars.mok == true) {
						map.map.map[this.y][this.x] = 3;
					}
				},
				onUse : function() {
					if(vars.mok == true) {
						dialog(["The maintenance area is safe to enter."]);
					} else {
						dialog(["The maintenance area is not safe to enter."]);
					}
				}
			},
			{ type : "eliteHunter", x : 16, y : 19 },
			{ type : "eliteHunter", x : 10, y : 19 },
			{ type : "crawler", x : 2, y : 10 },
			{ type : "crawler", x : 6, y : 11 },
			{ type : "crawler", x : 2, y : 14 },
			{
				type : "npc", x : 2, y : 1, image : "doctor",
				onLoad : function() {
					if(vars.ps != true) {
						this.image = null;
						this.solid = false;
					}
				},
				onUse : function() {
					if(vars.ps != true) {
						return;
					}
					
					inn();
				}
			},
			{
				type : "npc", x : 3, y : 3, image : "vendor",
				onLoad : function() {
					if(vars.ps != true) {
						this.image = null;
						this.solid = false;
					}
				},
				onUse : function() {
					if(vars.ps != true) {
						return;
					}
					
					vend([
						{
							type : "item",
							name : "Small Medkit"
						},
						{
							type : "item",
							name : "Large Medkit"
						}
					])
				}
			},
			{
				type : "npc", x : 1, y : 3, image : "vendor",
				onLoad : function() {
					if(vars.ps != true) {
						this.image = null;
						this.solid = false;
					}
				},
				onUse : function() {
					if(vars.ps != true) {
						return;
					}
					
					vend([
						{
							type : "weapon",
							name : "Pistol"
						},
						{
							type : "weapon",
							name : "Shotgun"
						},
						{
							type : "armor",
							name : "Guard Armor"
						},
						{
							type : "armor",
							name : "Elite Armor"
						}
					])
				}
			},
			{
				type : "npc", x : 12, y : 6, image : "administrator",
				onLoad : function() {
					if(vars.ps != true) {
						this.image = null;
						this.solid = false;
					}
				},
				onUse : function() {
					if(vars.ps != true) {
						return;
					}
					
					if(vars.tts != true) {
						dialog([
							"Thanks again for rescuing us. There's a lot of work ahead, so let me tell you what's going on here.",
							"The creatures have spread throughout the base, and have taken down Central Processing. We can't begin",
							"to study the creatures or get a real idea of the threat they pose until it's operational again. In order",
							"to power to Central Processing, you'll need to journey to the maintenance area.",
							"Unfortunately, the maintenance area is overheated, so you'll need to get it cooled first.",
							"There's an environmental control system in the bio labs that you can use to cool the maintenance area.",
							"There's three switches in the labs that you need to flip to cool the maintenance area.",
							"That's your first objective: go to the labs and activate the three switches.",
							"One final thing: You should probably check in with our doctor and visit our vendors. They're in the ",
							"room that's just north of the building entrance."
						]);
						vars.tts = true;
						return;
					}
					
					if(vars.mok != true) {
						dialog([
							"You need to get to the maintenance area, but it's currently overheated.",
							"There's an environmental control system in the bio labs that you can use to cool the maintenance area.",
							"There's three switches in the labs that you need to flip to cool the maintenance area.",
							"Good luck!"
						]);
						return;
					}
					
					if(vars.cpuAccess != true) {
						dialog([
							"The maintenance area is now cool enough to enter. You should go there and get power to Central Processing",
							"back online."
						]);
						return;
					}
					
					if(vars.atTheEnd != true) {
						dialog([
							"Finally! Central Processing is back online! You should go there now. We're going to start working on",
							"cleanup outside."
						]);
						return;
					}
					
					dialog([
						"This is it! There's one final creature who needs killed before we have everything under control. Go outside",
						"and exterminate it. This will be the toughest creature you've fought yet. Make sure you're ready."
					]);
				}
			},
			{
				type : "npc", x : 3, y : 18, image : "administrator",
				onLoad : function() {
					if(vars.ps) {
						this.image = null;
						this.solid = false;
					}
				},
				onUse : function() {
					if(vars.ps) {
						return;
					}
					dialog([
						"Thank you for saving us. We took shelter here when the creatures started attacking.",
						"Now that you're here, we can start getting this place back up and running.",
						"Please come back to the lobby with us."
					], function() {
						disableControls();
						canvas.fillStyle = "#000000";
						canvas.fillRect(0, 0, 320, 256);
						setTimeout(function() {
							enableControls();
							vars.ps = true;
							portal("administration", 1, 6, 0);
						}, 1000);
					});
					
				}
			},
			{
				type : "npc", x : 5, y : 17, image : "vendor",
				onLoad : function() {
					if(vars.ps) { this.image = null; this.solid = false; }
				}
			},
			{
				type : "npc", x : 7, y : 17, image : "doctor",
				onLoad : function() {
					if(vars.ps) { this.image = null; this.solid = false; }
				}
			},
			{
				type : "npc", x : 6, y : 19, image : "vendor",
				onLoad : function() {
					if(vars.ps) { this.image = null; this.solid = false; }
				}
			},
			{ type : "scenery", x : 5, y : 5, image : "column" },
			{ type : "scenery", x : 5, y : 7, image : "column" },
			{ type : "scenery", x : 7, y : 5, image : "column" },
			{ type : "scenery", x : 7, y : 7, image : "column" },
			{ type : "scenery", x : 9, y : 5, image : "column" },
			{ type : "scenery", x : 9, y : 7, image : "column" },
			{
				type : "door", x : 14, y : 6,
				useCheck : function() {
					if(vars.ps != true) {
						dialog(["You can't open this door. Maybe there's someone in the base who can."]);
						return false;
					}
					
					if(vars.tts != true) {
						dialog(["You should talk to the administrator before going on."]);
						return false;
					}
					
					return true;
				}
			},
			{ type : "door", x : 13, y : 12},
			{ type : "door", x : 16, y : 5},
			{ type : "door", x : 17, y : 9},
			{ type : "door", x : 2, y : 18},
			{ type : "door", x : 2, y : 4 },
			{ type : "door", x : 2, y : 8 },
			{ type : "door", x : 5, y : 15},
			{ type : "door", x : 4, y : 10},
			{
				type : "portal", x : 0, y : 6,
				onUse : function() { portal("maintenance", 19, 20, 1); }
			},
			{
				type : "portal", x : 0, y : 6,
				onUse : function() { portal("aboveGround", 10, 7, 2); }
			},
			{
				type : "portal", x : 10, y : 21,
				onUse : function() {
					var doCinematic = false;
					if(!vars.atTheEnd) {
						vars.atTheEnd = true;
						doCinematic = true;
					}
					portal("aboveGround", 14, 11, 3);
					if(doCinematic == true) {
						setTimeout(function() {
							runCinematic(cinematics.path);
						}, 0);
					}
				}
			},
			{
				type : "portal", x : 16, y : 0,
				onUse : function() { portal("maintenance", 19, 20, 1); }
			},
			{
				type : "portal", x : 13, y : 16,
				onUse : function() { portal("bioLabs", 19, 1, 3); }
			},
			{
				type : "portal", x : 20, y : 13,
				onUse : function() {
					if(vars.cpuAccess == true) {
						portal("centralProcessing", 6, 3, 1);
						return;
					}
					
					dialog(["Power to Central Processing is offline. Power can be restored in the maintenance area."])
				}
			},
			{
				type : "portal", x : 17, y : 13,
				onUse : function() {
					if(vars.cpuAccess == true) {
						portal("centralProcessing", 2, 5, 3);
						return;
					}
					
					dialog(["Power to Central Processing is offline. Power can be restored in the maintenance area."])
				}
			}
		],
		scenery : []
	},
	aboveGround : {
		groundColor : "#223311",
		backdrop : "backdrop",
		width : 22,
		height : 22,
		map : [
			[0,1,1,1,1,1,1,1,1,1,0,1,0,0,0,1,1,1,1,1,1,1],
			[1,0,0,0,0,0,0,0,0,0,1,1,4,3,4,1,1,0,0,0,0,1],
			[1,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1],
			[1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1],
			[0,1,1,1,0,0,0,1,0,1,1,0,0,2,2,2,0,0,0,0,0,1],
			[0,0,0,0,1,1,1,1,0,0,0,0,2,0,0,0,2,0,0,0,0,1],
			[0,0,1,1,0,0,0,1,0,0,0,2,0,0,0,0,0,2,1,1,1,1],
			[0,1,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,2,0,0,0,1],
			[0,1,0,1,0,0,0,1,0,0,0,2,0,0,0,0,0,2,0,0,0,1],
			[1,0,0,0,1,1,1,1,0,0,0,0,2,0,0,0,2,0,0,0,0,1],
			[1,0,0,0,1,0,0,1,0,0,0,0,0,2,3,2,1,0,1,1,1,1],
			[1,0,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,0,0,1,0,1],
			[1,0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,1,0,1],
			[1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1],
			[1,0,0,0,1,0,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,1],
			[0,1,0,1,0,0,0,1,1,0,1,1,0,1,0,0,0,0,0,0,0,1],
			[0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,1],
			[0,0,1,1,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,1],
			[1,1,1,1,1,1,1,1,0,0,0,1,0,0,1,0,0,0,0,0,1,1],
			[1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1],
			[1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,1],
			[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
		],
		tiles : ["trees", "aboveGroundWall", "aboveGroundDoor", "aboveGroundSignDanger", "aboveGroundSignSafe"],
		entities : [
			{
				type : "player",
				x : 9,
				y : 15,
				direction : 3
			},
			{
				type : "collectable", itemName : "Large Medkit", image : "largeHealth",
				cid : "aglhp1", x : 18, y : 7
			},
			{
				type : "collectable", itemName : "Large Medkit", image : "largeHealth",
				cid : "aglhp2", x : 19, y : 7
			},
			{
				type : "collectable", itemName : "Large Medkit", image : "largeHealth",
				cid : "aglhp3", x : 20, y : 7
			},
			{
				type : "collectable", itemName : "Large Medkit", image : "largeHealth",
				cid : "aglhp4", x : 20, y : 8
			},
			{
				type : "collectable", itemName : "Large Medkit", image : "largeHealth",
				cid : "aglhp5", x : 20, y : 9
			},
			{
				type : "signLoader", x : 12, y : 1,
				onLoad : function(map) {
					if(vars.mok == true) {
						map.map.map[this.y][this.x] = 5;
					}
				},
				onUse : function() {
					if(vars.mok == true) {
						dialog(["The maintenance area is safe to enter."]);
					} else {
						dialog(["The maintenance area is not safe to enter."]);
					}
				}
			},
			{
				type : "signLoader", x : 14, y : 1,
				onLoad : function(map) {
					if(vars.mok == true) {
						map.map.map[this.y][this.x] = 5;
					}
				},
				onUse : function() {
					if(vars.mok == true) {
						dialog(["The maintenance area is safe to enter."]);
					} else {
						dialog(["The maintenance area is not safe to enter."]);
					}
				}
			},
			{ 
				type : "boss", x : 17, y : 20,
				onDie : function() {
					setTimeout(function() {
						runCinematic(cinematics.ending);
					}, 2000);
				}
			},
			{ type : "crawler", x : 5, y : 16 },
			{ type : "crawler", x : 1, y : 14 },
			{ type : "crawler", x : 3, y : 9 },
			{ type : "crawler", x : 5, y : 7 },
			{ type : "crawler", x : 9, y : 10 },
			{ type : "crawler", x : 8, y : 2 },
			{ type : "crawler", x : 2, y : 2 },
			{ type : "scenery", x : 8, y : 19, image : "debris" },
			{ type : "scenery", x : 9, y : 19, image : "debrisB" },
			{ type : "scenery", x : 10, y : 18, image : "debris" },
			{
				type : "debris", x : 12, y : 10, image : "debris",
				onLoad : function() {
					if(vars.atTheEnd) {
						this.image = null;
						this.solid = false;
					}
				}
			},
			{
				type : "portal", x : 13, y : 1,
				onUse : function() { portal("maintenance", 2, 20, 1); }
			},
			{
				type : "portal", x : 14, y : 10,
				onUse : function() { portal("administration", 10, 20, 1); }
			},
			{
				type : "portal", x : 11, y : 7,
				onUse : function() {
					if(vars.au) {
						setSavePoint("administration", 1, 6, 0);
						portal("administration", 1, 6, 0);
					} else {
						if(vars.items["Key Card"]) {
							vars.items["Key Card"]--;
							dialog(["You unlocked the main door. You may now enter."]);
							vars.au = "unlock";
						} else {
							dialog(["The building is under lockdown. Find a security guard's key card."]);
						}
					}
				}
			},
			{
				type : "collectable", itemName : "Pistol", image : "pistolWorld",
				cid : "pistol", x : 3, y : 2
			},
			{
				type : "collectable", itemName : "Key Card", image : "keyCard",
				cid : "1", x : 3, y : 3
			},
			{
				type : "collectable", itemName : "Small Medkit", image : "smallHealth",
				cid : "hp1", x : 2, y : 7
			},
			{
				type : "collectable", itemName : "Small Medkit", image : "smallHealth",
				cid : "hp2", x : 1, y : 3
			},
			{
				type : "collectable", itemName : "Small Medkit", image : "smallHealth",
				cid : "hp10", x : 10, y : 12
			}
		],
		scenery : [
			{ x : 12, y : 5, image : "banner" },
			{ x : 16, y : 5, image : "banner" },
			{ x : 12, y : 9, image : "banner" },
			{ x : 16, y : 9, image : "banner" },
			{ x : 14, y : 7, image : "pillar" }
		]
	}
}