/*
	This file is part of The Adventures of Stickman by Matt Trobaugh, which is dedicated to the public domain under a CC0 Public Domain Dedication. To view a copy of this dedication, visit http://creativecommons.org/publicdomain/zero/1.0/.

	The Adventures of Stickman is built on the Turpidge Game Engine version 1.1 by Matt Trobaugh.
*/

try{




locations = new Locations(); 

// for hospitols
deads = new Array();

//						(color, image, walk)
locations.setDefaultSpace("#009900", "", 1);



//Town						(name, width, height)
town = locations.addLocation("Town", 35, 35);

//			(x1, y1, x2, y2, color, image, walk)
town.setArea(0, 17, 34, 17,  "#a37547", "", 1);
town.setArea(15, 15, 19, 19, "#a37547", "", 1);
town.setArea(17, 10, 17, 22, "#a37547", "", 1);
town.setArea(11, 11, 11, 22, "#a37547", "", 1);
town.setArea(23, 11, 23, 22, "#a37547", "", 1);
town.setArea(12, 11, 22, 11, "#a37547", "", 1);
town.setArea(11, 23, 23, 23, "#a37547", "", 1);

//			(x, y, color, image, walk)
town.setSpace(6, 6, "#009900", "stonewallNWCorner.png", 0);
town.setSpace(28, 6, "#009900", "stonewallNECorner.png", 0);
town.setSpace(6, 28, "#009900", "stonewallSWCorner.png", 0);
town.setSpace(28, 28, "#009900", "stonewallSECorner.png", 0);
town.setArea(6, 7, 6, 16, "#009900", "stonewallVertical.png", 0);
town.setArea(6, 18, 6, 27, "#009900", "stonewallVertical.png", 0);
town.setArea(28, 7, 28, 16, "#009900", "stonewallVertical.png", 0);
town.setArea(28, 18, 28, 27, "#009900", "stonewallVertical.png", 0);
town.setArea(7, 6, 27, 6, "#009900", "stonewallHorizontal.png", 0);
town.setArea(7, 28, 27, 28, "#009900", "stonewallHorizontal.png", 0);

//			(x1, y1, x2, y2, color, image, walk)
town.setArea(12, 13, 14, 15, "#797979", "shingles.png", 0);
town.setArea(12, 16, 14, 16, "#797979", "brickWall.png", 0);
//				(x, y, color, image, walk)
town.setSpace(13, 16, "#797979", "brickWallDoorway.png", 1);
//				(x, y, link)
town.setLink(13, 16, "Town Shop|4-6");

//										(name, x, y, image)
townShopSign = town.addThing("Town Shop Sign", 12, 16, "sign.png");
townShopSign.click = function()
{
	openDialog(this, "Item Shop");
}

//			(x1, y1, x2, y2, color, image, walk)
town.setArea(15, 7, 19, 8, "#797979", "shingles.png", 0);
town.setArea(15, 9, 19, 9, "#797979", "brickWall.png", 0);
town.setArea(17, 9, 17, 9, "#797979", "brickWallDoorway.png", 1);
//				(x, y, link)
town.setLink(17, 9, "Town Pub|5-6");

//									(name, x, y, image)
townPubSign = town.addThing("Town Pub Sign", 16, 9, "sign.png");
townPubSign.click = function()
{
	openDialog(this, "Pub");
}

//			(x1, y1, x2, y2, color, image, walk)
town.setArea(20, 14, 22, 15, "#797979", "shingles.png", 0);
town.setArea(20, 16, 22, 16, "#797979", "brickWall.png", 0);
//				(x, y, color, image, walk)
town.setSpace(21, 16, "#797979", "brickWallDoorway.png", 1);
//				(x, y, link)
town.setLink(21, 16, "Town Saving Hut|3-4");

//													(name, x, y, image)
townSavingHutSign = town.addThing("Town Saving Hut Sign", 20, 16, "sign.png");
townSavingHutSign.click = function()
{
	openDialog(this, "Save Your Game Here");
}

//			(x1, y1, x2, y2, color, image, walk)
town.setArea(12, 19, 14, 21, "#797979", "shingles.png", 0);
town.setArea(12, 22, 14, 22, "#797979", "brickWall.png", 0);
//				(x, y, color, image, walk)
town.setSpace(13, 22, "#797979", "brickWallDoorway.png", 1);
//				(x, y, link)
town.setLink(13, 22, "Town Hospitol|4-6");

//                     						  (name, x, y, image)
townHospitolSign = town.addThing("Town Hospitol Sign", 12, 22, "sign.png");
townHospitolSign.click = function()
{
	openDialog(this, "Hospitol");
}

//			(x1, y1, x2, y2, color, image, walk)
town.setArea(7, 8, 9, 9, "#797979", "shingles.png", 0);
town.setArea(7, 10, 9, 10, "#797979", "brickWall.png", 0);
//				(x, y, color, image, walk)
town.setSpace(8, 10, "#797979", "brickWallDoor.png", 0);

//			(x1, y1, x2, y2, color, image, walk)
town.setArea(25, 7, 27, 8, "#797979", "shingles.png", 0);
town.setArea(25, 9, 27, 9, "#797979", "brickWall.png", 0);
//				(x, y, color, image, walk)
town.setSpace(26, 9, "#797979", "brickWallDoorway.png", 1);
//				(x, y, link)
town.setLink(26, 9, "Town House 1|3-4");

//			(x1, y1, x2, y2, color, image, walk)
town.setArea(24, 11, 26, 12, "#797979", "shingles.png", 0);
town.setArea(24, 13, 26, 13, "#797979", "brickWall.png", 0);
//				(x, y, color, image, walk)
town.setSpace(25, 13, "#797979", "brickWallDoor.png", 0);

//			(x1, y1, x2, y2, color, image, walk)
town.setArea(18, 24, 24, 25, "#797979", "shingles.png", 0);
town.setArea(18, 26, 24, 26, "#797979", "brickWall.png", 0);
//				(x, y, color, image, walk)
town.setSpace(19, 26, "#797979", "brickWallDoorway.png", 1);
town.setSpace(23, 26, "#797979", "brickWallDoorway.png", 1);
town.setSpace(21, 27, "#009900", "tree.png", 0);
//				(x, y, link)
town.setLink(19, 26, "Town House 2|4-7");
town.setLink(23, 26, "Town House 2|10-7");

//						(name, x, y, image)
townie = town.addThing("Townie", 20, 27, "npc5.png");
townie.gaveSword = false;
townie.click = function()
{
	if(locations.getLocation("Town House 2").battle != null)
	{
		var dialogText = "My house is overrun with spiders. I hate spiders. Can you help me?";
	}
	else if(this.gaveSword == false)
	{
		var dialogText = "Thanks for helping me with those spiders. You can have this sword if you want it.";
		items.giveCharacterItem(currentCharacter, "Short Sword");
		this.gaveSword = true;
		
		openControls(currentCharacter.name);
		itemHandler();
	}
	else
	{
		var dialogText = "I'm just standing here.";
	}
	
	openDialog(this, dialogText);
}



//			(x1, y1, x2, y2, color, image, walk)
town.setArea(25, 21, 27, 23, "#797979", "shingles.png", 0);
town.setArea(25, 24, 27, 24, "#797979", "brickWall.png", 0);
//				(x, y, color, image, walk)
town.setSpace(26, 24, "#797979", "brickWallDoorway.png", 1);
//				(x, y, link)
town.setLink(26, 24, "Town House 3|4-6");

//			(x1, y1, x2, y2, color, image, walk)
town.setArea(8, 24, 10, 26, "#0066ff", "waves.png", 0);
//				(x, y, color, image, walk)
town.setSpace(9, 23, "#0066ff", "waves.png", 0);
town.setSpace(7, 25, "#0066ff", "waves.png", 0);
town.setSpace(11, 25, "#0066ff", "waves.png", 0);
town.setSpace(9, 27, "#0066ff", "waves.png", 0);
town.setSpace(7, 26, "#009900", "tree.png", 0);
town.setSpace(8, 27, "#009900", "tree.png", 0);

// area around Town
//			(x1, y1, x2, y2, color, image, walk)
town.setArea(0, 0, 2, 16, "#009900", "tree.png", 0);
town.setArea(0, 18, 2, 34, "#009900", "tree.png", 0);
//			(x, y, color, image, walk)
town.setSpace(2, 16, "#009900", "", 1);
town.setSpace(2, 18, "#009900", "", 1);

//			(x1, y1, x2, y2, color, image, walk)
town.setArea(32, 0, 34, 16, "#009900", "tree.png", 0);
town.setArea(32, 18, 34, 34, "#009900", "tree.png", 0);
//			(x, y, color, image, walk)
town.setSpace(32, 16, "#009900", "", 1);
town.setSpace(32, 18, "#009900", "", 1);

//			(x1, y1, x2, y2, color, image, walk)
town.setArea(3, 0, 23, 2, "#009900", "tree.png", 0);
town.setArea(25, 0, 31, 2, "#009900", "tree.png", 0);
town.setArea(23, 2, 25, 2, "#009900", "", 1);

town.setArea(3, 32, 10, 34, "#009900", "tree.png", 0);
town.setArea(12, 32, 31, 34, "#009900", "tree.png", 0);
town.setArea(10, 32, 12, 32, "#009900", "", 1);

//				(x, y, color, image, walk)
town.setSpace(3, 3, "#009900", "tree.png", 0);
town.setSpace(31, 3, "#009900", "tree.png", 0);
town.setSpace(3, 31, "#009900", "tree.png", 0);
town.setSpace(31, 31, "#009900", "tree.png", 0);

//				(x, y, link)
town.setLink(24, 0, "Woods|10-23");
town.setLink(11, 34, "Grotto|12-1");
town.setLink(34, 17, "Road To Bridge|1-6");





// Town Shop					(name, width, height)
townShop = locations.addLocation("Town Shop", 7, 8);

//				(x1, y1, x2, y2, color, image, walk)
townShop.setArea(0, 0, 6, 7, "#000000", "", 0);
townShop.setArea(2, 2, 6, 6, "#5c2f20", "woodFloor.png", 1);
//					(x, y, color, image, walk)
townShop.setSpace(4, 7, "#5c2f20", "woodFloor.png", 1);
townShop.setArea(2, 4, 6, 4, "#5c2f20", "woodFloorCounter.png", 0);
//				(x, y, link)
townShop.setLink(4, 7, "Town|13-17");
//                       					(name, x, y, image)
townShopkeeper = townShop.addThing("Town Shopkeeper", 4, 3, "npc1.png");
townShopkeeper.click = function()
{
	dialogText = 'Hello. Would you like to buy something?<br/><br/>' + items.getShopItem("Knife", 5) + items.getShopItem("Small Axe", 20) + items.getShopItem("Wooden Shield", 10);
	
	openDialog(this, dialogText);
}




// Town Pub						(name, width, height)
townPub = locations.addLocation("Town Pub", 9, 8);

//				(x1, y1, x2, y2, color, image, walk)
townPub.setArea(0, 0, 8, 7, "#000000", "", 0);
townPub.setArea(2, 3, 8, 6, "#5c2f20", "woodFloor.png", 1);
townPub.setArea(2, 4, 8, 4, "#5c2f20", "woodFloorCounter.png", 0);
//					(x, y, color, image, walk)
townPub.setSpace(5, 7, "#5c2f20", "woodFloor.png", 1);
//				(x, y, link)
townPub.setLink(5, 7, "Town|17-10");

//                     				  (name, x, y, image)
townBarkeep = townPub.addThing("Town Barkeep", 5, 3, "npc1.png");
townBarkeep.click = function()
{
	dialogText = 'What can I get you?<br/><br/>' + items.getShopItem("Green Potion", 5) + items.getShopItem("Purple Potion", 10);
	
	openDialog(this, dialogText);
}

//                  		     (name, x, y, image)
mrPinkThing = townPub.addThing("Mr. Pink", 8, 6, "mrPinkThing.png");
mrPinkThing.click = function()
{
	dialogText = 'Yeah, adventure. That\'s what I\'m talking about. This town is freaking boring.<br/><br/><input type="button" style="margin-left:20px;" value="Join" onClick="mrPinkThing.join()" />';
	openDialog(this, dialogText);
}
mrPinkThing.join = function()
{
	closeDialog();
	playerTeam.push(playerCharacters.getCharacter("Mr. Pink"));
	openControls("team");
	removeThing(this);
}

//                      			 (name, x, y, image)
mrWhiteThing = townPub.addThing("Mr. White", 2, 5, "mrWhiteThing.png");
mrWhiteThing.click = function()
{
	dialogText = 'Damn it Jim, I\'m a doctor not... Oh, sorry. I thought you were Jim. Like I was saying, I\'m just an old country doctor and... Adventure? Well, alright.<br/><br/><input type="button" style="margin-left:20px;" value="Join" onClick="mrWhiteThing.join()" />';
	openDialog(this, dialogText);
}
mrWhiteThing.join = function()
{
	closeDialog();
	playerTeam.push(playerCharacters.getCharacter("Mr. White"));
	openControls("team");
	removeThing(this);
}



// Town Saving Hut						(name, width, height)
townSavingHut = locations.addLocation("Town Saving Hut", 5, 6);

//					(x1, y1, x2, y2, color, image, walk)
townSavingHut.setArea(0, 0, 4, 5, "#000000", "", 0);
townSavingHut.setArea(2, 2, 4, 4, "#5c2f20", "woodFloor.png", 1);
//							(x, y, color, image, walk)
townSavingHut.setSpace(3, 5, "#5c2f20", "woodFloor.png", 1);
townSavingHut.setArea(2, 3, 4, 3, "#5c2f20", "woodFloorCounter.png", 0);
//						(x, y, link)
townSavingHut.setLink(3, 5, "Town|21-17");

//														(name, x, y, image)
townSavingHutGuy = townSavingHut.addThing("Town Saving Hut Guy", 3, 2, "npc1.png");
townSavingHutGuy.click = function()
{
	dialogText = 'Would you like to save your game?<br/><br/><input type="button" style="float:left;margin-left:20px;" value="Yes" onClick="townSavingHutGuy.yes()" /><input type="button" style="float:right;margin-right:20px;" value="No" onClick="townSavingHutGuy.no()" />';
	openDialog(this, dialogText);
}
townSavingHutGuy.yes = function()
{
	openDialog(this, "just a second...");
	saved = saveGame();
	if(saved == true)
	{
		openDialog(this, "Your game has been saved.");
	}
	else
	{
		openDialog(this, "I'm sorry, but I can't seem to save your game for you.");
	}
}
townSavingHutGuy.no = function()
{
	openDialog(this, "Suit yourself.");
}




// Town Hospitol						(name, width, height)
townHospitol = locations.addLocation("Town Hospitol", 7, 8);

//					(x1, y1, x2, y2, color, image, walk)
townHospitol.setArea(0, 0, 6, 7, "#000000", "", 0);
townHospitol.setArea(2, 2, 6, 6, "#5c2f20", "woodFloor.png", 1);
//						(x, y, color, image, walk)
townHospitol.setSpace(4, 7, "#5c2f20", "woodFloor.png", 1);
townHospitol.setArea(2, 4, 6, 4, "#5c2f20", "woodFloorCounter.png", 0);
//					(x, y, link)
townHospitol.setLink(4, 7, "Town|13-23");
//                      				 (name, x, y, image)
townDoctor = townHospitol.addThing("Town Doctor", 4, 3, "npc2.png");
townDoctor.click = function()
{
	var i;
	var dialogText = "";
	var recharged = false;
	deads.splice(0, deads.length); // empty the array
	
	for(i=0;i<playerTeam.length;i++)
	{
		if(playerTeam[i].status != "dead" && (playerTeam[i].HP < playerTeam[i].maxHP || playerTeam[i].MP < playerTeam[i].maxMP))
		{
			playerTeam[i].HP = playerTeam[i].maxHP;
			playerTeam[i].MP = playerTeam[i].maxMP;
			recharged = true;
		}
	}
	
	for(i=0;i<playerTeam.length;i++)
	{
		if(playerTeam[i].status == "dead")
		{
			deads.push(playerTeam[i]);
		}
	}
	
	if(recharged == false && deads.length < 1)
	{
		openDialog(this, "Hello, there. Good to see everyone is ok.");
	}
	else if(recharged == true && deads.length < 1)
	{
		openDialog(this, "Hello, there. Everyone's HP and MP have been recharged.");
	}
	else
	{
		if(recharged == false)
		{
			dialogText = "Hello, there.<br/><br/>";
		}
		else
		{
			dialogText = "Hello, there. Everyone's HP and MP have been recharged.<br/><br/>"
		}
		
		this.offer(dialogText)
	}
}
townDoctor.offer = function(text)
{
	text += 'Oh my. ' + deads[0].name + ' is dead. I can fix that for $' + Math.ceil(deads[0].maxHP / 2) + '.<br/><br/><input type="button" style="float:left;margin-left:20px;" value="Yes" onClick="townDoctor.yes()" /><input type="button" style="float:right;margin-right:20px;" value="No" onClick="townDoctor.no()" />';
	
	openDialog(this, text);
}
townDoctor.yes = function()
{
	var dialogText = "";

	if(playerMoney < Math.ceil(deads[0].maxHP / 2))
	{
		openDialog(this, "I'm sorry. You don't have enough money.");
	}
	else
	{
		playerMoney -= Math.ceil(deads[0].maxHP / 2);
		
		deads[0].HP = deads[0].maxHP;
		deads[0].MP = deads[0].maxMP;
		deads[0].status = "ok";
		
		dialogText = deads[0].name + " is now ok.";
		
		if(deads[0] == playerTeam[0])
		{
			resetMainCharacter();
		}
		
		deads.splice(0, 1);
		
		if(deads.length < 1)
		{
			openDialog(this, dialogText);
		}
		else
		{
			dialogText += "<br/><br/>";
			this.offer(dialogText);
		}
	}
}
townDoctor.no = function()
{
	deads.splice(0, 1);
	
	if(deads.length < 1)
	{
		openDialog(this, "Ok, then. Have a nice day.");
	}
	else
	{
		this.offer("Ok, then.<br/><br/>");
	}
}



// Town House 1						(name, width, height)
townHouse1 = locations.addLocation("Town House 1", 5, 6);

//				(x1, y1, x2, y2, color, image, walk)
townHouse1.setArea(0, 0, 4, 5, "#000000", "", 0);
townHouse1.setArea(2, 2, 4, 4, "#5c2f20", "woodFloor.png", 1);
//					(x, y, color, image, walk)
townHouse1.setSpace(3, 5, "#5c2f20", "woodFloor.png", 1);
//					(x, y, link)
townHouse1.setLink(3, 5, "Town|26-10");

//												(name, x, y, image)
townHouse1npc = townHouse1.addThing("Town House 1 NPC", 3, 2, "npc4.png");
townHouse1npc.click = function()
{
	dialogText = "If you can't handle the spiders you can try fighting the bunnies south of town.";
	openDialog(this, dialogText);
}



// Town House 2						(name, width, height)
townHouse2 = locations.addLocation("Town House 2", 13, 9);

//				(x1, y1, x2, y2, color, image, walk)
townHouse2.setArea(0, 0, 12, 8, "#000000", "", 0);
townHouse2.setArea(2, 2, 12, 7, "#5c2f20", "woodFloor.png", 1);
//					(x, y, color, image, walk)
townHouse2.setSpace(4, 8, "#5c2f20", "woodFloor.png", 1);
townHouse2.setSpace(10, 8, "#5c2f20", "woodFloor.png", 1);
//					(x, y, link)
townHouse2.setLink(4, 8, "Town|19-27");
townHouse2.setLink(10, 8, "Town|23-27");

townHouse2.battle = battles.getBattle("Spider Battle");




// Town House 3						(name, width, height)
townHouse3 = locations.addLocation("Town House 3", 7, 8);

//				(x1, y1, x2, y2, color, image, walk)
townHouse3.setArea(0, 0, 6, 7, "#000000", "", 0);
townHouse3.setArea(2, 2, 6, 6, "#5c2f20", "woodFloor.png", 1);
//					(x, y, color, image, walk)
townHouse3.setSpace(4, 7, "#5c2f20", "woodFloor.png", 1);
//					(x, y, link)
townHouse3.setLink(4, 7, "Town|26-25");

//                   				    (name, x, y, image)
mrBlondeThing = townHouse3.addThing("Mr. Blonde", 6, 5, "mrBlondeThing.png");
mrBlondeThing.click = function()
{
	dialogText = 'Adventure, huh? I can do that.<br/><br/><input type="button" style="margin-left:20px;" value="Join" onClick="mrBlondeThing.join()" />';
	openDialog(this, dialogText);
}
mrBlondeThing.join = function()
{
	closeDialog();
	playerTeam.push(playerCharacters.getCharacter("Mr. Blonde"));
	openControls("team");
	removeThing(this);
}

//                     						  (name, x, y, image)
townHouse3npc = townHouse3.addThing("Town House 3 NPC", 3, 2, "npc4.png");
townHouse3npc.click = function()
{
	dialogText = 'If you\'re looking for adventure you could travel north to the wizard\'s hut. Be careful, though. The woods can be dangerous.';
	openDialog(this, dialogText);
}







// Grotto						(name, width, height)
grotto = locations.addLocation("Grotto", 21, 21);

//				(x1, y1, x2, y2, color, image, walk)
grotto.setArea(0, 0, 9, 2, "#009900", "tree.png", 0);
grotto.setArea(11, 0, 20, 2, "#009900", "tree.png", 0);
grotto.setArea(9, 2, 11, 2, "#009900", "", 1);
grotto.setArea(0, 3, 2, 20, "#009900", "tree.png", 0);
grotto.setArea(18, 3, 20, 20, "#009900", "tree.png", 0);
grotto.setArea(3, 18, 17, 20, "#009900", "tree.png", 0);
//				(x, y, color, image, walk)
grotto.setSpace(3, 3, "#009900", "tree.png", 0);
grotto.setSpace(17, 3, "#009900", "tree.png", 0);
grotto.setSpace(3, 17, "#009900", "tree.png", 0);
grotto.setSpace(17, 17, "#009900", "tree.png", 0);

//				(x, y, link)
grotto.setLink(10, 0, "Town|11-33");

grotto.battle = battles.getBattle("Bunny Battle");




// Woods						(name, width, height)
woods = locations.addLocation("Woods", 21, 25);

//				(x1, y1, x2, y2, color, image, walk)
woods.setArea(0, 0, 9, 2, "#009900", "tree.png", 0);
woods.setArea(11, 0, 20, 2, "#009900", "tree.png", 0);
woods.setArea(9, 2, 11, 2, "#009900", "", 1);
woods.setArea(0, 22, 9, 24, "#009900", "tree.png", 0);
woods.setArea(11, 22, 20, 24, "#009900", "tree.png", 0);
woods.setArea(9, 22, 11, 22, "#009900", "", 1);
woods.setArea(0, 3, 2, 21, "#009900", "tree.png", 0);
woods.setArea(18, 3, 20, 21, "#009900", "tree.png", 0);
//				(x, y, color, image, walk)
woods.setSpace(3, 3, "#009900", "tree.png", 0);
woods.setSpace(17, 3, "#009900", "tree.png", 0);
woods.setSpace(3, 21, "#009900", "tree.png", 0);
woods.setSpace(17, 21, "#009900", "tree.png", 0);
woods.setSpace(16, 9, "#009900", "tree.png", 0);
woods.setSpace(6, 19, "#009900", "tree.png", 0);
woods.setSpace(8, 16, "#009900", "tree.png", 0);
woods.setArea(16, 17, 16, 18, "#009900", "tree.png", 0);
woods.setSpace(5, 15, "#009900", "tree.png", 0);
woods.setSpace(6, 14, "#009900", "tree.png", 0);
woods.setSpace(13, 13, "#009900", "tree.png", 0);
woods.setSpace(5, 10, "#009900", "tree.png", 0);
woods.setSpace(6, 6, "#009900", "tree.png", 0);
woods.setSpace(8, 7, "#009900", "tree.png", 0);
woods.setSpace(12, 8, "#009900", "tree.png", 0);
woods.setSpace(14, 5, "#009900", "tree.png", 0);

//				(x, y, link)
woods.setLink(10, 0, "Clearing|6-13");
woods.setLink(10, 24, "Town|24-1");

woods.battle = battles.getBattle("Woods Battle");





// Clearing						(name, width, height)
clearing = locations.addLocation("Clearing", 13, 15);

//				(x1, y1, x2, y2, color, image, walk)
clearing.setArea(0, 0, 12, 2, "#009900", "tree.png", 0);
clearing.setArea(0, 12, 5, 14, "#009900", "tree.png", 0);
clearing.setArea(7, 12, 12, 14, "#009900", "tree.png", 0);
clearing.setArea(5, 12, 7, 12, "#009900", "", 1);
clearing.setArea(0, 3, 2, 11, "#009900", "tree.png", 0);
clearing.setArea(10, 3, 12, 11, "#009900", "tree.png", 0);
//					(x, y, color, image, walk)
clearing.setSpace(3, 3, "#009900", "tree.png", 0);
clearing.setSpace(9, 3, "#009900", "tree.png", 0);
clearing.setSpace(3, 11, "#009900", "tree.png", 0);
clearing.setSpace(9, 11, "#009900", "tree.png", 0);

//				(x1, y1, x2, y2, color, image, walk)
clearing.setArea(5, 5, 7, 6, "#009900", "shingles.png", 0);
clearing.setArea(5, 7, 7, 7, "#009900", "brickWall.png", 0);
//					(x, y, color, image, walk)
clearing.setSpace(6, 7, "#009900", "brickWallDoorway.png", 1);

//				(x, y, link)
clearing.setLink(6, 7, "Mr Blues Hut|3-4");
clearing.setLink(6, 14, "Woods|10-1");




// Mr. Blue's Hut					(name, width, height)
mrBluesHut = locations.addLocation("Mr Blues Hut", 5, 6);

//				(x1, y1, x2, y2, color, image, walk)
mrBluesHut.setArea(0, 0, 4, 5, "#000000", "", 0);
mrBluesHut.setArea(2, 2, 4, 4, "#5c2f20", "woodFloor.png", 1);
//					(x, y, color, image, walk)
mrBluesHut.setSpace(3, 5, "#5c2f20", "woodFloor.png", 1);
//					(x, y, link)
mrBluesHut.setLink(3, 5, "Clearing|6-8");

//                      			 (name, x, y, image)
mrBlueThing = mrBluesHut.addThing("Mr. Blue", 3, 3, "mrBlueThing.png");
mrBlueThing.click = function()
{
	dialogText = 'Why, hello there. I haven\'t gotten many visitors lately, what with how perilous the woods are these days. Adventure, you say? Hm, I suppose I haven\'t gotten out for a while.<br/><br/><input type="button" style="margin-left:20px;" value="Join" onClick="mrBlueThing.join()" />';
	openDialog(this, dialogText);
}
mrBlueThing.join = function()
{
	closeDialog();
	playerTeam.push(playerCharacters.getCharacter("Mr. Blue"));
	openControls("team");
	removeThing(this);
}



// Road To Bridge						(name, width, height)
roadToBridge = locations.addLocation("Road To Bridge", 21, 13);

//					(x1, y1, x2, y2, color, image, walk)
roadToBridge.setArea(0, 0, 20, 2, "#009900", "tree.png", 0);
roadToBridge.setArea(0, 10, 20, 12, "#009900", "tree.png", 0);
roadToBridge.setArea(0, 3, 2, 9, "#009900", "tree.png", 0);
roadToBridge.setArea(18, 3, 20, 9, "#009900", "tree.png", 0);

//						(x, y, color, image, walk)
roadToBridge.setSpace(3, 3, "#009900", "tree.png", 0);
roadToBridge.setSpace(3, 9, "#009900", "tree.png", 0);
roadToBridge.setSpace(17, 3, "#009900", "tree.png", 0);
roadToBridge.setSpace(17, 9, "#009900", "tree.png", 0);

//					(x1, y1, x2, y2, color, image, walk)
roadToBridge.setArea(2, 5, 2, 7, "#009900", "", 1);
roadToBridge.setArea(18, 5, 18, 7, "#009900", "", 1);

roadToBridge.setArea(0, 6, 20, 6, "#a37547", "", 1);

//					(x, y, link)
roadToBridge.setLink(0, 6, "Town|33-17");
roadToBridge.setLink(20, 6, "Bridge|1-12");




// Bridge						(name, width, height)
bridge = locations.addLocation("Bridge", 41, 25);

//				(x1, y1, x2, y2, color, image, walk)
bridge.setArea(0, 0, 2, 24, "#009900", "tree.png", 0);
bridge.setArea(2, 11, 2, 13, "#009900", "", 1);
bridge.setArea(3, 0, 34, 2, "#009900", "tree.png", 0);
bridge.setArea(3, 22, 34, 24, "#009900", "tree.png", 0);
bridge.setArea(40, 0, 40, 1, "#009900", "tree.png", 0);
bridge.setArea(40, 23, 40, 24, "#009900", "tree.png", 0);
//				(x, y, color, image, walk)
bridge.setSpace(3, 3, "#009900", "tree.png", 0);
bridge.setSpace(3, 21, "#009900", "tree.png", 0);
bridge.setSpace(34, 2, "#009900", "", 1);
bridge.setSpace(34, 22, "#009900", "", 1);
bridge.setSpace(23, 8, "#009900", "tree.png", 0);
bridge.setSpace(22, 7, "#009900", "tree.png", 0);
bridge.setSpace(10, 18, "#009900", "tree.png", 0);
bridge.setSpace(9, 17, "#009900", "tree.png", 0);

//				(x1, y1, x2, y2, color, image, walk)
bridge.setArea(35, 0, 39, 24, "#0066ff", "waves.png", 0);

bridge.setArea(0, 12, 40, 12, "#a37547", "", 1);

bridge.setArea(35, 11, 39, 11, "#0066ff", "bridgeTop.png", 0);
bridge.setArea(35, 13, 39, 13, "#0066ff", "bridgeBottom.png", 0);

//				(x, y, link)
bridge.setLink(0, 12, "Road To Bridge|19-6");
bridge.setLink(38, 12, "Crossroads|5-12");

// so you can't cross the bridge until you win the battle
//				(x, y, color, image, walk)
bridge.setSpace(35, 12, "#a37547", "", 0);

bridge.battle = battles.getBattle("Bridge Battle");




// Crossroads						(name, width, height)
crossroads = locations.addLocation("Crossroads", 35, 25);

//				(x1, y1, x2, y2, color, image, walk)
crossroads.setArea(1, 0, 5, 24, "#0066ff", "waves.png", 0);

crossroads.setArea(6, 0, 34, 2, "#009900", "tree.png", 0);
crossroads.setArea(6, 22, 34, 24, "#009900", "tree.png", 0);
crossroads.setArea(32, 3, 34, 21, "#009900", "tree.png", 0);
crossroads.setArea(0, 0, 0, 1, "#009900", "tree.png", 0);
crossroads.setArea(0, 23, 0, 24, "#009900", "tree.png", 0);
//					(x, y, color, image, walk)
crossroads.setSpace(31, 3, "#009900", "tree.png", 0);
crossroads.setSpace(29, 10, "#009900", "tree.png", 0);
crossroads.setSpace(30, 10, "#009900", "tree.png", 0);
crossroads.setSpace(30, 9, "#009900", "tree.png", 0);
crossroads.setSpace(25, 14, "#009900", "tree.png", 0);
crossroads.setArea(24, 15, 25, 18, "#009900", "tree.png", 0);

//					(x, y, color, image, walk)
crossroads.setSpace(6, 2, "#009900", "", 1);
crossroads.setSpace(6, 22, "#009900", "", 1);
crossroads.setArea(32, 10, 32, 20, "#009900", "", 1);
crossroads.setArea(20, 2, 22, 2, "#009900", "", 1);
crossroads.setArea(20, 22, 22, 22, "#009900", "", 1);

//				(x1, y1, x2, y2, color, image, walk)
crossroads.setArea(0, 12, 25, 12, "#a37547", "", 1);
crossroads.setArea(21, 0, 21, 24, "#a37547", "", 1);
crossroads.setArea(20, 11, 22, 13, "#a37547", "", 1);
crossroads.setArea(13, 17, 20, 17, "#a37547", "", 1);

crossroads.setArea(1, 11, 5, 11, "#0066ff", "bridgeTop.png", 0);
crossroads.setArea(1, 13, 5, 13, "#0066ff", "bridgeBottom.png", 0);

//					(x, y, link)
crossroads.setLink(2, 12, "Bridge|35-12");
crossroads.setLink(21, 0, "Road To Castle|6-19");
crossroads.setLink(21, 24, "Road To Witchs Hut|6-1");

//				(x1, y1, x2, y2, color, image, walk)
crossroads.setArea(15, 8, 19, 9, "#797979", "shingles.png", 0);
crossroads.setArea(15, 10, 19, 10, "#797979", "brickWall.png", 0);
//					(x, y, color, image, walk)
crossroads.setSpace(17, 10, "#797979", "brickWallDoorway.png", 1);
//					(x, y, link)
crossroads.setLink(17, 10, "Crossroads Pub|5-6");
//                      							 (name, x, y, image)
crossroadsPubSign = crossroads.addThing("Crossroads Pub Sign", 16, 10, "sign.png");
crossroadsPubSign.click = function()
{
	openDialog(this, "Pub");
}

//				(x1, y1, x2, y2, color, image, walk)
crossroads.setArea(23, 8, 25, 9, "#797979", "shingles.png", 0);
crossroads.setArea(23, 10, 25, 10, "#797979", "brickWall.png", 0);
//					(x, y, color, image, walk)
crossroads.setSpace(24, 10, "#797979", "brickWallDoorway.png", 1);
//					(x, y, link)
crossroads.setLink(24, 10, "Crossroads Saving Hut|3-4");
//                     											  (name, x, y, image)
crossroadsSavingHutSign = crossroads.addThing("Crossroads Saving Hut Sign", 23, 10, "sign.png");
crossroadsSavingHutSign.click = function()
{
	openDialog(this, "Save Your Game Here");
}

//				(x1, y1, x2, y2, color, image, walk)
crossroads.setArea(13, 14, 15, 15, "#797979", "shingles.png", 0);
crossroads.setArea(13, 16, 15, 16, "#797979", "brickWall.png", 0);
//					(x, y, color, image, walk)
crossroads.setSpace(14, 16, "#797979", "brickWallDoorway.png", 1);
//					(x, y, link)
crossroads.setLink(14, 16, "Crossroads Hospitol|4-5");
//                      									 (name, x, y, image)
crossroadsHospitolSign = crossroads.addThing("Crossroads Hospitol Sign", 13, 16, "sign.png");
crossroadsHospitolSign.click = function()
{
	openDialog(this, "Hospitol");
}

//				(x1, y1, x2, y2, color, image, walk)
crossroads.setArea(17, 14, 19, 15, "#797979", "shingles.png", 0);
crossroads.setArea(17, 16, 19, 16, "#797979", "brickWall.png", 0);
//					(x, y, color, image, walk)
crossroads.setSpace(18, 16, "#797979", "brickWallDoorway.png", 1);
//					(x, y, link)
crossroads.setLink(18, 16, "Crossroads Shop|4-5");
//                     								  (name, x, y, image)
crossroadsShopSign = crossroads.addThing("Crossroads Shop Sign", 17, 16, "sign.png");
crossroadsShopSign.click = function()
{
	openDialog(this, "Shop");
}

//				(x1, y1, x2, y2, color, image, walk)
crossroads.setArea(27, 12, 31, 16, "#797979", "shingles.png", 0);
crossroads.setArea(27, 17, 31, 18, "#797979", "brickWall.png", 0);
//					(x, y, color, image, walk)
crossroads.setSpace(29, 18, "#797979", "brickWallDoorway.png", 1);
//					(x, y, link)
crossroads.setLink(29, 18, "Mansion|8-14");

//										(name, x, y, image)
fighterThing = crossroads.addThing("Fighter", 21, 22, "fighterThing.png");
fighterThing.line = "None shall pass.";
fighterThing.click = function()
{
	openDialog(this, this.line);
}




// Crossroads Pub						(name, width, height)
crossroadsPub = locations.addLocation("Crossroads Pub", 9, 8);

//					(x1, y1, x2, y2, color, image, walk)
crossroadsPub.setArea(0, 0, 8, 7, "#000000", "", 0);
crossroadsPub.setArea(2, 3, 8, 6, "#5c2f20", "woodFloor.png", 1);
crossroadsPub.setArea(2, 4, 8, 4, "#5c2f20", "woodFloorCounter.png", 0);
//						(x, y, color, image, walk)
crossroadsPub.setSpace(5, 7, "#5c2f20", "woodFloor.png", 1);
//						(x, y, link)
crossroadsPub.setLink(5, 7, "Crossroads|17-11");

//                      								 (name, x, y, image)
crossroadsBarkeep = crossroadsPub.addThing("Crossroads Barkeep", 5, 3, "npc1.png");
crossroadsBarkeep.click = function()
{
	dialogText = 'What can I get you?<br/><br/>' + items.getShopItem("Green Potion", 5) + items.getShopItem("Purple Potion", 10);
	
	openDialog(this, dialogText);
}

//                     					  (name, x, y, image)
mrBrownThing = crossroadsPub.addThing("Mr. Brown", 8, 5, "mrBrownThing.png");
mrBrownThing.click = function()
{
	dialogText = 'Let\'s go, man. I\'ve been stuck here with nothing to do.<br/><br/><input type="button" style="margin-left:20px;" value="Join" onClick="mrBrownThing.join()" />';
	openDialog(this, dialogText);
}
mrBrownThing.join = function()
{
	closeDialog();
	playerTeam.push(playerCharacters.getCharacter("Mr. Brown"));
	openControls("team");
	removeThing(this);
}




// Crossroads Saving Hut						(name, width, height)
crossroadsSavingHut = locations.addLocation("Crossroads Saving Hut", 5, 6);

//						(x1, y1, x2, y2, color, image, walk)
crossroadsSavingHut.setArea(0, 0, 4, 5, "#000000", "", 0);
crossroadsSavingHut.setArea(2, 2, 4, 4, "#5c2f20", "woodFloor.png", 1);
//								(x, y, color, image, walk)
crossroadsSavingHut.setSpace(3, 5, "#5c2f20", "woodFloor.png", 1);
crossroadsSavingHut.setArea(2, 3, 4, 3, "#5c2f20", "woodFloorCounter.png", 0);
//							(x, y, link)
crossroadsSavingHut.setLink(3, 5, "Crossroads|24-11");

//																		(name, x, y, image)
crossroadsSavingHutGuy = crossroadsSavingHut.addThing("Crossroads Saving Hut Guy", 3, 2, "npc1.png");
crossroadsSavingHutGuy.click = function()
{
	dialogText = 'Would you like to save your game?<br/><br/><input type="button" style="float:left;margin-left:20px;" value="Yes" onClick="crossroadsSavingHutGuy.yes()" /><input type="button" style="float:right;margin-right:20px;" value="No" onClick="crossroadsSavingHutGuy.no()" />';
	openDialog(this, dialogText);
}
crossroadsSavingHutGuy.yes = function()
{
	openDialog(this, "just a second...");
	saved = saveGame();
	if(saved == true)
	{
		openDialog(this, "Your game has been saved.");
	}
	else
	{
		openDialog(this, "I'm sorry, but I can't seem to save your game for you.");
	}
}
crossroadsSavingHutGuy.no = function()
{
	openDialog(this, "Suit yourself.");
}




// Crossroads Hospitol						(name, width, height)
crossroadsHospitol = locations.addLocation("Crossroads Hospitol", 6, 7);

//						(x1, y1, x2, y2, color, image, walk)
crossroadsHospitol.setArea(0, 0, 5, 6, "#000000", "", 0);
crossroadsHospitol.setArea(3, 3, 5, 5, "#5c2f20", "woodFloor.png", 1);
//							(x, y, color, image, walk)
crossroadsHospitol.setSpace(4, 6, "#5c2f20", "woodFloor.png", 1);
crossroadsHospitol.setArea(3, 4, 5, 4, "#5c2f20", "woodFloorCounter.png", 0);
//							(x, y, link)
crossroadsHospitol.setLink(4, 6, "Crossroads|14-17");
//                     									  (name, x, y, image)
crossroadsDoctor = crossroadsHospitol.addThing("Crossroads Doctor", 4, 3, "npc2.png");
crossroadsDoctor.click = function()
{
	var i;
	var dialogText = "";
	var recharged = false;
	deads.splice(0, deads.length); // empty the array
	
	for(i=0;i<playerTeam.length;i++)
	{
		if(playerTeam[i].status != "dead" && (playerTeam[i].HP < playerTeam[i].maxHP || playerTeam[i].MP < playerTeam[i].maxMP))
		{
			playerTeam[i].HP = playerTeam[i].maxHP;
			playerTeam[i].MP = playerTeam[i].maxMP;
			recharged = true;
		}
	}
	
	for(i=0;i<playerTeam.length;i++)
	{
		if(playerTeam[i].status == "dead")
		{
			deads.push(playerTeam[i]);
		}
	}
	
	if(recharged == false && deads.length < 1)
	{
		openDialog(this, "Hello, there. Good to see everyone is ok.");
	}
	else if(recharged == true && deads.length < 1)
	{
		openDialog(this, "Hello, there. Everyone's HP and MP have been recharged.");
	}
	else
	{
		if(recharged == false)
		{
			dialogText = "Hello, there.<br/><br/>";
		}
		else
		{
			dialogText = "Hello, there. Everyone's HP and MP have been recharged.<br/><br/>"
		}
		
		this.offer(dialogText)
	}
}
crossroadsDoctor.offer = function(text)
{
	text += 'Oh my. ' + deads[0].name + ' is dead. I can fix that for $' + Math.ceil(deads[0].maxHP / 2) + '.<br/><br/><input type="button" style="float:left;margin-left:20px;" value="Yes" onClick="townDoctor.yes()" /><input type="button" style="float:right;margin-right:20px;" value="No" onClick="townDoctor.no()" />';
	
	openDialog(this, text);
}
crossroadsDoctor.yes = function()
{
	var dialogText = "";

	if(playerMoney < Math.ceil(deads[0].maxHP / 2))
	{
		openDialog(this, "I'm sorry. You don't have enough money.");
	}
	else
	{
		playerMoney -= Math.ceil(deads[0].maxHP / 2);
		
		deads[0].HP = deads[0].maxHP;
		deads[0].MP = deads[0].maxMP;
		deads[0].status = "ok";
		
		dialogText = deads[0].name + " is now ok.";
		
		if(deads[0] == playerTeam[0])
		{
			resetMainCharacter();
		}
		
		deads.splice(0, 1);
		
		if(deads.length < 1)
		{
			openDialog(this, dialogText);
		}
		else
		{
			dialogText += "<br/><br/>";
			this.offer(dialogText);
		}
	}
}
crossroadsDoctor.no = function()
{
	deads.splice(0, 1);
	
	if(deads.length < 1)
	{
		openDialog(this, "Ok, then. Have a nice day.");
	}
	else
	{
		this.offer("Ok, then.<br/><br/>");
	}
}




// Crossroads Shop						(name, width, height)
crossroadsShop = locations.addLocation("Crossroads Shop", 6, 7);

//					(x1, y1, x2, y2, color, image, walk)
crossroadsShop.setArea(0, 0, 5, 6, "#000000", "", 0);
crossroadsShop.setArea(3, 3, 5, 5, "#5c2f20", "woodFloor.png", 1);
//						(x, y, color, image, walk)
crossroadsShop.setSpace(4, 6, "#5c2f20", "woodFloor.png", 1);
crossroadsShop.setArea(3, 4, 5, 4, "#5c2f20", "woodFloorCounter.png", 0);
//						(x, y, link)
crossroadsShop.setLink(4, 6, "Crossroads|18-17");
//                     										  (name, x, y, image)
crossroadsShopkeeper = crossroadsShop.addThing("Crossroads Shopkeeper", 4, 3, "npc1.png");
crossroadsShopkeeper.click = function()
{
	
	dialogText = 'Hello. Would you like to buy something?<br/><br/>' + items.getShopItem("Longsword", 60) + items.getShopItem("Trident", 40) + items.getShopItem("Battle Axe", 50);
	
	openDialog(this, dialogText);
}




// Mansion						(name, width, height)
mansion = locations.addLocation("Mansion", 15, 16);

//				(x1, y1, x2, y2, color, image, walk)
mansion.setArea(0, 0, 14, 15, "#000000", "", 0);
mansion.setArea(2, 2, 14, 14, "#5c2f20", "woodFloor.png", 1);
//				(x, y, color, image, walk)
mansion.setSpace(8, 15, "#5c2f20", "woodFloor.png", 1);
//				(x, y, link)
mansion.setLink(8, 15, "Crossroads|29-19");

mansion.battle = battles.getBattle("Mansion Battle");




// Road To Castle						(name, width, height)
roadToCastle = locations.addLocation("Road To Castle", 13, 21);

//					(x1, y1, x2, y2, color, image, walk)
roadToCastle.setArea(0, 0, 2, 20, "#009900", "tree.png", 0);
roadToCastle.setArea(10, 0, 12, 20, "#009900", "tree.png", 0);
roadToCastle.setArea(3, 0, 9, 2, "#009900", "tree.png", 0);
roadToCastle.setArea(3, 18, 9, 20, "#009900", "tree.png", 0);
//						(x, y, color, image, walk)
roadToCastle.setSpace(3, 3, "#009900", "tree.png", 0);
roadToCastle.setSpace(9, 3, "#009900", "tree.png", 0);
roadToCastle.setSpace(3, 17, "#009900", "tree.png", 0);
roadToCastle.setSpace(9, 17, "#009900", "tree.png", 0);

//					(x1, y1, x2, y2, color, image, walk)
roadToCastle.setArea(5, 2, 7, 2, "#009900", "", 1);
roadToCastle.setArea(5, 18, 7, 18, "#009900", "", 1);
roadToCastle.setArea(6, 0, 6, 20, "#a37547", "", 1);

//						(x, y, link)
roadToCastle.setLink(6, 0, "Castle Grounds|13-39");
roadToCastle.setLink(6, 20, "Crossroads|21-1");





// Castle Grounds						(name, width, height)
castleGrounds = locations.addLocation("Castle Grounds", 28, 41);

//						(x1, y1, x2, y2, color, image, walk)
castleGrounds.setArea(24, 0, 24, 5, "#0066ff", "waves.png", 0);
castleGrounds.setArea(3, 0, 3, 5, "#0066ff", "waves.png", 0);
castleGrounds.setArea(4, 5, 23, 5, "#0066ff", "waves.png", 0);

castleGrounds.setArea(0, 0, 2, 40, "#009900", "tree.png", 0);
castleGrounds.setArea(25, 0, 27, 40, "#009900", "tree.png", 0);
castleGrounds.setArea(3, 38, 24, 40, "#009900", "tree.png", 0);
//						(x, y, color, image, walk)
castleGrounds.setSpace(3, 37, "#009900", "tree.png", 0);
castleGrounds.setSpace(24, 37, "#009900", "tree.png", 0);
castleGrounds.setSpace(7, 12, "#009900", "tree.png", 0);
castleGrounds.setSpace(10, 30, "#009900", "tree.png", 0);
castleGrounds.setSpace(18, 23, "#009900", "tree.png", 0);
castleGrounds.setSpace(19, 24, "#009900", "tree.png", 0);
castleGrounds.setArea(12, 38, 14, 38, "#009900", "", 1);
castleGrounds.setArea(13, 6, 13, 40, "#a37547", "", 1);
castleGrounds.setArea(14, 6, 14, 14, "#a37547", "", 1);
castleGrounds.setArea(13, 0, 14, 3, "#a37547", "", 1);

//						(x1, y1, x2, y2, color, image, walk)
castleGrounds.setArea(5, 2, 12, 3, "#ffffff", "castleWall1.png", 0);
castleGrounds.setArea(15, 2, 22, 3, "#ffffff", "castleWall1.png", 0);
castleGrounds.setArea(5, 1, 12, 1, "#ffffff", "castleWall3.png", 0);
castleGrounds.setArea(15, 1, 22, 1, "#ffffff", "castleWall3.png", 0);
castleGrounds.setArea(6, 0, 11, 0, "#009900", "castleWall4.png", 0);
castleGrounds.setArea(16, 0, 21, 0, "#009900", "castleWall4.png", 0);
//						(x, y, color, image, walk)
castleGrounds.setSpace(5, 0, "#009900", "castleWall7.png", 0);
castleGrounds.setSpace(12, 0, "#009900", "castleWall14.png", 0);
castleGrounds.setSpace(15, 0, "#009900", "castleWall13.png", 0);
castleGrounds.setSpace(22, 0, "#009900", "castleWall9.png", 0);

// Drawbridge Down
/*
//						(x, y, color, image, walk)
castleGrounds.setSpace(13, 4, "#009900", "drawbridgeDown1.png", 1);
castleGrounds.setSpace(14, 4, "#009900", "drawbridgeDown2.png", 1);
castleGrounds.setSpace(13, 5, "#0066ff", "drawbridgeDown3.png", 1);
castleGrounds.setSpace(14, 5, "#0066ff", "drawbridgeDown4.png", 1);
castleGrounds.setSpace(13, 6, "#a37547", "drawbridgeDown5.png", 1);
castleGrounds.setSpace(14, 6, "#a37547", "drawbridgeDown6.png", 1);
*/

// Drawbridge Up
//						(x, y, color, image, walk)
castleGrounds.setSpace(13, 1, "#a37547", "drawbridgeUp1.png", 1);
castleGrounds.setSpace(14, 1, "#a37547", "drawbridgeUp2.png", 1);
castleGrounds.setSpace(13, 2, "#a37547", "drawbridgeUp3.png", 1);
castleGrounds.setSpace(14, 2, "#a37547", "drawbridgeUp4.png", 1);
castleGrounds.setSpace(13, 3, "#a37547", "drawbridgeUp5.png", 1);
castleGrounds.setSpace(14, 3, "#a37547", "drawbridgeUp6.png", 1);

//						(x, y, link)
castleGrounds.setLink(13, 40, "Road To Castle|6-1");
castleGrounds.setLink(13, 5, "Castle Town|13-31");
castleGrounds.setLink(14, 5, "Castle Town|14-31");

castleGrounds.battle = battles.getBattle("Castle Battle");






// Castle Town						(name, width, height)
castleTown = locations.addLocation("Castle Town", 28, 34);

//					(x1, y1, x2, y2, color, image, walk)
castleTown.setArea(0, 0, 2, 33, "#009900", "tree.png", 0);
castleTown.setArea(25, 0, 27, 33, "#009900", "tree.png", 0);
castleTown.setArea(3, 0, 24, 4, "#009900", "tree.png", 0);

castleTown.setArea(3, 32, 24, 32, "#0066ff", "waves.png", 0);
castleTown.setArea(3, 5, 3, 31, "#0066ff", "waves.png", 0);
castleTown.setArea(24, 5, 24, 31, "#0066ff", "waves.png", 0);
//					(x, y, color, image, walk)
castleTown.setSpace(4, 5, "#0066ff", "waves.png", 0);
castleTown.setSpace(23, 5, "#0066ff", "waves.png", 0);

//					(x, y, color, image, walk)
castleTown.setSpace(13, 31, "#009900", "drawbridgeDown1.png", 1);
castleTown.setSpace(14, 31, "#009900", "drawbridgeDown2.png", 1);
castleTown.setSpace(13, 32, "#0066ff", "drawbridgeDown3.png", 1);
castleTown.setSpace(14, 32, "#0066ff", "drawbridgeDown4.png", 1);
castleTown.setSpace(13, 33, "#a37547", "drawbridgeDown5.png", 1);
castleTown.setSpace(14, 33, "#a37547", "drawbridgeDown6.png", 1);

//					(x, y, link)
castleTown.setLink(13, 32, "Castle Grounds|13-6");
castleTown.setLink(14, 32, "Castle Grounds|14-6");

//					(x1, y1, x2, y2, color, image, walk)
castleTown.setArea(5, 29, 12, 30, "#ffffff", "castleWall1.png", 0);
castleTown.setArea(15, 29, 22, 30, "#ffffff", "castleWall1.png", 0);
castleTown.setArea(5, 28, 12, 28, "#ffffff", "castleWall3.png", 0);
castleTown.setArea(15, 28, 22, 28, "#ffffff", "castleWall3.png", 0);
castleTown.setArea(6, 27, 11, 27, "#009900", "castleWall4.png", 0);
castleTown.setArea(16, 27, 21, 27, "#009900", "castleWall4.png", 0);
//					(x, y, color, image, walk)
castleTown.setSpace(5, 27, "#009900", "castleWall7.png", 0);
castleTown.setSpace(12, 27, "#009900", "castleWall14.png", 0);
castleTown.setSpace(15, 27, "#009900", "castleWall13.png", 0);
castleTown.setSpace(22, 27, "#009900", "castleWall9.png", 0);
castleTown.setArea(6, 6, 6, 7, "#ffffff", "castleWall1.png", 0);
castleTown.setSpace(6, 5, "#ffffff", "castleWall3.png", 0);
castleTown.setSpace(6, 4, "#009900", "castleWall4.png", 0);
castleTown.setSpace(5, 4, "#009900", "castleWall13.png", 0);
castleTown.setArea(5, 5, 5, 26, "#0099900", "castleWall5.png", 0);
castleTown.setArea(21, 6, 21, 7, "#ffffff", "castleWall1.png", 0);
castleTown.setSpace(21, 5, "#ffffff", "castleWall3.png", 0);
castleTown.setSpace(21, 4, "#009900", "castleWall4.png", 0);
castleTown.setSpace(22, 4, "#009900", "castleWall13.png", 0);
castleTown.setArea(22, 5, 22, 26, "#0099900", "castleWall5.png", 0);


//				(x1, y1, x2, y2, color, image, walk)
castleTown.setArea(7, 26, 20, 26, "#a37547", "", 1);
castleTown.setArea(7, 19, 20, 19, "#a37547", "", 1);
castleTown.setArea(7, 20, 7, 25, "#a37547", "", 1);
castleTown.setArea(20, 20, 20, 25, "#a37547", "", 1);
castleTown.setArea(13, 22, 14, 30, "#a37547", "", 1);
castleTown.setArea(11, 18, 16, 21, "#a37547", "", 1);

//					(x1, y1, x2, y2, color, image, walk)
castleTown.setArea(8, 13, 19, 17, "#ffffff", "castleWall1.png", 0);
castleTown.setArea(8, 12, 19, 12, "#ffffff", "castleWall3.png", 0);
castleTown.setArea(7, 12, 7, 16, "#ffffff", "castleWall1.png", 0);
castleTown.setArea(20, 12, 20, 16, "#ffffff", "castleWall1.png", 0);
//					(x, y, color, image, walk)
castleTown.setSpace(7, 11, "#ffffff", "castleWall3.png", 0);
castleTown.setSpace(20, 11, "#ffffff", "castleWall3.png", 0);
castleTown.setArea(8, 3, 19, 3, "#009900", "castleWall4.png", 0);
castleTown.setArea(7, 5, 7, 10, "#009900", "castleWall5.png", 0);
castleTown.setSpace(7, 4, "#009900", "castleWall13.png", 0);
castleTown.setArea(20, 5, 20, 10, "#009900", "castleWall5.png", 0);
castleTown.setSpace(20, 4, "#009900", "castleWall14.png", 0);
castleTown.setArea(8, 4, 19, 11, "#009900", "cobblestone.png", 0);
castleTown.setArea(13, 17, 14, 17, "#000000", "", 1);
castleTown.setSpace(12, 16, "#ffffff", "arch1.png", 1);
castleTown.setSpace(13, 16, "#ffffff", "arch2.png", 1);
castleTown.setSpace(14, 16, "#ffffff", "arch3.png", 1);
castleTown.setSpace(15, 16, "#ffffff", "arch4.png", 1);
//					(x, y, link)
castleTown.setLink(13, 17, "Castle Interior|8-14");
castleTown.setLink(14, 17, "Castle Interior|9-14");

//					(x1, y1, x2, y2, color, image, walk)
castleTown.setArea(8, 20, 10, 21, "#797979", "shingles.png", 0);
castleTown.setArea(8, 22, 10, 22, "#797979", "brickWall.png", 0);
//					(x, y, color, image, walk)
castleTown.setSpace(9, 22, "#797979", "brickWallDoorway.png", 1);
//					(x, y, link)
castleTown.setLink(9, 22, "Castle Pub|4-5");
//                       						(name, x, y, image)
castlePubSign = castleTown.addThing("Castle Pub Sign", 8, 22, "sign.png");
castlePubSign.click = function()
{
	openDialog(this, "Pub");
}

//					(x1, y1, x2, y2, color, image, walk)
castleTown.setArea(10, 23, 12, 24, "#797979", "shingles.png", 0);
castleTown.setArea(10, 25, 12, 25, "#797979", "brickWall.png", 0);
//					(x, y, color, image, walk)
castleTown.setSpace(11, 25, "#797979", "brickWallDoorway.png", 1);
//					(x, y, link)
castleTown.setLink(11, 25, "Castle Hospitol|4-5");
//                     									  (name, x, y, image)
castleHospitolSign = castleTown.addThing("Castle Hospitol Sign", 10, 25, "sign.png");
castleHospitolSign.click = function()
{
	openDialog(this, "Hospitol");
}

//					(x1, y1, x2, y2, color, image, walk)
castleTown.setArea(17, 20, 19, 21, "#797979", "shingles.png", 0);
castleTown.setArea(17, 22, 19, 22, "#797979", "brickWall.png", 0);
//					(x, y, color, image, walk)
castleTown.setSpace(18, 22, "#797979", "brickWallDoorway.png", 1);
//					(x, y, link)
castleTown.setLink(18, 22, "Castle Saving Hut|4-5");
//                      									 (name, x, y, image)
castleSavingHutSign = castleTown.addThing("Castle Saving Hut Sign", 17, 22, "sign.png");
castleSavingHutSign.click = function()
{
	openDialog(this, "Save Your Game Here");
}

//					(x1, y1, x2, y2, color, image, walk)
castleTown.setArea(15, 23, 17, 24, "#797979", "shingles.png", 0);
castleTown.setArea(15, 25, 17, 25, "#797979", "brickWall.png", 0);
//					(x, y, color, image, walk)
castleTown.setSpace(16, 25, "#797979", "brickWallDoorway.png", 1);
//					(x, y, link)
castleTown.setLink(16, 25, "Castle Shop|4-5");
//                     							  (name, x, y, image)
castleShopSign = castleTown.addThing("Castle Shop Sign", 15, 25, "sign.png");
castleShopSign.click = function()
{
	openDialog(this, "Item Shop");
}




// Castle Pub						(name, width, height)
castlePub = locations.addLocation("Castle Pub", 6, 7);

//				(x1, y1, x2, y2, color, image, walk)
castlePub.setArea(0, 0, 5, 6, "#000000", "", 0);
castlePub.setArea(3, 3, 5, 5, "#5c2f20", "woodFloor.png", 1);
//					(x, y, color, image, walk)
castlePub.setSpace(4, 6, "#5c2f20", "woodFloor.png", 1);
castlePub.setArea(3, 4, 5, 4, "#5c2f20", "woodFloorCounter.png", 0);
//					(x, y, link)
castlePub.setLink(4, 6, "Castle Town|9-23");

//                      					 (name, x, y, image)
castleBarkeep = castlePub.addThing("Castle Barkeep", 4, 3, "npc1.png");
castleBarkeep.click = function()
{
	dialogText = 'What can I get you?<br/><br/>' + items.getShopItem("Green Potion", 5) + items.getShopItem("Purple Potion", 10);
	
	openDialog(this, dialogText);
}



// Castle Saving Hut						(name, width, height)
castleSavingHut = locations.addLocation("Castle Saving Hut", 6, 7);

//					(x1, y1, x2, y2, color, image, walk)
castleSavingHut.setArea(0, 0, 5, 6, "#000000", "", 0);
castleSavingHut.setArea(3, 3, 5, 5, "#5c2f20", "woodFloor.png", 1);
//						(x, y, color, image, walk)
castleSavingHut.setSpace(4, 6, "#5c2f20", "woodFloor.png", 1);
castleSavingHut.setArea(3, 4, 5, 4, "#5c2f20", "woodFloorCounter.png", 0);
//						(x, y, link)
castleSavingHut.setLink(4, 6, "Castle Town|18-23");

//																(name, x, y, image)
castleSavingHutGuy = castleSavingHut.addThing("Castle Saving Hut Guy", 4, 3, "npc1.png");
castleSavingHutGuy.click = function()
{
	dialogText = 'Would you like to save your game?<br/><br/><input type="button" style="float:left;margin-left:20px;" value="Yes" onClick="castleSavingHutGuy.yes()" /><input type="button" style="float:right;margin-right:20px;" value="No" onClick="castleSavingHutGuy.no()" />';
	openDialog(this, dialogText);
}
castleSavingHutGuy.yes = function()
{
	openDialog(this, "just a second...");
	saved = saveGame();
	if(saved == true)
	{
		openDialog(this, "Your game has been saved.");
	}
	else
	{
		openDialog(this, "I'm sorry, but I can't seem to save your game for you.");
	}
}
castleSavingHutGuy.no = function()
{
	openDialog(this, "Suit yourself.");
}




// Castle Hospitol						(name, width, height)
castleHospitol = locations.addLocation("Castle Hospitol", 6, 7);

//					(x1, y1, x2, y2, color, image, walk)
castleHospitol.setArea(0, 0, 5, 6, "#000000", "", 0);
castleHospitol.setArea(3, 3, 5, 5, "#5c2f20", "woodFloor.png", 1);
//						(x, y, color, image, walk)
castleHospitol.setSpace(4, 6, "#5c2f20", "woodFloor.png", 1);
castleHospitol.setArea(3, 4, 5, 4, "#5c2f20", "woodFloorCounter.png", 0);
//						(x, y, link)
castleHospitol.setLink(4, 6, "Castle Town|11-26");
//                     						  (name, x, y, image)
castleDoctor = castleHospitol.addThing("Castle Doctor", 4, 3, "npc2.png");
castleDoctor.click = function()
{
	var i;
	var dialogText = "";
	var recharged = false;
	deads.splice(0, deads.length); // empty the array
	
	for(i=0;i<playerTeam.length;i++)
	{
		if(playerTeam[i].status != "dead" && (playerTeam[i].HP < playerTeam[i].maxHP || playerTeam[i].MP < playerTeam[i].maxMP))
		{
			playerTeam[i].HP = playerTeam[i].maxHP;
			playerTeam[i].MP = playerTeam[i].maxMP;
			recharged = true;
		}
	}
	
	for(i=0;i<playerTeam.length;i++)
	{
		if(playerTeam[i].status == "dead")
		{
			deads.push(playerTeam[i]);
		}
	}
	
	if(recharged == false && deads.length < 1)
	{
		openDialog(this, "Hello, there. Good to see everyone is ok.");
	}
	else if(recharged == true && deads.length < 1)
	{
		openDialog(this, "Hello, there. Everyone's HP and MP have been recharged.");
	}
	else
	{
		if(recharged == false)
		{
			dialogText = "Hello, there.<br/><br/>";
		}
		else
		{
			dialogText = "Hello, there. Everyone's HP and MP have been recharged.<br/><br/>"
		}
		
		this.offer(dialogText)
	}
}
castleDoctor.offer = function(text)
{
	text += 'Oh my. ' + deads[0].name + ' is dead. I can fix that for $' + Math.ceil(deads[0].maxHP / 2) + '.<br/><br/><input type="button" style="float:left;margin-left:20px;" value="Yes" onClick="townDoctor.yes()" /><input type="button" style="float:right;margin-right:20px;" value="No" onClick="townDoctor.no()" />';
	
	openDialog(this, text);
}
castleDoctor.yes = function()
{
	var dialogText = "";

	if(playerMoney < Math.ceil(deads[0].maxHP / 2))
	{
		openDialog(this, "I'm sorry. You don't have enough money.");
	}
	else
	{
		playerMoney -= Math.ceil(deads[0].maxHP / 2);
		
		deads[0].HP = deads[0].maxHP;
		deads[0].MP = deads[0].maxMP;
		deads[0].status = "ok";
		
		dialogText = deads[0].name + " is now ok.";
		
		if(deads[0] == playerTeam[0])
		{
			resetMainCharacter();
		}
		
		deads.splice(0, 1);
		
		if(deads.length < 1)
		{
			openDialog(this, dialogText);
		}
		else
		{
			dialogText += "<br/><br/>";
			this.offer(dialogText);
		}
	}
}
castleDoctor.no = function()
{
	deads.splice(0, 1);
	
	if(deads.length < 1)
	{
		openDialog(this, "Ok, then. Have a nice day.");
	}
	else
	{
		this.offer("Ok, then.<br/><br/>");
	}
}




// Castle Shop						(name, width, height)
castleShop = locations.addLocation("Castle Shop", 6, 7);

//					(x1, y1, x2, y2, color, image, walk)
castleShop.setArea(0, 0, 5, 6, "#000000", "", 0);
castleShop.setArea(3, 3, 5, 5, "#5c2f20", "woodFloor.png", 1);
//					(x, y, color, image, walk)
castleShop.setSpace(4, 6, "#5c2f20", "woodFloor.png", 1);
castleShop.setArea(3, 4, 5, 4, "#5c2f20", "woodFloorCounter.png", 0);
//					(x, y, link)
castleShop.setLink(4, 6, "Castle Town|16-26");
//                    							   (name, x, y, image)
castleShopkeeper = castleShop.addThing("Castle Shopkeeper", 4, 3, "npc1.png");
castleShopkeeper.click = function()
{
	
	dialogText = 'Hello. Would you like to buy something?<br/><br/>' + items.getShopItem("Longbow", 140) + items.getShopItem("Wizard Hat", 80) + items.getShopItem("Bronze Shield", 70);
	
	openDialog(this, dialogText);
}





// Castle Interior						(name, width, height)
castleInterior = locations.addLocation("Castle Interior", 17, 16);

//					(x1, y1, x2, y2, color, image, walk)
castleInterior.setArea(0, 0, 16, 15, "#000000", "", 0);
castleInterior.setArea(3, 2, 14, 14, "#5c2f20", "woodFloor.png", 1);
castleInterior.setArea(2, 3, 2, 13, "#5c2f20", "woodFloor.png", 1);
castleInterior.setArea(15, 3, 15, 13, "#5c2f20", "woodFloor.png", 1);
castleInterior.setArea(8, 15, 9, 15, "#5c2f20", "woodFloor.png", 1);
castleInterior.setArea(4, 3, 13, 7, "#5c2f20", "carpet2.png", 1);
castleInterior.setArea(7, 8, 10, 8, "#5c2f20", "carpet2.png", 1);
castleInterior.setArea(8, 9, 9, 13, "#5c2f20", "carpet2.png", 1);
//						(x, y, color, image, walk)
castleInterior.setSpace(16, 5, "#5c2f20", "stairs.png", 1);

//						(x, y, link)
castleInterior.setLink(8, 15, "Castle Town|13-18");
castleInterior.setLink(9, 15, "Castle Town|14-18");
castleInterior.setLink(16, 5, "Castle Cellar|23-5");

//                      					 (name, x, y, image)
mrOrangeThing = castleInterior.addThing("Mr. Orange", 9, 7, "mrOrangeThing.png");
mrOrangeThing.click = function()
{
	dialogText = '...';
	openDialog(this, dialogText);
}
mrOrangeThing.join = function()
{
	closeDialog();
	playerTeam.push(playerCharacters.getCharacter("Mr. Orange"));
	openControls("team");
	removeThing(this);

}

//                    		   (name, x, y, image)
king = castleInterior.addThing("King", 8, 7, "king.png");
king.gaveSword = false;
king.click = function()
{
	if(playerTeam.indexOf(playerCharacters.getCharacter("Mr. Orange")) == -1)
	{
		dialogText = 'Thank you for ending the blockade of my castle. The danger is not over, though. The devils are spawning down in the cellar at this very moment. If you are truly adventurous, take Mr. Orange, my most trusted soldier, and slay them. If you survive you will be rewarded.<br/><br/><input type="button" style="margin-left:20px;" value="Join" onClick="mrOrangeThing.join()" />';
	}
	else if(locations.getLocation("Castle Cellar").battle != null)
	{
		dialogText = 'Quickly. There is no time to waste.'
	}
	else if(this.gaveSword == false)
	{
		dialogText = 'You\'ve done it. You truly are adventurous. Take this magic sword to aid you on your quest. Head south and you will find the evil witch that is responsible for all of this.';
		items.giveCharacterItem(currentCharacter, "Magic Sword");
		this.gaveSword = true;
		
		openControls(currentCharacter.name);
		itemHandler();
		
		var crssRds = locations.getLocation("Crossroads");
		var fighterThing = crssRds.getThing("Fighter");
		fighterThing.x = 22;
		fighterThing.line = "Move along.";
		
		// so the player can get through
		crssRds.spaces[21][22].walk = 1;
	}
	else
	{
		dialogText = 'Head south and you will find the evil witch that is responsible for all of this.';
	}
	
	openDialog(this, dialogText);
}




// Castle Cellar						(name, width, height)
castleCellar = locations.addLocation("Castle Cellar", 25, 17);

//					(x1, y1, x2, y2, color, image, walk)
castleCellar.setArea(0, 0, 24, 16, "#000000", "", 0);
castleCellar.setArea(3, 2, 22, 16, "#5c2f20", "woodFloor.png", 1);
castleCellar.setArea(2, 3, 2, 15, "#5c2f20", "woodFloor.png", 1);
castleCellar.setArea(23, 3, 23, 15, "#5c2f20", "woodFloor.png", 1);

//						(x, y, color, image, walk)
castleCellar.setSpace(24, 5, "#5c2f20", "stairsUp.png", 1);

//						(x, y, link)
castleCellar.setLink(24, 5, "Castle Interior|15-5");

castleCellar.battle = battles.getBattle("Cellar Battle");






// Road To Witchs Hut						(name, width, height)
roadToWitchsHut = locations.addLocation("Road To Witchs Hut", 21, 13);

//						(x1, y1, x2, y2, color, image, walk)
roadToWitchsHut.setArea(0, 0, 20, 2, "#009900", "tree.png", 0);
roadToWitchsHut.setArea(0, 10, 20, 12, "#009900", "tree.png", 0);
roadToWitchsHut.setArea(0, 3, 2, 9, "#009900", "tree.png", 0);
roadToWitchsHut.setArea(18, 3, 20, 9, "#009900", "tree.png", 0);

//						(x, y, color, image, walk)
roadToWitchsHut.setSpace(3, 3, "#009900", "tree.png", 0);
roadToWitchsHut.setSpace(3, 9, "#009900", "tree.png", 0);
roadToWitchsHut.setSpace(17, 3, "#009900", "tree.png", 0);
roadToWitchsHut.setSpace(17, 9, "#009900", "tree.png", 0);

//						(x1, y1, x2, y2, color, image, walk)
roadToWitchsHut.setArea(5, 2, 7, 2, "#009900", "", 1);
roadToWitchsHut.setArea(18, 5, 18, 7, "#009900", "", 1);

roadToWitchsHut.setArea(6, 0, 6, 6, "#a37547", "", 1);
roadToWitchsHut.setArea(7, 6, 20, 6, "#a37547", "", 1);

//						(x, y, link)
roadToWitchsHut.setLink(6, 0, "Crossroads|21-23");
roadToWitchsHut.setLink(20, 6, "Witchs Hut|1-8");




// Witchs Hut						(name, width, height)
witchsHut = locations.addLocation("Witchs Hut", 41, 28);

//				(x1, y1, x2, y2, color, image, walk)
witchsHut.setArea(0, 0, 40, 2, "#009900", "tree.png", 0);
witchsHut.setArea(0, 25, 40, 27, "#009900", "tree.png", 0);
witchsHut.setArea(0, 3, 2, 24, "#009900", "tree.png", 0);
witchsHut.setArea(35, 3, 40, 24, "#009900", "tree.png", 0);
//					(x, y, color, image, walk)
witchsHut.setSpace(3, 3, "#009900", "tree.png", 0);
witchsHut.setSpace(34, 3, "#009900", "tree.png", 0);
witchsHut.setSpace(3, 24, "#009900", "tree.png", 0);
witchsHut.setSpace(34, 24, "#009900", "tree.png", 0);
witchsHut.setSpace(15, 15, "#009900", "tree.png", 0);
witchsHut.setSpace(15, 16, "#009900", "tree.png", 0);
witchsHut.setSpace(16, 16, "#009900", "tree.png", 0);
witchsHut.setSpace(25, 6, "#009900", "tree.png", 0);
witchsHut.setArea(2, 7, 2, 9, "#009900", "", 1);
witchsHut.setArea(35, 19, 38, 19, "#009900", "", 1);

witchsHut.setArea(0, 8, 6, 8, "#a37547", "", 1);

//					(x, y, link)
witchsHut.setLink(0, 8, "Road To Witchs Hut|19-6");

//					(x1, y1, x2, y2, color, image, walk)
witchsHut.setArea(36, 16, 38, 17, "#009900", "shingles.png", 0);
witchsHut.setArea(36, 18, 38, 18, "#009900", "brickWall.png", 0);
//					(x, y, color, image, walk)
witchsHut.setSpace(37, 18, "#009900", "brickWallDoorway.png", 1);
//					(x, y, link)
witchsHut.setLink(37, 18, "Hell|15-49");

witchsHut.battle = battles.getBattle("Witch Battle");




// Hell						(name, width, height)
hell = locations.addLocation("Hell", 31, 51);

//			(x1, y1, x2, y2, color, image, walk)
hell.setArea(0, 0, 30, 50, "#690f08", "", 1);

//				(x, y, color, image, walk)
hell.setSpace(6, 42, "#690f08", "stalagmite.png", 0);
hell.setSpace(6, 43, "#690f08", "stalagmite.png", 0);
hell.setSpace(7, 42, "#690f08", "stalagmite.png", 0);
hell.setSpace(14, 40, "#690f08", "stalagmite.png", 0);
hell.setSpace(15, 39, "#690f08", "stalagmite.png", 0);
hell.setSpace(25, 46, "#690f08", "stalagmite.png", 0);
hell.setSpace(26, 46, "#690f08", "stalagmite.png", 0);
hell.setSpace(27, 47, "#690f08", "stalagmite.png", 0);
hell.setSpace(20, 32, "#690f08", "stalagmite.png", 0);
hell.setSpace(20, 34, "#690f08", "stalagmite.png", 0);
hell.setSpace(21, 33, "#690f08", "stalagmite.png", 0);
hell.setSpace(10, 34, "#690f08", "stalagmite.png", 0);
hell.setSpace(10, 35, "#690f08", "stalagmite.png", 0);
hell.setSpace(15, 25, "#690f08", "stalagmite.png", 0);
hell.setSpace(15, 26, "#690f08", "stalagmite.png", 0);
hell.setSpace(16, 26, "#690f08", "stalagmite.png", 0);
hell.setSpace(3, 28, "#690f08", "stalagmite.png", 0);
hell.setSpace(4, 29, "#690f08", "stalagmite.png", 0);
//				(x1, y1, x2, y2, color, image, walk)
hell.setArea(24, 20, 26, 20, "#690f08", "stalagmite.png", 0);
hell.setSpace(26, 21, "#690f08", "stalagmite.png", 0);
hell.setSpace(6, 18, "#690f08", "stalagmite.png", 0);
hell.setSpace(7, 18, "#690f08", "stalagmite.png", 0);
hell.setSpace(7, 20, "#690f08", "stalagmite.png", 0);
hell.setArea(19, 10, 21, 10, "#690f08", "stalagmite.png", 0);
hell.setSpace(20, 11, "#690f08", "stalagmite.png", 0);
hell.setSpace(4, 5, "#690f08", "stalagmite.png", 0);
hell.setSpace(5, 5, "#690f08", "stalagmite.png", 0);
hell.setSpace(6, 6, "#690f08", "stalagmite.png", 0);

//				(x, y, color, image, walk)
hell.setSpace(14, 0, "#690f08", "TheBeast1.png", 0);
hell.setSpace(15, 0, "#690f08", "TheBeast2.png", 0);
hell.setSpace(16, 0, "#690f08", "TheBeast3.png", 0);
hell.setSpace(14, 1, "#690f08", "TheBeast4.png", 0);
hell.setSpace(15, 1, "#690f08", "TheBeast5.png", 1);
hell.setSpace(16, 1, "#690f08", "TheBeast6.png", 0);
hell.setSpace(14, 2, "#690f08", "TheBeast7.png", 0);
hell.setSpace(15, 2, "#690f08", "TheBeast8.png", 0);
hell.setSpace(16, 2, "#690f08", "TheBeast9.png", 0);

hell.battle = battles.getBattle("Hell Battle");






}
catch(e)
{
	alert("An error has occurred in locations.js\n\n" + e);
}
