// Feel free to use this game on your site just keep a link to me. and email me at matt@playandpost.com
// This script modified by aswystun@cox.net// I replaced the drunken clown with the ape.
// I made some of the monsters tougher, some easier.
// I made it very dangerous to attack a child.
// Monster generator -----------------------------------------------

function opponent() {
var bigrandum = Math.round(Math.random() * 20)
var randum1 = Math.round(Math.random() * 7)
var randum2 = Math.round(Math.random() * 6)
var yourlevel = parseFloat(document.game.level.value)

var randum = randum1 + randum2 + (yourlevel * 2)
var yourlife = parseFloat(document.game.life.value)
var cash = parseFloat(document.game.money.value)
var yourlife = parseFloat(document.game.life.value)
var yourattack = parseFloat(document.game.attackdamage.value) 
if (bigrandum == 18) {
document.game.money.value = Math.round(cash - (cash * .10))
alert("A monkey stole " + Math.round(cash * .10) + " gold from you.")
}
if (bigrandum > 13) {
buysomethin()
document.game.life.value = yourlife + 1
	if (randum1 == 1){
		if (randum2 == 2) {
		document.game.life.value = Math.round(yourlife * .90)
		alert("Flame damage  " + Math.round(yourlife * .10) + " hit points.")
		document.game.badguy.value = "Flaming Monkey"
		document.game.enemyattack.value = 10
		document.game.enemyarmor.value = 5
		document.game.badlife.value = 50
		return false
		}
		if (randum2 == 1) {
		document.game.attackdamage.value = yourattack + 1
		alert("You found a strength pill")
		}
	document.game.life.value = Math.round(yourlife * .85)
	alert("Radiation damage  " + Math.round(yourlife * .15) + " hit points.")
	document.game.badguy.value = "Radiated Mutant Monkey"
	document.game.enemyattack.value = 30
	document.game.enemyarmor.value = 10
	document.game.badlife.value = 200
 	return false
	}
}
if (1 > yourlife) {
	alert("YOU ARE DEAD")
	document.game.experience.value = "DEAD"
	document.game.money.value = 0
	document.bgColor="black"
	return false
}	
	 if (randum == 2) {
	document.game.badguy.value = "Rabbit"
	document.game.enemyattack.value = 1
	document.game.enemyarmor.value = 8
	document.game.badlife.value = 6
	}
	 if (randum == 3) {
	document.game.badguy.value = "Funky Chicken"
	document.game.enemyattack.value = 2
	document.game.enemyarmor.value = 6
	document.game.badlife.value = 8
	}
	if (randum == 4) {
	document.game.badguy.value = "Monkey"
	document.game.enemyattack.value = 3
	document.game.enemyarmor.value = 8
	document.game.badlife.value = 12
	}
	if (randum == 5) {
	document.game.badguy.value = "Fat Rabbit"
	document.game.enemyattack.value = 4
	document.game.enemyarmor.value = 8
	document.game.badlife.value = 9
	}
	if (randum == 6) {
	document.game.badguy.value = "Big Fly"
	document.game.enemyattack.value = 1
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 1
	}
	if (randum == 7) {
	document.game.badguy.value = "Drunken Monkey"
	document.game.enemyattack.value = 2
	document.game.enemyarmor.value = 6
	document.game.badlife.value = 10
	}
	if (randum == 8) {
	document.game.badguy.value = "Mutant monkey"
	document.game.enemyattack.value = 2
	document.game.enemyarmor.value = 6
	document.game.badlife.value = 15
	}
	if (randum == 9) {
	document.game.badguy.value = "Super Fly"
	document.game.enemyattack.value = 3
	document.game.enemyarmor.value = 6
	document.game.badlife.value = 25
	}
	if (randum == 10) {
	document.game.badguy.value = "Sea Monkey"
	document.game.enemyattack.value = 4
	document.game.enemyarmor.value = 3
	document.game.badlife.value = 30
	}
	if (randum > 11) {
	document.game.badguy.value = "Flaming Monkey"
	document.game.enemyattack.value = 10
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 50
	}
	if (randum == 12) {
	document.game.badguy.value = "Small Child"
	document.game.enemyattack.value = 200
	document.game.enemyarmor.value = 19
	document.game.badlife.value = 3
	alert("Careful! You better not attack one of these!")
	}
	if (randum == 13) {
	document.game.badguy.value = "Funky Chicken"
	document.game.enemyattack.value = 3
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 30
	}
	if (randum == 14) {
	document.game.life.value = yourlife - 3
	alert("Ouch!! You hit a trap. Lost 3 hit points.")
	}
	if (randum == 15) {
	document.game.badguy.value = "Infected Monkey"
	document.game.enemyattack.value = 6
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 35
	}
	if (randum == 16) {
	document.game.badguy.value = "Infected Monkey"
	document.game.enemyattack.value = 6
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 35
	}
	if (randum == 17) {
	document.game.money.value = cash + 15
	alert("You found 15 Gold")
	}
	if (randum == 18) {
	document.game.badguy.value = "Mad Cow"
	document.game.enemyattack.value = 8
	document.game.enemyarmor.value = 4
	document.game.badlife.value = 52
	}
	if (randum == 19)  {
	document.game.badguy.value = "Rabid Racehorse"
	document.game.enemyattack.value = 7
	document.game.enemyarmor.value = 8
	document.game.badlife.value = 60
	}
	if (randum == 20) {
	document.game.badguy.value = "Marshmellow Man"
	document.game.enemyattack.value = 2
	document.game.enemyarmor.value = 15
	document.game.badlife.value = 100
	}
	if (randum == 21) {
	document.game.life.value = Math.round(yourlife * .8)
	alert("Ouch!! You hit a trap. lost " + Math.round(yourlife * .20) + " hit points.")
	}
	if (randum == 22) {
	document.game.badguy.value = "Hungry Hungry Hippo"
	document.game.enemyattack.value = 6
	document.game.enemyarmor.value = 4
	document.game.badlife.value = 95
	}
	if (randum == 23) {
	document.game.badguy.value = "Armed Monkey"
	document.game.enemyattack.value = 12
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 90
	}
	if (randum == 24) {
	document.game.badguy.value = "Heavily Armed Monkey"
	document.game.enemyattack.value = 15
	document.game.enemyarmor.value = 7
	document.game.badlife.value = 160
	}
	if (randum == 25) {
	document.game.badguy.value = "Lizard King"
	document.game.enemyattack.value = 5
	document.game.enemyarmor.value = 14
	document.game.badlife.value = 150
	}
	if (randum == 26) {
	document.game.badguy.value = "Drunken Ape"
	document.game.enemyattack.value = 10
	document.game.enemyarmor.value = 7
	document.game.badlife.value = 90
	}
	if (randum == 27) {
	document.game.badguy.value = "Armed Monkey"
	document.game.enemyattack.value = 10
	document.game.enemyarmor.value = 6
	document.game.badlife.value = 90
	}
	if (randum == 28) {
	document.game.badguy.value = "Drunken Master"
	document.game.enemyattack.value = 30
	document.game.enemyarmor.value = 10
	document.game.badlife.value = 160
	}
	if (randum == 29) {
	document.game.life.value = Math.round(yourlife * .80)
	alert("Ouch!! You hit a trap. Lost " + Math.round(yourlife * .20) + " hit points.")
	}
	if (randum == 30) {
	document.game.badguy.value = "Drunken Master"
	document.game.enemyattack.value = 30
	document.game.enemyarmor.value = 9
	document.game.badlife.value = 180
	}
	if (randum == 31) {
	document.game.badguy.value = "Drunken Master"
	document.game.enemyattack.value = 30
	document.game.enemyarmor.value = 8
	document.game.badlife.value = 190
	}
	if (randum == 32) {
	document.game.badguy.value = "Radiated Mutant Monkey"
	document.game.enemyattack.value = 30
	document.game.enemyarmor.value = 10
	document.game.badlife.value = 250
	}
	if (randum == 33) {
	document.game.badguy.value = "Invisible Monkey"
	document.game.enemyattack.value = 20
	document.game.enemyarmor.value = 19
	document.game.badlife.value = 200
	}
	if (randum == 34) {
	document.game.badguy.value = "War Monkey"
	document.game.enemyattack.value = 40
	document.game.enemyarmor.value = 10
	document.game.badlife.value = 350
	}
	if (randum == 35) {
	document.game.badguy.value = " Invisible Monkey"
	document.game.enemyattack.value = 25
	document.game.enemyarmor.value = 19
	document.game.badlife.value = 200
	}
	if (randum == 36) {
	document.game.badguy.value = "Super High Samurai"
	document.game.enemyattack.value = 50
	document.game.enemyarmor.value = 4
	document.game.badlife.value = 500
	}
	if (randum == 37) {
	document.game.badguy.value = "Super High Samurai"
	document.game.enemyattack.value = 50
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 400
	}
	if (randum == 38) {
	document.game.badguy.value = "War Monkey"
	document.game.enemyattack.value = 40
	document.game.enemyarmor.value = 12
	document.game.badlife.value = 400
	}
	if (randum > 38) {
		if (yourlevel > 22) {
		document.game.badguy.value = "   B A L D O"
		document.game.enemyattack.value = 200
		document.game.enemyarmor.value = 19
		document.game.badlife.value = 6666
		document.game.baldo.value = 1
		} else {
		if (bigrandum == 3) {
		document.game.badguy.value = "Sober Master"
		document.game.enemyattack.value = 50
		document.game.enemyarmor.value = 12
		document.game.badlife.value = 500
		return false
		}
		document.game.badguy.value = "Super High Samurai"
		document.game.enemyattack.value = 50
		document.game.enemyarmor.value = 9
		document.game.badlife.value = 400
		} 	}


}
//=========================AtttttttacK=======================XXXXXXXXXXXXXXXXXXX
	function attacker() {
	var swordbonus = parseFloat(document.game.swordbonus.value)
	var armorbonus = parseFloat(document.game.armorbonus.value)
	var shieldbonus = parseFloat(document.game.shieldbonus.value)
	var amuletbonus = parseFloat(document.game.amuletbonus.value)
	var ringbonus = parseFloat(document.game.ringbonus.value)
	var randum = Math.round(Math.random() * 20)
	var randum1 = Math.round(Math.random() * 40)
	var yougethit = parseFloat(document.game.armorclass.value)
	var hegethit = parseFloat(document.game.enemyarmor.value)
	var hurted = parseFloat(document.game.enemyattack.value)
	var enemylife = parseFloat(document.game.badlife.value)
	var yourattack = parseFloat(document.game.attackdamage.value)
	var yourlife = parseFloat(document.game.life.value)
	var enemyattack = parseFloat(document.game.enemyattack.value)
	var yourexperience = parseFloat(document.game.experience.value)
	var yourlevel = parseFloat(document.game.level.value)
	var yourmoney = parseFloat(document.game.money.value)
	var enemyarmor = parseFloat(document.game.enemyarmor.value)
	var baldoo = parseFloat(document.game.baldo.value)
	var story = parseFloat(document.game.story.value)
//========== Level up=====================================
if (23 > yourlevel) {
	if (yourexperience > ((yourlevel * 100) + .35 * yourexperience)) {
	document.game.level.value = yourlevel + 1
	alert("You went up a level! Read the Story Line Update!")
	document.game.life.value = yourlife + (25 * yourlevel)
	document.game.attackdamage.value = yourattack + 1
		if (33 > yougethit) {
		document.game.armorclass.value = yougethit + 1
		}
//=============================StoryLine=============================XXXXXXXXXXXXXX
	if (yourlevel == 1) {
	document.game.storyline.value = "As you adventure further you discover that several villages have suffered the same fate as yours.  There are few survivors. Most of them are elderly or children. "
	}
	if (yourlevel == 2) {
	document.game.storyline.value = "The monsters seem to be coming from the north so you decide to search there. You are no match for some of the stronger creatures that you have encountered so you must continue to defeat enemies and gain strength. "
	}
	if (yourlevel == 3) {
	document.game.storyline.value = "You are definitely heading in the right direction.  Witnesses tell you that the prisoners were taken north. You are assured when you hear that the victims are always captured in their sleep and appear unharmed. Maybe your family is still alive."
	}
	if (yourlevel == 4) {
	document.game.storyline.value = "You are getting stronger with every enemy you kill. But these monkeys are highly trained and they are only getting tougher. As long as you sleep during the day you should be able to defend yourself against them."
	}
	if (yourlevel == 5) {
	document.game.storyline.value = "MESSENGER--The king has ordered you to report to his castle as soon as possible.  We have heard of your heroics, please come help us!!--"
	}
	if (yourlevel == 6) {
	document.game.storyline.value = "You have arrived at the Kings castle. You tell the guards who you are but they don't believe you. They say that they thought you would be much bigger. You eventually convince them of your identity and you are brought before the King. KING--Are you the warrior that has bravely defeated so many of these monsters. YOU--Yes.--KING--Then go to the courtyard and defeat the monsters that have overrun it. Then report back to me. --"
	}
	if (yourlevel == 7) {
	document.game.storyline.value = "All the monsters in the courtyard have been defeated so you return to the king.  KING--Thank you. My entire army has been wiped out. The few men I have left are guarding the castle. I do not know how much longer I can resist.  You must seek out the lair of the Mad Scientist Baldo. I ordered him to stop experimenting with the creation of monsters. When he refused I banished him. He is the madman responsible for all this."
	}
	if (yourlevel == 8) {
	document.game.storyline.value = "You wait until just before morning and follow a drunken monkey back to Baldo's lair. You see a soldier on the ground and approach him. SOLDIER--You are the only one left that can stop Baldo before he takes over the world. He is invincible to normal attacks. That is how he defeated the Royal Army. You must figure out a way to stop him."
	}
	if (yourlevel == 9) {
	document.game.storyline.value = "You are now in the house of the madman. If your family is still alive then they should be here. The monsters here are many times stronger but so are you."
	}
	if (yourlevel == 10) {
	document.game.storyline.value = "Your village Chief calls to you from his hiding spot.  CHIEF--Your family is all right. I escaped from the monsters but there is nowhere to run. Most of our village is still alive, but that scientist is using the prisoners to feed his monsters. Turn back now. There is no way you can defeat Baldo. I watched him destroy the entire Royal Army."
	}
	if (yourlevel == 11) {
	document.game.storyline.value = "Your determination to rescue your family has helped you become a powerful warrior. But you do not know if it will be enough to defeat Baldo."
	}
	if (yourlevel == 12) {
	document.game.money.value = yourmoney + 800
	document.game.storyline.value = "Baldo's ASSISTANT--Please don't kill me. I hate Baldo, so I will tell you what you need to do. To kill Baldo you will need a ring. Without one you cannot hit him. With one of Baldo's rings you can hit him easily. You will need one of his swords to do enough damage to kill him, and his shield, and armor to withstand his attacks. Here is 800 gold, it may help. Only, let me live!"
	}
	if (yourlevel == 15) {
	document.game.storyline.value = "You have the knowledge of how to defeat Baldo. Now it is a matter of getting stronger and acquiring the right items before your family becomes monster food."
	}
	if (yourlevel == 18) {
	document.game.storyline.value = "You are getting more and more powerful. Yet you know that without the right help, in the form of the magical items mentioned by the assistant, you will be helpless and hopeless in front of Baldo. You must find the tools you need. You must be able to bribe the current owners to get these items."
    }
	if (yourlevel == 22) {
	document.game.storyline.value = "You have reached the peak of your skill.  The risks of searching have become high. It is time to take on Baldo. Only continue to search if it is necessary."
	}
	return false
	}
}
//=========================Hit or Miss============================
	if (1 > yourlife) {
	alert("YOU ARE DEAD")
	document.game.experience.value = 0
	document.game.money.value = 0
	document.bgColor="black"
	document.game.storyline.value = "'You died. You failed. Your family is doomed to being tortured by the monkeys. We had such high hopes for you. In fact you were are only hope.' Those words go through your mind as you wake from unconsciousness. You didn't die, you were knocked out. Knocked out so badly in fact, that you have forgotten everything you learned. You were also robbed. You must start over to save your family! Go get 'em!"
	return false
	}
		if (enemylife > 0) {
			if (randum > (hegethit - ringbonus)) {
				if (randum == 14) {
				document.game.badlife.value = enemylife - ((yourattack + swordbonus) * 2)
				alert("Critical Hit!!! you did " + ((yourattack + swordbonus) * 2)  + " points of damage!")
				} else {
				document.game.badlife.value = enemylife - (yourattack + swordbonus)
				alert("You hit the enemy for " + (yourattack + swordbonus)  + " damage points")
				}
			}
			if (randum1 > (yougethit + armorbonus)) {
			document.game.life.value = yourlife - (enemyattack - shieldbonus)
			alert("You got hit for " + (enemyattack - shieldbonus) + " hit points")
			}
		}
	// =========================REWARDS =======================================
	if (1 > enemylife) {
	document.game.badlife.value = "DEAD"
	document.game.baldo.value = baldoo + 1
	document.game.experience.value = yourexperience + (enemyattack * enemyarmor)
	document.game.money.value = yourmoney + (enemyattack * randum)
	alert("You have defeated your oppenent. You aquired " + (enemyattack * randum) + " gold. And " + (enemyattack * enemyarmor) + " experience")
		if (randum == 15) {
		document.game.life.value = yourlife + 15
		alert("You Found Magic Beans, plus 15 to hitpoints")
		}
			if (document.game.enemyattack.value == 200) {
			document.game.level.value = 1
			document.game.experience.value = 1
			document.game.badguy.value = "Baldo is Dead!!!"
			document.game.storyline.value = "Baldo has been defeated!!!  You have saved your family and the world.  The people have elected you the new ruler of the kingdom. You have accepted and your wife is very pleased to be the queen!"
			alert("BALDO has been defeated! His experiments have come to an end!")
			document.bgColor="green"
			}
		}
}
//==========================HEAL=======================	
	function heal() {
	var yourlife = parseFloat(document.game.life.value)
	var healpower = parseFloat(document.game.healpower.value)
	if (1 > yourlife) {
	alert("YOU ARE DEAD")
	document.game.experience.value = 0
	document.game.money.value = 0
	return false
	}	
	var cash = parseFloat(document.game.money.value)
	var yourlife = parseFloat(document.game.life.value)
	var yourexperience = parseFloat(document.game.experience.value)
	if (cash > 24) {
	document.game.money.value = cash - 25
	document.game.life.value = yourlife + healpower
	document.game.experience.value = yourexperience + 1
	}
}
//===========================BUY STUFF======================XXXXXXXXXXXXXXXXXXXXX
//==========store1==============
function buysomethin() {
var yourlevel = parseFloat(document.game.level.value)
var randum2 = Math.round(Math.random() * 12)
var randum = Math.round(Math.random() * 12)
//================store 1 items======
	if (randum == 1) {
	document.game.item1.value = "Super Sword+3/cost=200"
	document.game.xitem1.value = 1
	}
	if (randum == 2) {
	document.game.item1.value = "Shield/cost=75"
	document.game.xitem1.value = 2
	}
	if (randum == 3) {
	document.game.item1.value = "Iron Shield+2/cost=150"
	document.game.xitem1.value = 3
	}
	if (randum == 4) {
	document.game.item1.value = "Shield/cost=85"
	document.game.xitem1.value = 2
	}
	if (randum == 5) {
	document.game.item1.value = "Value Meal/cost=40"
	document.game.xitem1.value = 5
	}
	if (randum == 6) {
	document.game.item1.value = "Super Shield+3/cost=200"
	document.game.xitem1.value = 6
	}
	if (randum == 7) {
	document.game.item1.value = "Armor/cost=75"
	document.game.xitem1.value = 7
	}
	if (randum == 8) {
	document.game.item1.value = "UltimateArmor+4/cost=300"
	document.game.xitem1.value = 8
	}
	if (randum == 9) {
	document.game.item1.value = "Ring of Skill/cost=100"
	document.game.xitem1.value = 9
	}
if (yourlevel > 9) {
	if (randum == 10) {
	document.game.item1.value = "BALDO'S Armor/cost=900"
	document.game.xitem1.value = 10
	}
	if (randum == 11) {
	document.game.item1.value = "BALDO'S Sword/cost=900"
	document.game.xitem1.value = 11
	}
	if (randum == 12) {
	document.game.item1.value = "BALDO'S Shield/cost=900"
	document.game.xitem1.value = 12
	}
}
//===============store2 items==========================
	if (randum2 == 1) {
	document.game.item2.value = "Sword/cost=75"
	document.game.xitem2.value = 1
	}
	if (randum2 == 2) {
	document.game.item2.value = "Iron Shield+2/cost=150"
	document.game.xitem2.value = 2
	}
	if (randum2 == 3) {
	document.game.item2.value = "Amulet,Heal=8/cost=75"
	document.game.xitem2.value = 3
	}
	if (randum2 == 4) {
	document.game.item2.value = "Amulet,Heal=10/cost=100"
	document.game.xitem2.value = 4
	}
	if (randum2 == 5) {
	document.game.item2.value = "Iron Armor+2/cost=200"
	document.game.xitem2.value = 5
	}
	if (randum2 == 6) {
	document.game.item2.value = "Skill Book/cost=75"
	document.game.xitem2.value = 6
	}
	if (randum2 == 7) {
	document.game.item2.value = "Basic Book/cost=50"
	document.game.xitem2.value = 7
	}
	if (randum2 == 8) {
	document.game.item2.value = "Strength Pill/cost=300"
	document.game.xitem2.value = 8
	}
	if (randum2 == 9) {
	document.game.item2.value = "Ring of Skill+2/cost=150"
	document.game.xitem2.value = 9
	}
if (yourlevel > 10) {
	if (randum2 == 10) {
	document.game.item2.value = "BALDO's Ring/cost=800"
	document.game.xitem2.value = 10
	}
	if (randum2 == 11) {
	document.game.item2.value = "BALDO'S Amulet/cost=900"
	document.game.xitem2.value = 11
	}
}
}	
//==============store1=================
function buyitem1() {
var theitem = document.game.xitem1.value
var yourmoney = parseFloat(document.game.money.value)
var yourattack = parseFloat(document.game.attackdamage.value)
var yourstuff = document.game.items.value
var yougethit = parseFloat(document.game.armorclass.value)
var yourlife = parseFloat(document.game.life.value)
var swordbonus = parseFloat(document.game.swordbonus.value)
var armorbonus = parseFloat(document.game.armorbonus.value)
var shieldbonus = parseFloat(document.game.shieldbonus.value)
var amuletbonus = parseFloat(document.game.amuletbonus.value)
var ringbonus = parseFloat(document.game.ringbonus.value)
	if (theitem == 1) {
		if (yourmoney > 199) {
		document.game.money.value = yourmoney - 200
		document.game.swordbonus.value = 4
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.items.value = "Magic Sword+3 "
		}
	}
	if (theitem == 2) {
       	if (yourmoney > 74) {
		document.game.money.value = yourmoney - 75
		document.game.shieldbonus.value = 1
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourshield.value = "Shield"
		}
	}
	if (theitem == 3) {
       	if (yourmoney > 149) {
		document.game.money.value = yourmoney - 150
		document.game.shieldbonus.value = 2
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourshield.value = "Iron Shield+2 "
		}
	}
	if (theitem == 4) {
       	if (yourmoney > 84) {
		document.game.money.value = yourmoney - 85
		document.game.shieldbonus.value = 1
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourshield.value = "Shield "
		}
	}
	if (theitem == 5) {
       	if (yourmoney > 39) {
		document.game.money.value = yourmoney - 40
		document.game.life.value = yourlife + 15
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		}
	}
	if (theitem == 6) {
       	if (yourmoney > 199) {
		document.game.money.value = yourmoney - 200
		document.game.shieldbonus.value = 3
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourshield.value = "SuperShield+3 "
		}
	}
	if (theitem == 7) {
       	if (yourmoney > 74) {
		document.game.money.value = yourmoney - 75
		document.game.armorbonus.value = 1
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourarmor.value = "Armor"
		}
	}
	if (theitem == 8) {
       	if (yourmoney > 299) {
		document.game.money.value = yourmoney - 300
		document.game.armorbonus.value = 4
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourarmor.value = "UltimateArmor+4"
		}
	}
	if (theitem == 9) {
       	if (yourmoney > 99) {
		document.game.money.value = yourmoney - 100
		document.game.ringbonus.value = 2
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourring.value = "Ring of Weapon Skill"
		}
	}
	if (theitem == 10) {
       	if (yourmoney > 899) {
		document.game.money.value = yourmoney - 900
		document.game.armorbonus.value = 5
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourarmor.value = "BALDO'S Armor"
		alert("Now you can withstand Baldo's powerful attacks")
		}
	}
	if (theitem == 11) {
		if (yourmoney > 899) {
		document.game.money.value = yourmoney - 900
		document.game.swordbonus.value = 150
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.items.value = "BALDO'S Sword "
		alert("You got BALDO'S Sword!!")
		}
	}
	if (theitem == 12) {
       	if (yourmoney > 899) {
		document.game.money.value = yourmoney - 900
		document.game.shieldbonus.value = 75
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourshield.value = "BALDO'S Shield"
		}
	}
}	
//==========================store2=======
function buyitem2() {
var theitem = document.game.xitem2.value
var yourmoney = parseFloat(document.game.money.value)
var yourattack = parseFloat(document.game.attackdamage.value)
var yougethit = parseFloat(document.game.armorclass.value)
var healpower = parseFloat(document.game.healpower.value)
var yourexperience = parseFloat(document.game.experience.value)
var swordbonus = parseFloat(document.game.swordbonus.value)
var armorbonus = parseFloat(document.game.armorbonus.value)
var shieldbonus = parseFloat(document.game.shieldbonus.value)
var amuletbonus = parseFloat(document.game.amuletbonus.value)
var ringbonus = parseFloat(document.game.ringbonus.value)
	if (theitem == 1) {
		if (yourmoney > 74) {
	document.game.money.value = yourmoney - 75
	document.game.swordbonus.value = 2
	document.game.item2.value = "Bought"
	document.game.xitem2.value = 0
	document.game.items.value = "Sword "
		}
	}
	if (theitem == 2) {
       	if (yourmoney > 149) {
		document.game.money.value = yourmoney - 150
		document.game.shieldbonus.value = 2
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.yourshield.value = "Iron Shield+2 "
		}
	}
		if (theitem == 3) {
       	if (yourmoney > 74) {
		document.game.money.value = yourmoney - 75
		document.game.healpower.value = 8
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.youramulet.value = "Amulet, Heal = 8"
		}
	}
		if (theitem == 4) {
       	if (yourmoney > 99) {
		document.game.money.value = yourmoney - 100
		document.game.healpower.value = 10
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.youramulet.value = "Amulet, Heal = 10"
		}
	}
		if (theitem == 5) {
       	if (yourmoney > 199) {
		document.game.money.value = yourmoney - 200
		document.game.armorbonus.value = 3
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.yourarmor.value = "Iron Armor+2"
		}
	}
		if (theitem == 6) {
       	if (yourmoney > 74) {
		document.game.money.value = yourmoney - 75
		document.game.item2.value = "Bought"
		document.game.experience.value = yourexperience + 65
		alert("You read a book. Gained 50 Experience")
		document.game.xitem2.value = 0
		}
	}
		if (theitem == 7) {
       	if (yourmoney > 49) {
		document.game.money.value = yourmoney - 50
		document.game.item2.value = "Bought"
		document.game.experience.value = yourexperience + 400
		alert("You read a book. Gained 25 Experience")
		document.game.xitem2.value = 0
		}
	}
		if (theitem == 8) {
       	if (yourmoney > 299) {
		document.game.money.value = yourmoney - 300
		document.game.item2.value = "Bought"
		document.game.attackdamage.value = yourattack + 2
		alert("You took a pill. Gained some strength")
		document.game.xitem2.value = 0
		}
	}
		if (theitem == 9) {
       	if (yourmoney > 149) {
		document.game.money.value = yourmoney - 150
		document.game.ringbonus.value = 3
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.yourring.value = "Ring of Skill+2"
		}
	}
		if (theitem == 10) {
       	if (yourmoney > 799) {
		document.game.money.value = yourmoney - 800
		document.game.ringbonus.value = 10
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.yourring.value = "BALDO'S Ring"
		alert("With this powerful item you now have the ability to hit Baldo")
		}
	}
		if (theitem == 11) {
       	if (yourmoney > 999) {
		document.game.money.value = yourmoney - 900
		document.game.healpower.value = 50
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.swordbonus.value = swordbonus + 10
		document.game.shieldbonus.value = shieldbonus + 20
		document.game.youramulet.value = "BALDO'S Amulet"
		alert("This Magical Amulet raises your healpower to 50. It also gives an attack bonus and a shield bonus.")
		}
	}
 }
