//Feel free to use this game on your site just keep a link to me. and email me at dominus54@hotmail.com
// 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 (document.game.enemyattack.value == 11) {
	if (document.game.badlife.value > 1) {
	return false
	}
	}
	if (document.game.enemyattack.value == 49) {
	if (document.game.badlife.value > 1) {
	return false
	}
	}
	if (document.game.enemyattack.value == 30) {
	if (document.game.badlife.value > 1) {
	return false
	}
	}
	if (document.game.enemyattack.value == 61) {
	if (document.game.badlife.value > 1) {
	return false
	}
	}
	if (yourlevel == 1) {
	document.game.storyline.value = "As soon as you leave the gates of your city you are attacked by monsters.  Your guards are frightened because they have never seen creatures like these so you pull out your sword and fight with them.  They remind you of the monsters that were created by the late mad scientist Baldo that you defeated 10 years ago."
	}
if (bigrandum == 18) {
document.game.money.value = Math.round(cash - (cash * .18))
document.game.f2.value = "A monkey stole " + Math.round(cash * .1) + " 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 * .85)
		document.game.f2.value = "Flame damage  " + Math.round(yourlife * .15) + " 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
		document.game.f1.value = "You found a strength pill"
		}
	document.game.life.value = Math.round(yourlife * .80)
	document.game.f2.value = "Radiation damage  " + Math.round(yourlife * .20) + " hit points."
	document.game.badguy.value = "Radiated Mutant Monkey"
	document.game.enemyattack.value = 33
	document.game.enemyarmor.value = 10
	document.game.badlife.value = 200
 	return false
	}
}
if (1 > yourlife) {
	document.game.f1.value = "YOU ARE DEAD"
	document.game.f2.value = "DEAD"
	document.game.experience.value = "DEAD"
	document.game.money.value = 0
	document.bgColor="black"
	return false
}	
	 if (randum == 2) {
	document.game.badguy.value = "Rabid Rabbit"
	document.game.enemyattack.value = 1
	document.game.enemyarmor.value = 8
	document.game.badlife.value = 9
	}
	 if (randum == 3) {
	document.game.badguy.value = "Sick Puppy"
	document.game.enemyattack.value = 2
	document.game.enemyarmor.value = 8
	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 = 10
	}
	if (randum == 5) {
	document.game.badguy.value = "Fat Rabbit"
	document.game.enemyattack.value = 4
	document.game.enemyarmor.value = 8
	document.game.badlife.value = 11
	}
	if (randum == 6) {
	document.game.badguy.value = "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 = 8
	document.game.badlife.value = 10
	}
	if (randum == 8) {
	document.game.badguy.value = "Mutant monkey"
	document.game.enemyattack.value = 2
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 15
	}
	if (randum == 9) {
	document.game.badguy.value = "Infected Monkey"
	document.game.enemyattack.value = 4
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 16
	}
	if (randum == 10) {
	document.game.badguy.value = "Small Child"
	document.game.enemyattack.value = 0
	document.game.enemyarmor.value = 1
	document.game.badlife.value = 3
	}
	if (randum == 11) {
	document.game.badguy.value = "Monkey Shamon"
	document.game.enemyattack.value = 9
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 30
	}
if (yourlevel > 2){
	if (randum == 12) {
	document.game.badguy.value = "Servant"
	document.game.enemyattack.value = 3
	document.game.enemyarmor.value = 3
	document.game.badlife.value = 15
	}
	if (randum == 13) {
	document.game.badguy.value = "Fat Guy"
	document.game.enemyattack.value = 6
	document.game.enemyarmor.value = 3
	document.game.badlife.value = 25
	}
	if (randum == 14) {
	document.game.badguy.value = "Royal Gaurd"
	document.game.enemyattack.value = 7
	document.game.enemyarmor.value = 3
	document.game.badlife.value = 30
	}
	if (randum == 15) {
	document.game.badguy.value = "Soldier"
	document.game.enemyattack.value = 8
	document.game.enemyarmor.value = 3
	document.game.badlife.value = 40
	}
	if (randum == 16) {
	document.game.badguy.value = "Archer"
	document.game.enemyattack.value = 8
	document.game.enemyarmor.value = 3
	document.game.badlife.value = 20
	document.game.life.value = Math.round(yourlife - 4)
	document.game.f2.value = "Arrow damage 4"
	}
}

	if (randum == 17) {
	document.game.badguy.value = "Armed Monkey"
	document.game.enemyattack.value = 6
	document.game.enemyarmor.value = 3
	document.game.badlife.value = 35
	}
	if (randum == 18) {
	document.game.badguy.value = "Heavily armed monkey"
	document.game.enemyattack.value = 9
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 45
	}
	if (randum == 19) {
	document.game.badguy.value = "Shaolin Monkey"
	document.game.enemyattack.value = 14
	document.game.enemyarmor.value = 3
	document.game.badlife.value = 120
	}
	if (randum == 20) {
	document.game.badguy.value = "Drunken Master"
	document.game.enemyattack.value = 18
	document.game.enemyarmor.value = 3
	document.game.badlife.value = 190
	}
	if (randum == 21) {
	document.game.badguy.value = "10Legged Monkey Spider"
	document.game.enemyattack.value = 20
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 210
	}
	if (randum > 22) {
	document.game.badguy.value = "Super High Samurai"
	document.game.enemyattack.value = 5
	document.game.enemyarmor.value = 11
	document.game.badlife.value = 120
	}
	if (randum > 23) {
	document.game.badguy.value = "Brass Monkey"
	document.game.enemyattack.value = 10
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 100
	}
	if (randum == 24) {
	document.game.life.value = yourlife - 3
	document.game.f2.value = "Ouch!! You hit a trap. Lost 3 hit points."
	}
	if (randum == 25) {
	document.game.badguy.value = "Invisible Monkey"
	document.game.enemyattack.value = 6
	document.game.enemyarmor.value = 12
	document.game.badlife.value = 60
	}
	if (randum == 26) {
	document.game.badguy.value = "War Monkey"
	document.game.enemyattack.value = 3
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 150
	}
	if (randum == 27) {
	document.game.money.value = cash + 115
	document.game.f1.value = "You found 115 Gold"
	}
	if (randum == 28) {
	document.game.badguy.value = "Shaolin Monkey"
	document.game.enemyattack.value = 13
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 120
	}
	if (randum == 29)  {
	document.game.badguy.value = "Insane Clown"
	document.game.enemyattack.value = 5
	document.game.enemyarmor.value = 8
	document.game.badlife.value = 140
	}
	if (randum == 30) {
	document.game.badguy.value = "Marshmellow Man"
	document.game.enemyattack.value = 6
	document.game.enemyarmor.value = 8
	document.game.badlife.value = 130
	}
	if (randum == 31) {
	document.game.life.value = Math.round(yourlife * .90)
	document.game.f2.value = "Ouch!! You hit a trap. lost " + Math.round(yourlife * .10) + " hit points."
	}
	if (randum == 32) {
	document.game.badguy.value = "Drunken Master"
	document.game.enemyattack.value = 15
	document.game.enemyarmor.value = 4
	document.game.badlife.value = 180
	}
	if (randum == 33) {
	document.game.badguy.value = "Armed Monkey"
	document.game.enemyattack.value = 10
	document.game.enemyarmor.value = 2
	document.game.badlife.value = 150
	}
	if (randum == 34) {
	document.game.badguy.value = "Insane Clown"
	document.game.enemyattack.value = 20
	document.game.enemyarmor.value = 3
	document.game.badlife.value = 250
	}
	if (randum == 35) {
	document.game.badguy.value = "Heavily Armed Monkey"
	document.game.enemyattack.value = 15
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 130
	}
	if (randum == 36) {
	document.game.badguy.value = "Lizard King"
	document.game.enemyattack.value = 5
	document.game.enemyarmor.value = 12
	document.game.badlife.value = 111
	}
	if (randum == 37) {
	document.game.badguy.value = "Insane Clown"
	document.game.enemyattack.value = 10
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 99
	}
	if (randum == 38) {
	document.game.badguy.value = "Armed Monkey"
	document.game.enemyattack.value = 10
	document.game.enemyarmor.value = 2
	document.game.badlife.value = 100
	}
	if (randum == 39) {
	document.game.badguy.value = "Drunken Master"
	document.game.enemyattack.value = 29
	document.game.enemyarmor.value = 9
	document.game.badlife.value = 200
	}
	if (randum == 40) {
	document.game.life.value = Math.round(yourlife * .90)
	document.game.f2.value = "Ouch!! You hit a trap. Lost " + Math.round(yourlife * .10) + " hit points."
	}
	if (randum == 41) {
	document.game.badguy.value = "Drunken Master"
	document.game.enemyattack.value = 29
	document.game.enemyarmor.value = 9
	document.game.badlife.value = 200
	}
	if (randum == 42) {
	document.game.badguy.value = "Drunken Master"
	document.game.enemyattack.value = 29
	document.game.enemyarmor.value = 9
	document.game.badlife.value = 200
	}
	if (randum == 43) {
	document.game.badguy.value = "Radiated Mutant Monkey"
	document.game.enemyattack.value = 32
	document.game.enemyarmor.value = 10
	document.game.badlife.value = 300
	}
	if (randum == 44) {
	document.game.badguy.value = " Invisible Monkey"
	document.game.enemyattack.value = 20
	document.game.enemyarmor.value = 19
	document.game.badlife.value = 200
	}
	if (randum == 45) {
	document.game.badguy.value = "War Monkey"
	document.game.enemyattack.value = 40
	document.game.enemyarmor.value = 10
	document.game.badlife.value = 400
	}
	if (randum == 46) {
	document.game.badguy.value = " Invisible Monkey"
	document.game.enemyattack.value = 20
	document.game.enemyarmor.value = 19
	document.game.badlife.value = 300
	}
	if (randum == 47) {
	document.game.badguy.value = "Super High Samurai"
	document.game.enemyattack.value = 50
	document.game.enemyarmor.value = 3
	document.game.badlife.value = 400
	}
	if (randum == 48) {
	document.game.badguy.value = "Super High Samurai"
	document.game.enemyattack.value = 50
	document.game.enemyarmor.value = 3
	document.game.badlife.value = 400
	}
	if (randum == 49) {
	document.game.badguy.value = "War Monkey"
	document.game.enemyattack.value = 40
	document.game.enemyarmor.value = 10
	document.game.badlife.value = 350
	}
	
}
//=========================AtttttttacK=======================XXXXXXXXXXXXXXXXXXX
	function attacker() {
	document.game.f1.value = ""
	document.game.f2.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)
	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=====================================XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
if (23 > yourlevel) {
	if (yourexperience > ((yourlevel * 111) + .39 * yourexperience)) {
	document.game.level.value = yourlevel + 1
	document.game.f1.value = "LEVEL UP!!"
	document.game.life.value = yourlife + (10 * yourlevel)
	document.game.attackdamage.value = yourattack + 1
		if (26 > yougethit) {
		document.game.armorclass.value = yougethit + 1
		}
//=============================StoryLine=============================XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXSTORYLINE
	if (yourlevel == 1) {
	document.game.storyline.value = "It has become apparent that this will be a much tougher trip than you expected.  You have only traveled a few miles outside your gate supplies are already low and your soldiers have taken a beating. You decide to go back to your castle and regroup."
	}
	if (yourlevel == 2) {
	document.game.storyline.value = "When you get to the castle the gates are already open. You go inside and find the city infested with monsters.  There is no resistance from your soldiers and it looks like they just let them in.  You spot one and ask what is going on and he attacks you.  An arrow whizzes by your head and you look up at the wall and see your archers firing on you. Even the citizens are attacking.  You decide to head to the treasure room and get Baldo's equipment. Something you had hoped you would never have to use again."
	}
	if (yourlevel == 3) {
	document.game.storyline.value = "You have fought your way to the treasure room.  The doors are already open. You step in and hear a growl behind you. You look back and see your favorite pet. A huge white tiger."
	document.game.badguy.value = "  White Tiger"
	document.game.enemyattack.value = 11
	document.game.enemyarmor.value = 5
	document.game.badlife.value = 100
	}
	if (yourlevel == 4) {
	document.game.storyline.value = "You have been stripped of your kingdom and the last of your soldiers has been killed.  Now you are completely on your own and surrounded by strange beasts, just like when your village was attacked.  Hopefully your friend will know what is going on and be able to help."
	}
	if (yourlevel == 5) {
	document.game.storyline.value = "Finally you arrive at your destination.  After asking several questions in a row the king just tells you not to worry and that he can explain everything. He says he has something to show you and you follow him down several flights of stairs.  You go through a large door and are now on a balcony about ten feet from the ground in a large cave like room. The king claps twice and says that this should explain everything.  Two guards rush in and throw you over the balcony. As soon as you hit the ground monsters attack from all sides."
	}
	if (yourlevel == 6) {
	document.game.storyline.value = "You look up at the balcony and see the king standing there laughing.  KING--I suppose I owe you some answers before you die. All these years and you have never figured it out. Baldo was my son and you killed him.  He was a genuois and you were to stupid to realize it.  Thank you for taking care of his weopons though, to bad you were to stupid to use them. Don't worry about your family they are now my loyal servants along with the rest of your kingdom. I would like to stay here and watch you die but Im very busy, goodbye."
	}
	if (yourlevel == 7) {
	document.game.storyline.value = "You have fought your way across the room. It is to dark to see very well but you feel a cold breeze and follow it to a cave that goes even deeper underground. The entire room smells like rotting carcasses but as you enter the cave the smell becomes overwhelming."
	}
	if (yourlevel == 8) {
	document.game.storyline.value = "After traveling for miles you are exhausted and about to give up and let the monsters overtake you. You hear some loud noises echoing through the cave. It sounds as if a fierce battle is being fought.  You hear a scream that sounds very human and then it gets quiet again."
	}
	if (yourlevel == 9) {
	document.game.storyline.value = "You see a man lying on the ground. He looks badly injured.--WARRIOR--I am Shotokahn. I was this kingdoms fiercest and most loyal warrior. The king threw me in here when I objected to his attacking your country. It is not his fault though, the items you acquired from Baldo were cursed. If any man posses them for to long all his friends will become enemies. He banished Baldo from this Kingdom because he knew he was evil. The demon I was just fighting is the one that granted Baldo his powers. The only way to break the curse is to kill him. Here take my sword it."
		document.game.swordbonus.value = 25
		document.game.items.value = "Shotokahn's Blade+25"
		document.game.badguy.value = "   DEMON"
		document.game.enemyattack.value = 49
		document.game.enemyarmor.value = 5
		document.game.badlife.value = 438
		}
	if (yourlevel == 12) {
	document.game.storyline.value = "You reach the castle and the king looks very happy to see you. --KING-- Thank you for killing that demon. Unfortunately for though I am the one that made the deal with that demon to get my son his powers. It forbade me from having him killed myself. With him out of the way I do not have to repay my debt and nothing stands in my way. Good work Shoto in tricking him into killing the demon. Now kill that fool."
		document.game.badguy.value = "   Shotokahn"
		document.game.enemyattack.value = 30
		document.game.enemyarmor.value = 5
		document.game.badlife.value = 500
	}
	if (yourlevel == 14) {
	document.game.storyline.value = "You find Baldo's Ring in the treasure room. The king must have been in a hurry to leave such an important item. "
	document.game.yourring.value = "BALDO'S Ring"
	document.game.ringbonus.value = 6
	}
	if (yourlevel == 16) {
	document.game.storyline.value = "KING--What a fool to think that you can fight me. You are nothing more than a peasant. You were only able to remain king because I helped you. Now I have no more use for you and because you have harassed me so much you will have the honor of dieing by my own hand."
	document.game.badguy.value = "  The King"
	document.game.enemyattack.value = 61
	document.game.enemyarmor.value = 12
	document.game.badlife.value = 1000
	}
	return false
	}
}
//=========================Hit or Miss============================XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
	if (1 > yourlife) {
	document.game.f1.value = "YOU ARE DEAD"
	document.game.f2.value = "YOU ARE DEAD"
	alert("YOU ARE DEAD")
	document.game.experience.value = 0
	document.game.money.value = 0
	document.bgColor="black"
	document.game.storyline.value = "DEAD"
	return false
	}
		if (enemylife > 0) {
			if (randum > (hegethit - ringbonus)) {
				if (randum == 14) {
				document.game.badlife.value = enemylife - ((yourattack + swordbonus) * 2)
				document.game.f1.value = "Critical Hit!!! you did " + ((yourattack + swordbonus) * 2)  + " points of damage!"
				} else {
				document.game.badlife.value = enemylife - (yourattack + swordbonus)
				document.game.f1.value = "You hit the enemy for " + (yourattack + swordbonus)  + " damage points"
				}
			}
			if (randum1 > (yougethit + armorbonus)) {
			document.game.life.value = yourlife - (enemyattack - shieldbonus) - (2 * yourlevel)
			document.game.f2.value = "You got hit for " + ((enemyattack - shieldbonus) + (2 * yourlevel)) + " hit points"
			}
		}
	// =========================REWARDS =======================================XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
	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)
	document.game.f1.value = "You have defeated your oppenent. You aquired " + (enemyattack * randum) + " gold. And " + (enemyattack * enemyarmor) + " experience"
		if (randum == 15) {
		document.game.life.value = yourlife + 35
		document.game.f2.value = "You Found Magic Beans plus 35 to hitpoints"
      	}
			if (document.game.enemyattack.value == 49) {
			document.game.level.value = yourlevel + 1
			document.game.badguy.value = "DEAD"
			document.game.storyline.value = "After defeating the demon, Shotokahn emmidiatly asks for his sword back. Shotokahn seems to know the caves very well and you quickly fight your way to the surface. Now you head back to the castle to make sure the curse has been lifted."
			document.game.swordbonus.value = 5
		        document.game.items.value = "Sword+5"
			}
			if (document.game.enemyattack.value == 30) {
			document.game.badguy.value = "DEAD"
			document.game.swordbonus.value = 25
		        document.game.items.value = "Shotokahn's Blade+25"
			document.game.storyline.value = "You leave your sword lodged in Shotokahn's chest and take his. Then quickly run after the King."
			}
			if (document.game.enemyattack.value == 61) {
			document.game.badguy.value = "The World is Yours"
			document.game.storyline.value = "You have saved the world from the rule of the evil King.  The curse is broken and you reunite with your family. You gather all of the Baldo's magic items and throw them into a valcano."
			document.bgColor="green"
			document.game.level.value = 1
			document.game.experience.value = 1
			document.game.yourring.value = ""
			document.game.ringbonus.value = 5
			}
			if (document.game.enemyattack.value == 11) {
			document.game.badguy.value = "DEAD"
			document.game.storyline.value = "After killing the tiger you look around the treasure room. The only thing missing is Baldo's magic items. If one person is in possession of all of them it will be impossible to defeat them. Without these items and with the whole city turned against you, you are forced to flee.  You quickly gather what equipment you can, your few remaining loyal soldiers and once again set out for your neighboring kingdom."
			}
		}
}
//==========================HEAL=======================XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
	function heal() {
	var yourlife = parseFloat(document.game.life.value)
	var healpower = parseFloat(document.game.healpower.value)
	if (1 > yourlife) {
	document.game.f1.value = "DEAD"
	document.game.f2.value = "DEAD"
	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 + 10
	}
}
//===========================BUY STUFF======================XXXXXXXXXXXXXXXXXXXXX
//==========store1==============
function buysomethin() {
var yourlife = parseFloat(document.game.life.value)
var yourlevel = parseFloat(document.game.level.value)
var randum2 = Math.round(Math.random() * 21)
var randum = Math.round(Math.random() * 20)
//================store 1 items======
	if (randum == 1) {
	document.game.item1.value = "Katana+7/cost= 290/"
	document.game.xitem1.value = 1
	}
	if (randum == 2) {
	document.game.item1.value = "Shield+2/cost= 100"
	document.game.xitem1.value = 2
	}
	if (randum == 3) {
	document.game.item1.value = "EnhancedShield+3/cost= 220"
	document.game.xitem1.value = 3
	}
	if (randum == 4) {
	document.game.item1.value = "Small Shield/cost= 55"
	document.game.xitem1.value = 2
	}
	if (randum == 5) {
	document.game.item1.value = "Value Meal/cost=50"
	document.game.xitem1.value = 5
	}
	if (randum == 6) {
	document.game.item1.value = "Large Shield+4/cost= 300"
	document.game.xitem1.value = 6
	}
	if (randum == 7) {
	document.game.item1.value = "Iron Armor+3/cost= 200"
	document.game.xitem1.value = 7
	}
	if (randum == 8) {
	document.game.item1.value = "Holy Armor+4/cost= 350"
	document.game.xitem1.value = 8
	}
	if (randum == 9) {
	document.game.item1.value = "Ring of Skill+2/cost=100"
	document.game.xitem1.value = 9
	}

	if (randum == 10) {
	document.game.item1.value = "Dragon Scale Mail+5/cost=900"
	document.game.xitem1.value = 10
	}
	if (randum == 11) {
	document.game.item1.value = "Dragon Blade+15/cost=800"
	document.game.xitem1.value = 11
	}
	if (randum == 12) {
	document.game.item1.value = "Holy Shield+10/cost=1000"
	document.game.xitem1.value = 12
	}
	if (randum == 13) {
	document.game.item1.value = "Gamble/cost=50"
	document.game.xitem1.value = 13
	}
	if (randum == 14) {
	document.game.item1.value = "Gamble/cost=100"
	document.game.xitem1.value = 14
	}
	if (randum == 15) {
	document.game.item1.value = "Scimitar+6/cost=240"
	document.game.xitem1.value = 15
	}
	if (randum == 16) {
	document.game.item1.value = "Cloak/cost=20"
	document.game.xitem1.value = 16
	}
	if (randum == 17) {
	document.game.item1.value = "Axe+3/cost=100"
	document.game.xitem1.value = 17
	}
	if (randum == 18) {
	document.game.item1.value = "Spear+2/cost=80"
	document.game.xitem1.value = 18
	}
	if (randum == 19) {
	document.game.item1.value = "Knife/cost=10"
	document.game.xitem1.value = 19
	}
	if (randum == 20) {
	document.game.item1.value = "Strange Herb"
	document.game.xitem1.value = 20
	}

//===============store2 items==================================================================
	if (randum2 == 1) {
	document.game.item2.value = "Sword+3/cost=100"
	document.game.xitem2.value = 1
	}
	if (randum2 == 2) {
	document.game.item2.value = "Enhanced Shield+3/cost=200"
	document.game.xitem2.value = 2
	}
	if (randum2 == 3) {
	document.game.item2.value = "Healer's Amulet Heal=30/cost=150"
	document.game.xitem2.value = 3
	}
	if (randum2 == 4) {
	document.game.item2.value = "Amulet of Life Heal=40/cost=250"
	document.game.xitem2.value = 4
	}
	if (randum2 == 5) {
	document.game.item2.value = "Ancient Armor+4/cost=350"
	document.game.xitem2.value = 5
	}
	if (randum2 == 6) {
	document.game.item2.value = "Ancient Text/cost=75"
	document.game.xitem2.value = 6
	}
	if (randum2 == 7) {
	document.game.item2.value = "Book/cost=50"
	document.game.xitem2.value = 7
	}
	if (randum2 == 8) {
	document.game.item2.value = "Strength Pill/cost=200"
	document.game.xitem2.value = 8
	}
	if (randum2 == 9) {
	document.game.item2.value = "Ring of Skill+3/cost=250"
	document.game.xitem2.value = 9
	}

	if (randum2 == 10) {
	document.game.item2.value = "Ring of Mastery+5/cost=600"
	document.game.xitem2.value = 10
	}
	if (randum2 == 11) {
	document.game.item2.value = "Amulet of Life/Heal=50/cost=500"
	document.game.xitem2.value = 11
	}
	if (randum2 == 12) {
	document.game.item2.value = "Spirit Sword+4/cost=150"
	document.game.xitem2.value = 12
	}
	if (randum2 == 13) {
	document.game.item2.value = "Spirit Shield+4/cost=250"
	document.game.xitem2.value = 13
	}
	if (randum2 == 14) {
	document.game.item2.value = "Spirit Armor+4/cost=300"
	document.game.xitem2.value = 14
	}
	if (randum2 == 15) {
	document.game.item2.value = "Dagger/cost=10"
	document.game.xitem2.value = 15
	}
	if (randum2 == 16) {
	document.game.item2.value = "BlackTigerHammer/cost=+600"
	document.game.xitem2.value = 16
	}
	if (randum2 == 17) {
	document.game.item2.value = "Battle Axe+8/Cost=350"
	document.game.xitem2.value = 17
	}
	if (randum2 == 18) {
	document.game.item2.value = "Strange Herb"
	document.game.xitem2.value = 18
	}
	if (randum2 == 19) {
	document.game.item2.value = "Strange Herb"
	document.game.xitem2.value = 19
	}
	if (randum2 == 20) {
	document.game.item2.value = "100 Gold "
	document.game.xitem2.value = 20
	}
	if (randum2 == 21) {
	document.game.item2.value = "500 Gold"
	document.game.xitem2.value = 21
	}
}	
//==============store1===========================================================================
function buyitem1() {
var randy = Math.round(Math.random() * 150)
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 > 289) {
	document.game.money.value = yourmoney - 290
	document.game.swordbonus.value = 7
	document.game.item1.value = "Bought"
	document.game.xitem1.value = 0
	document.game.items.value = "Katana+7 "
		}
	}
	if (theitem == 2) {
       	if (yourmoney > 74) {
		document.game.money.value = yourmoney - 100
		document.game.shieldbonus.value = 2
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourshield.value = "Shield+2"
		}
	}
	if (theitem == 3) {
       	if (yourmoney > 219) {
		document.game.money.value = yourmoney - 220
		document.game.shieldbonus.value = 3
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourshield.value = "EnhancedShield+3 "
		}
	}
	if (theitem == 4) {
       	if (yourmoney > 84) {
		document.game.money.value = yourmoney - 55
		document.game.shieldbonus.value = 1
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourshield.value = "Small Shield "
		}
	}
		if (theitem == 5) {
       	if (yourmoney > 49) {
		document.game.money.value = yourmoney - 50
		document.game.life.value = yourlife + 55
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		}
	}
		if (theitem == 6) {
       	if (yourmoney > 299) {
		document.game.money.value = yourmoney - 300
		document.game.shieldbonus.value = 4
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourshield.value = "Large Shield+4 "
		}
	}
		if (theitem == 7) {
       	if (yourmoney > 199) {
		document.game.money.value = yourmoney - 200
		document.game.armorbonus.value = 3
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourarmor.value = "Iron Armor+3"
		}
	}
		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 = "Holy Armor+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+2"
		}
	}
		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 = "Dragon Scale Mail+5"
		}
	}
		if (theitem == 11) {
		if (yourmoney > 799) {
		document.game.money.value = yourmoney - 800
		document.game.swordbonus.value = 15
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.items.value = "Dragon Blade+15 "
		}
	}
		if (theitem == 12) {
       	if (yourmoney > 999) {
		document.game.money.value = yourmoney - 1000
		document.game.shieldbonus.value = 10
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourshield.value = "Holy Shield+10"
		}
	}
		if (theitem == 13) {
       	if (yourmoney > 49) {
		document.game.money.value = (yourmoney + randy) - 50
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.f1.value = "You won " + (randy) + " Gold"
		}
	}
		if (theitem == 14) {
       	if (yourmoney > 99) {
		document.game.money.value = (yourmoney + randy) - 100
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.f1.value = "You won " + (randy) + " Gold"
		}
	}
		if (theitem == 15) {
	if (yourmoney > 239) {
		document.game.money.value = yourmoney - 240
		document.game.swordbonus.value = 6
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.items.value = "Scimitar+6 "
		}
	}
		if (theitem == 16) {
       	if (yourmoney > 19) {
		document.game.money.value = yourmoney - 20
		document.game.armorbonus.value = 1
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.yourarmor.value = "Cloak"
		}
	}
		if (theitem == 17) {
	if (yourmoney > 99) {
		document.game.money.value = yourmoney - 100
		document.game.swordbonus.value = 3
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.items.value = "Axe+3 "
		}
	}
		if (theitem == 18) {
	if (yourmoney > 79) {
		document.game.money.value = yourmoney - 80
		document.game.swordbonus.value = 2
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.items.value = "Spear+2 "
		}
	}
		if (theitem == 19) {
	if (yourmoney > 9) {
		document.game.money.value = yourmoney - 10
		document.game.swordbonus.value = 1
		document.game.item1.value = "Bought"
		document.game.xitem1.value = 0
		document.game.items.value = "Knife "
		}
	}
		if (theitem == 20) {
		document.game.item1.value = "Picked Up"
		document.game.xitem1.value = 0
		document.game.attackdamage.value = yourattack + 2
		document.game.f1.value = "You ate the Herb. It made you fell stronger but stupider. Gain 2 Strength. Lost 50 experience."
				
	}
}	
//==========================store2====================================================
function buyitem2() {
var theitem = document.game.xitem2.value
var yourlife = parseFloat(document.game.life.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 > 99) {
	document.game.money.value = yourmoney - 100
	document.game.swordbonus.value = 3
	document.game.item2.value = "Bought"
	document.game.xitem2.value = 0
	document.game.items.value = "Sword+3"
		}
	}
	if (theitem == 2) {
       	if (yourmoney > 199) {
		document.game.money.value = yourmoney - 200
		document.game.shieldbonus.value = 3
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.yourshield.value = "Enhanced Shield+3 "
		}
	}
		if (theitem == 3) {
       	if (yourmoney > 149) {
		document.game.money.value = yourmoney - 150
		document.game.healpower.value = 30
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.youramulet.value = "Healer's Amulet/Heal = 30"
		}
	}
		if (theitem == 4) {
       	if (yourmoney > 99) {
		document.game.money.value = yourmoney - 250
		document.game.healpower.value = 40
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.youramulet.value = "Amulet 0f Life/Heal = 40"
		}
	}
		if (theitem == 5) {
       	if (yourmoney > 349) {
		document.game.money.value = yourmoney - 350
		document.game.armorbonus.value = 4
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.yourarmor.value = "Ancient Armor+4"
		}
	}
		if (theitem == 6) {
       	if (yourmoney > 74) {
		document.game.money.value = yourmoney - 75
		document.game.item2.value = "Bought"
		document.game.experience.value = yourexperience + 65
		document.game.f1.value = "You read a book. Gained 65 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 + 100
		document.game.f1.value = "You read a book. Gained 100 Experience"
		document.game.xitem2.value = 0
		}
	}
		if (theitem == 8) {
       	if (yourmoney > 199) {
		document.game.money.value = yourmoney - 200
		document.game.item2.value = "Bought"
		document.game.attackdamage.value = yourattack + 3
		document.game.f1.value = "You took a pill. Gained some strength"
		document.game.xitem2.value = 0
		}
	}
		if (theitem == 9) {
       	if (yourmoney > 249) {
		document.game.money.value = yourmoney - 250
		document.game.ringbonus.value = 3
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.yourring.value = "Ring of Weapon Skill+3"
		}
	}
		if (theitem == 10) {
       	if (yourmoney > 599) {
		document.game.money.value = yourmoney - 600
		document.game.ringbonus.value = 5
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.yourring.value = "Ring of Mastery+5"
		}
	}
		if (theitem == 11) {
       	if (yourmoney > 499) {
		document.game.money.value = yourmoney - 500
		document.game.healpower.value = 50
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.life.value = yourlife + 150
		document.game.youramulet.value = "Amulet of Life/Heal=50"
		}
	}
	if (theitem == 12) {
		if (yourmoney > 149) {
	document.game.money.value = yourmoney - 150
	document.game.swordbonus.value = 4
	document.game.item2.value = "Bought"
	document.game.xitem2.value = 0
	document.game.items.value = "Spirit Sword+4"
		}
	}
		if (theitem == 13) {
       	if (yourmoney > 249) {
		document.game.money.value = yourmoney - 250
		document.game.shieldbonus.value = 4
		document.game.item2.value = "Bought"
		document.game.xitem2.value = 0
		document.game.yourshield.value = "Spirit Shield+4 "
		}
	}
		if (theitem == 14) {
       	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 = "Spirit Armor+4"
		}
	}
		if (theitem == 15) {
	if (yourmoney > 9) {
	document.game.money.value = yourmoney - 10
	document.game.swordbonus.value = 1
	document.game.item2.value = "Bought"
	document.game.xitem2.value = 0
	document.game.items.value = "Dagger"
		}
	}
	if (theitem == 16) {
		if (yourmoney > 599) {
	document.game.money.value = yourmoney - 600
	document.game.swordbonus.value = 12
	document.game.item2.value = "Bought"
	document.game.xitem2.value = 0
	document.game.items.value = "Black Tiger Hammer+12"
		}
	}
	if (theitem == 17) {
		if (yourmoney > 349) {
	document.game.money.value = yourmoney - 350
	document.game.swordbonus.value = 8
	document.game.item2.value = "Bought"
	document.game.xitem2.value = 0
	document.game.items.value = "Battle Axe+8"
		}
	}
	if (theitem == 18) {
	document.game.item2.value = "Picked Up"
	document.game.xitem2.value = 0
	document.game.life.value = yourlife + 50
	document.game.attackdamage.value = yourattack + 2
	document.game.f1.value = "You ate the Herb. It made you fell good. Gained 50 life. 2 Strength."
	}
	if (theitem == 19) {
	document.game.item2.value = "Picked Up"
	document.game.xitem2.value = 0
	document.game.life.value = yourlife - 5
	document.game.f1.value = "You ate the Herb it made you sick. Lost 5 life."
	}
	if (theitem == 20) {
	document.game.item2.value = "Picked Up"
	document.game.xitem2.value = 0
	document.game.money.value = yourmoney + 100
	}
	if (theitem == 21) {
	document.game.item2.value = "Picked Up"
	document.game.xitem2.value = 0
	document.game.money.value = yourmoney + 500
	}
 }
