//Copyright 2000 Gudruns' Incitement 18
//Begin Pokemon Object
function Pokemon(name)
{
   this.name = name;
   this.level = 50;
   this.attack = Array(3); 
   this.power = Array(3);
   this.type = Array(1);
   this.status = "OK";
   this.accuracy = 1;
   this.evade = 0;
   this.disabled = new Array(3);
   this.transattack = new Array(3);
   this.transpower = new Array(3);
   for(var nullin = 0; nullin < 4; nullin++)
   {
	this.attack[nullin] = "";
	this.power[nullin] = 0;
	this.disabled[nullin] = 0;
	this.transattack[nullin] = "";
	this.transpower[nullin] = 0;
   }
   this.critical = 0;
   this.confused = 0;
   this.sleep = 0;
   this.scared = 0;
   this.toxic = 0;
   this.charging = 0;
   this.critical = 0;
   this.unhit = 0;
   this.bound = 0;
   this.rested = 0;
   this.armor = 0;
   this.screen = 0;
   this.mist = 0;
   this.leechseed = 0;
   this.mimiced = 0;
   this.substitute = 0;
   this.enraged = 0;
   this.thrashing = 0;
   this.biding = 0;
   this.physdam = 0;
   this.specdam = 0;
   this.curattack = "";
   this.otherattack = "";
   if(this.name == "")
   {
      this.type[0] = "";
      this.type[1] = "";
      this.health = 0;
      this.strength = 0;
      this.defense = 0;
      this.speed = 0;
      this.special = 0;
      this.attack[0] = "";
      this.attack[1] = "";
      this.attack[2] = "";
      this.attack[3] = "";
   }
   if(this.name == "Bulbasaur")
   {
      this.type[0] = "Grass";
      this.type[1] = "Poison";
      this.health = 45;
      this.strength = 49;
      this.defense = 49;
      this.speed = 45;
      this.special = 65;
      this.attack[0] = "Tackle()";
      this.attack[1] = "Growl()";
      this.attack[2] = "LeechSeed()";
      this.attack[3] = "";
   }
   if(this.name == "Ivysaur")
   {
      this.type[0] = "Grass";
      this.type[1] = "Poison";
      this.health = 60;
      this.strength = 62;
      this.defense = 63;
      this.speed = 60;
      this.special = 80;
      this.attack[0] = "Tackle()";
      this.attack[1] = "VineWhip()";
      this.attack[2] = "StunSpore()";
      this.attack[3] = "LeechSeed()";
   }
   if(this.name == "Venusaur")
   {
      this.type[0] = "Grass";
      this.type[1] = "Poison";
      this.health = 80;
      this.strength = 82;
      this.defense = 83;
      this.speed = 80;
      this.special = 100;
      this.attack[0] = "RazorLeaf()";
      this.attack[1] = "SolarBeam()";
      this.attack[2] = "SleepPowder()";
      this.attack[3] = "Growth()";
   }
   if(this.name == "Charmander")
   {
      this.type[0] = "Fire";
      this.type[1] = "";
      this.health = 39;
      this.strength = 52;
      this.defense = 43;
      this.speed = 65;
      this.special = 50;
      this.attack[0] = "Scratch()";
      this.attack[1] = "Growl()";
      this.attack[2] = "Ember()";
      this.attack[3] = "";
   }
   if(this.name == "Charmeleon")
   {
      this.type[0] = "Fire";
      this.type[1] = "";
      this.health = 58;
      this.strength = 64;
      this.defense = 58;
      this.speed = 80;
      this.special = 65;
      this.attack[0] = "Scratch()";
      this.attack[1] = "Rage()";
      this.attack[2] = "Leer()";
      this.attack[3] = "FlameThrower()";
   }
   if(this.name == "Charizard")
   {
      this.type[0] = "Fire";
      this.type[1] = "Flying";
      this.health = 78;
      this.strength = 84;
      this.defense = 79;
      this.speed = 100;
      this.special = 85;
      this.attack[0] = "Slash()";
      this.attack[1] = "FlameThrower()";
      this.attack[2] = "FireSpin()";
      this.attack[3] = "Leer()";
   }
   if(this.name == "Squirtle")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 44;
      this.strength = 48;
      this.defense = 65;
      this.speed = 43;
      this.special = 50;
      this.attack[0] = "Tackle()";
      this.attack[1] = "TailWhip()";
      this.attack[2] = "Bubble()";
      this.attack[3] = "";
   }
   if(this.name == "Wartortle")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 59;
      this.strength = 63;
      this.defense = 80;
      this.speed = 58;
      this.special = 65;
      this.attack[0] = "Bite()";
      this.attack[1] = "WaterGun()";
      this.attack[2] = "TailWhip()";
      this.attack[3] = "Withdraw()";
   }
   if(this.name == "Blastoise")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 79;
      this.strength = 83;
      this.defense = 100;
      this.speed = 78;
      this.special = 85;
      this.attack[0] = "Bite()";
      this.attack[1] = "SkullBash()";
      this.attack[2] = "HydroPump()";
      this.attack[3] = "Withdraw()";
   }
   if(this.name == "Caterpie")
   {
      this.type[0] = "Bug";
      this.type[1] = "";
      this.health = 45;
      this.strength = 30;
      this.defense = 35;
      this.speed = 45;
      this.special = 20;
      this.attack[0] = "Tackle()";
      this.attack[1] = "StringShot()";
      this.attack[2] = "";
      this.attack[3] = "";
   }
   if(this.name == "Metapod")
   {
      this.type[0] = "Bug";
      this.type[1] = "";
      this.health = 50;
      this.strength = 20;
      this.defense = 55;
      this.speed = 30;
      this.special = 25;
      this.attack[0] = "Tackle()";
      this.attack[1] = "StringShot()";
      this.attack[2] = "Harden()";
      this.attack[3] = ""
   }
   if(this.name == "Butterfree")
   {
      this.type[0] = "Bug";
      this.type[1] = "Flying";
      this.health = 60;
      this.strength = 45;
      this.defense = 50;
      this.speed = 70;
      this.special = 80;
      this.attack[0] = "Gust()";
      this.attack[1] = "Psybeam()";
      this.attack[2] = "SuperSonic()";
      this.attack[3] = "SleepPowder()"
   }
   if(this.name == "Weedle")
   {
      this.type[0] = "Bug";
      this.type[1] = "Poison";
      this.health = 40;
      this.strength = 35;
      this.defense = 30;
      this.speed = 50;
      this.special = 20;
      this.attack[0] = "PoisonSting()";
      this.attack[1] = "StringShot()";
      this.attack[2] = "";
      this.attack[3] = "";
   }
   if(this.name == "Kakuna")
   {
      this.type[0] = "Bug";
      this.type[1] = "Poison";
      this.health = 45;
      this.strength = 25;
      this.defense = 50;
      this.speed = 35;
      this.special = 25;
      this.attack[0] = "PoisonSting()";
      this.attack[1] = "StringShot()";
      this.attack[2] = "Harden()";
      this.attack[3] = "";
   }
   if(this.name == "Beedrill")
   {
      this.type[0] = "Bug";
      this.type[1] = "Poison";
      this.health = 65;
      this.strength = 80;
      this.defense = 40;
      this.speed = 75;
      this.special = 45;
      this.attack[0] = "Twineedle()";
      this.attack[1] = "FuryAttack()";
      this.attack[2] = "FocusEnergy()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Pidgey")
   {
      this.type[0] = "Normal";
      this.type[1] = "Flying";
      this.health = 40;
      this.strength = 45;
      this.defense = 40;
      this.speed = 56;
      this.special = 35;
      this.attack[0] = "Gust()";
      this.attack[1] = "SandAttack()";
      this.attack[2] = "QuickAttack()";
      this.attack[3] = "";
   }
   if(this.name == "Pidgeotto")
   {
      this.type[0] = "Normal";
      this.type[1] = "Flying";
      this.health = 63;
      this.strength = 60;
      this.defense = 55;
      this.speed = 71;
      this.special = 1;
      this.attack[0] = "WingAttack()";
      this.attack[1] = "QuickAttack()";
      this.attack[2] = "SandAttack()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Pidgeot")
   {
      this.type[0] = "Normal";
      this.type[1] = "Flying";
      this.health = 83;
      this.strength = 80;
      this.defense = 75;
      this.speed = 91;
      this.special = 70;
      this.attack[0] = "WingAttack()";
      this.attack[1] = "QuickAttack()";
      this.attack[2] = "MirrorMove()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Rattata")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 30;
      this.strength = 56;
      this.defense = 35;
      this.speed = 72;
      this.special = 25;
      this.attack[0] = "QuickAttack()";
      this.attack[1] = "TailAttack()";
      this.attack[2] = "FocusEnergy()";
      this.attack[3] = "";
   }
   if(this.name == "Raticate")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 55;
      this.strength = 81;
      this.defense = 60;
      this.speed = 97;
      this.special = 50;
      this.attack[0] = "HyperFang()";
      this.attack[1] = "SuperFang()";
      this.attack[2] = "QuickAttack()";
      this.attack[3] = "FocusEnergy()";
   }
   if(this.name == "Spearow")
   {
      this.type[0] = "Normal";
      this.type[1] = "Flying";
      this.health = 40;
      this.strength = 60;
      this.defense = 30;
      this.speed = 70;
      this.special = 31;
      this.attack[0] = "Peck()";
      this.attack[1] = "Leer()";
      this.attack[2] = "Growl()";
      this.attack[3] = "";
   }
   if(this.name == "Fearow")
   {
      this.type[0] = "Normal";
      this.type[1] = "Flying";
      this.health = 65;
      this.strength = 90;
      this.defense = 65;
      this.speed = 100;
      this.special = 61;
      this.attack[0] = "DrillPeck()";
      this.attack[1] = "FuryAttack()";
      this.attack[2] = "MirrorMove()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Ekans")
   {
      this.type[0] = "Poison";
      this.type[1] = "";
      this.health = 35;
      this.strength = 60;
      this.defense = 44;
      this.speed = 55;
      this.special = 40;
      this.attack[0] = "Wrap()";
      this.attack[1] = "PoisonSting()";
      this.attack[2] = "Leer()";
      this.attack[3] = "";
   }
   if(this.name == "Arbok")
   {
      this.type[0] = "Poison";
      this.type[1] = "";
      this.health = 60;
      this.strength = 85;
      this.defense = 69;
      this.speed = 80;
      this.special = 65;
      this.attack[0] = "Bite()";
      this.attack[1] = "Acid()";
      this.attack[2] = "Glare()";
      this.attack[3] = "Screech()";
   }
   if(this.name == "Pikachu")
   {
      this.type[0] = "Electric";
      this.type[1] = "";
      this.health = 35;
      this.strength = 55;
      this.defense = 30;
      this.speed = 90;
      this.special = 50;
      this.attack[0] = "QuickAttack()";
      this.attack[1] = "ThunderShock()";
      this.attack[2] = "Growl()";
      this.attack[3] = "";
   }
   if(this.name == "Raichu")
   {
      this.type[0] = "Electric";
      this.type[1] = "";
      this.health = 60;
      this.strength = 90;
      this.defense = 55;
      this.speed = 100;
      this.special = 90;
      this.attack[0] = "Swift()";
      this.attack[1] = "Thunder()";
      this.attack[2] = "ThunderWave()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Sandshrew")
   {
      this.type[0] = "Ground";
      this.type[1] = "";
      this.health = 50;
      this.strength = 75;
      this.defense = 85;
      this.speed = 40;
      this.special = 30;
      this.attack[0] = "Scratch()";
      this.attack[1] = "SandAttack()";
      this.attack[2] = "PoisonSting()";
      this.attack[3] = "";
   }
   if(this.name == "Sandslash")
   {
      this.type[0] = "Ground";
      this.type[1] = "";
      this.health = 75;
      this.strength = 100;
      this.defense = 110;
      this.speed = 65;
      this.special = 55;
      this.attack[0] = "Slash()";
      this.attack[1] = "FurySwipes()";
      this.attack[2] = "Swift()";
      this.attack[3] = "SandAttack()";
   }
   if(this.name == "NidoranF")
   {
      this.type[0] = "Poison";
      this.type[1] = "";
      this.health = 55;
      this.strength = 47;
      this.defense = 52;
      this.speed = 41;
      this.special = 40;
      this.attack[0] = "Scratch()";
      this.attack[1] = "PoisonSting()";
      this.attack[2] = "Growl()";
      this.attack[3] = "";
   }
   if(this.name == "Nidorina")
   {
      this.type[0] = "Poison";
      this.type[1] = "";
      this.health = 70;
      this.strength = 62;
      this.defense = 67;
      this.speed = 56;
      this.special = 55;
      this.attack[0] = "Bite()";
      this.attack[1] = "PoisonSting()";
      this.attack[2] = "TailWhip()";
      this.attack[3] = "Growl()";
   }
   if(this.name == "Nidoqueen")
   {
      this.type[0] = "Poison";
      this.type[1] = "Ground";
      this.health = 90;
      this.strength = 82;
      this.defense = 87;
      this.speed = 76;
      this.special = 75;
      this.attack[0] = "BodySlam()";
      this.attack[1] = "FurySwipes()";
      this.attack[2] = "DoubleKick()";
      this.attack[3] = "TailWhip()";
   }
   if(this.name == "NidoranM")
   {
      this.type[0] = "Poison";
      this.type[1] = "";
      this.health = 46;
      this.strength = 57;
      this.defense = 40;
      this.speed = 50;
      this.special = 40;
      this.attack[0] = "HornAttack()";
      this.attack[1] = "PoisonSting()";
      this.attack[2] = "Leer()";
      this.attack[3] = "";
   }
   if(this.name == "Nidorino")
   {
      this.type[0] = "Poison";
      this.type[1] = "";
      this.health = 61;
      this.strength = 72;
      this.defense = 57;
      this.speed = 65;
      this.special = 55;
      this.attack[0] = "FuryAttack()";
      this.attack[1] = "PoisonSting()";
      this.attack[2] = "FocusEnergy()";
      this.attack[3] = "Leer()";
   }
   if(this.name == "Nidoking")
   {
      this.type[0] = "Poison";
      this.type[1] = "Ground";
      this.health = 81;
      this.strength = 92;
      this.defense = 77;
      this.speed = 85;
      this.special = 75;
      this.attack[0] = "Thrash()";
      this.attack[1] = "DoubleKick()";
      this.attack[2] = "HornDrill()";
      this.attack[3] = "FocusEnergy()";
   }
   if(this.name == "Clefairy")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 70;
      this.strength = 45;
      this.defense = 48;
      this.speed = 35;
      this.special = 60;
      this.attack[0] = "Pound()";
      this.attack[1] = "Sing()";
      this.attack[2] = "Growl()";
      this.attack[3] = "";
   }
   if(this.name == "Clefable")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 95;
      this.strength = 70;
      this.defense = 73;
      this.speed = 60;
      this.special = 85;
      this.attack[0] = "DoubleSlap()";
      this.attack[1] = "Metronome()";
      this.attack[2] = "LightScreen()";
      this.attack[3] = "Minimize()";
   }
   if(this.name == "Vulpix")
   {
      this.type[0] = "Fire";
      this.type[1] = "";
      this.health = 38;
      this.strength = 41;
      this.defense = 40;
      this.speed = 65;
      this.special = 65;
      this.attack[0] = "QuickAttack()";
      this.attack[1] = "Ember()";
      this.attack[2] = "TailWhip()";
      this.attack[3] = "";
   }
   if(this.name == "Ninetales")
   {
      this.type[0] = "Fire";
      this.type[1] = "";
      this.health = 73;
      this.strength = 76;
      this.defense = 75;
      this.speed = 100;
      this.special = 100;
      this.attack[0] = "QuickAttack()";
      this.attack[1] = "FireSpin()";
      this.attack[2] = "FlameThrower()";
      this.attack[3] = "ConfuseRay()";
   }
   if(this.name == "Jigglypuff")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 115;
      this.strength = 45;
      this.defense = 20;
      this.speed = 20;
      this.special = 25;
      this.attack[0] = "DoubleSlap()";
      this.attack[1] = "Sing()";
      this.attack[2] = "Disable()";
      this.attack[3] = "";
   }
   if(this.name == "Wigglytuff")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 140;
      this.strength = 70;
      this.defense = 45;
      this.speed = 45;
      this.special = 50;
      this.attack[0] = "BodySlam()";
      this.attack[1] = "DoubleEdge()";
      this.attack[2] = "Rest()";
      this.attack[3] = "DefenseCurl()";
   }
   if(this.name == "Zubat")
   {
      this.type[0] = "Poison";
      this.type[1] = "Flying";
      this.health = 40;
      this.strength = 45;
      this.defense = 35;
      this.speed = 55;
      this.special = 40;
      this.attack[0] = "Bite()";
      this.attack[1] = "LeechLife()";
      this.attack[2] = "SuperSonic()";
      this.attack[3] = "";
   }
   if(this.name == "Golbat")
   {
      this.type[0] = "Poison";
      this.type[1] = "Flying";
      this.health = 75;
      this.strength = 80;
      this.defense = 70;
      this.speed = 90;
      this.special = 75;
      this.attack[0] = "WingAttack()";
      this.attack[1] = "LeechLife()";
      this.attack[2] = "ConfuseRay()";
      this.attack[3] = "Haze()";
   }
   if(this.name == "Oddish")
   {
      this.type[0] = "Grass";
      this.type[1] = "Poison";
      this.health = 45;
      this.strength = 50;
      this.defense = 55;
      this.speed = 30;
      this.special = 75;
      this.attack[0] = "Absorb()";
      this.attack[1] = "PoisonPowder()";
      this.attack[2] = "StunSpore()";
      this.attack[3] = "";
   }
   if(this.name == "Gloom")
   {
      this.type[0] = "Grass";
      this.type[1] = "Poison";
      this.health = 60;
      this.strength = 65;
      this.defense = 70;
      this.speed = 40;
      this.special = 85;
      this.attack[0] = "Acid()";
      this.attack[1] = "PetalDance()";
      this.attack[2] = "PoisonPowder()";
      this.attack[3] = "SleepPowder()";
   }
   if(this.name == "Vileplume")
   {
      this.type[0] = "Grass";
      this.type[1] = "Poison";
      this.health = 75;
      this.strength = 80;
      this.defense = 85;
      this.speed = 50;
      this.special = 100;
      this.attack[0] = "Acid()";
      this.attack[1] = "PetalDance()";
      this.attack[2] = "SolarBeam()";
      this.attack[3] = "SleepPowder()";
   }
   if(this.name == "Paras")
   {
      this.type[0] = "Bug";
      this.type[1] = "Grass";
      this.health = 35;
      this.strength = 70;
      this.defense = 55;
      this.speed = 25;
      this.special = 55;
      this.attack[0] = "Scratch()";
      this.attack[1] = "LeechLife()";
      this.attack[2] = "StunSpore()";
      this.attack[3] = "";
   }
   if(this.name == "Parasect")
   {
      this.type[0] = "Bug";
      this.type[1] = "Grass";
      this.health = 60;
      this.strength = 95;
      this.defense = 80;
      this.speed = 30;
      this.special = 80;
      this.attack[0] = "Slash()";
      this.attack[1] = "LeechLife()";
      this.attack[2] = "Spore()";
      this.attack[3] = "Growth()";
   }
   if(this.name == "Venonat")
   {
      this.type[0] = "Bug";
      this.type[1] = "Poison";
      this.health = 60;
      this.strength = 55;
      this.defense = 50;
      this.speed = 45;
      this.special = 40;
      this.attack[0] = "Tackle()";
      this.attack[1] = "Disable()";
      this.attack[2] = "PoisonPowder()";
      this.attack[3] = "";
   }
   if(this.name == "Venomoth")
   {
      this.type[0] = "Bug";
      this.type[1] = "Poison";
      this.health = 70;
      this.strength = 65;
      this.defense = 60;
      this.speed = 90;
      this.special = 90;
      this.attack[0] = "LeechLife()";
      this.attack[1] = "Psychic()";
      this.attack[2] = "SuperSonic()";
      this.attack[3] = "SleepPowder()";
   }
   if(this.name == "Diglett")
   {
      this.type[0] = "Ground";
      this.type[1] = "";
      this.health = 10;
      this.strength = 55;
      this.defense = 25;
      this.speed = 95;
      this.special = 45;
      this.attack[0] = "Scratch()";
      this.attack[1] = "Growl()";
      this.attack[2] = "Dig()";
      this.attack[3] = "";
   }
   if(this.name == "Dugtrio")
   {
      this.type[0] = "Ground";
      this.type[1] = "";
      this.health = 35;
      this.strength = 80;
      this.defense = 50;
      this.speed = 120;
      this.special = 70;
      this.attack[0] = "Slash()";
      this.attack[1] = "Earthquake()";
      this.attack[2] = "SandAttack()";
      this.attack[3] = "Growl()";
   }
   if(this.name == "Meowth")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 40;
      this.strength = 45;
      this.defense = 35;
      this.speed = 90;
      this.special = 40;
      this.attack[0] = "Bite()";
      this.attack[1] = "PayDay()";
      this.attack[2] = "Growl()";
      this.attack[3] = "";
   }
   if(this.name == "Persian")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 65;
      this.strength = 70;
      this.defense = 60;
      this.speed = 115;
      this.special = 65;
      this.attack[0] = "Slash()";
      this.attack[1] = "FurySwipes()";
      this.attack[2] = "Screech()";
      this.attack[3] = "Growl()";
   }
   if(this.name == "Psyduck")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 50;
      this.strength = 52;
      this.defense = 48;
      this.speed = 55;
      this.special = 50;
      this.attack[0] = "Scratch()";
      this.attack[1] = "TailWhip()";
      this.attack[2] = "Disable()";
      this.attack[3] = "";
   }
   if(this.name == "Golduck")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 80;
      this.strength = 82;
      this.defense = 78;
      this.speed = 85;
      this.special = 80;
      this.attack[0] = "FurySwipes()";
      this.attack[1] = "HydroPump()";
      this.attack[2] = "Confusion()";
      this.attack[3] = "Disable()";
   }
   if(this.name == "Mankey")
   {
      this.type[0] = "Fighting";
      this.type[1] = "";
      this.health = 40;
      this.strength = 80;
      this.defense = 35;
      this.speed = 70;
      this.special = 35;
      this.attack[0] = "KarateChop()";
      this.attack[1] = "FurySwipes()";
      this.attack[2] = "Leer()";
      this.attack[3] = "";
   }
   if(this.name == "Primeape")
   {
      this.type[0] = "Fighting";
      this.type[1] = "";
      this.health = 65;
      this.strength = 105;
      this.defense = 60;
      this.speed = 95;
      this.special = 60;
      this.attack[0] = "FurySwipes()";
      this.attack[1] = "Thrash()";
      this.attack[2] = "SeismicToss()";
      this.attack[3] = "FocusEnergy()";
   }
   if(this.name == "Growlithe")
   {
      this.type[0] = "Fire";
      this.type[1] = "";
      this.health = 55;
      this.strength = 70;
      this.defense = 45;
      this.speed = 60;
      this.special = 50;
      this.attack[0] = "Bite()";
      this.attack[1] = "Ember()";
      this.attack[2] = "Leer()";
      this.attack[3] = "";
   }
   if(this.name == "Arcanine")
   {
      this.type[0] = "Fire";
      this.type[1] = "";
      this.health = 90;
      this.strength = 110;
      this.defense = 80;
      this.speed = 95;
      this.special = 80;
      this.attack[0] = "TakeDown()";
      this.attack[1] = "FlameThrower()";
      this.attack[2] = "Agility()";
      this.attack[3] = "Leer()";
   }
   if(this.name == "Poliwag")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 40;
      this.strength = 50;
      this.defense = 40;
      this.speed = 90;
      this.special = 40;
      this.attack[0] = "DoubleSlap()";
      this.attack[1] = "Bubble()";
      this.attack[2] = "Hypnosis()";
      this.attack[3] = "";
   }
   if(this.name == "Poliwhirl")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 65;
      this.strength = 65;
      this.defense = 65;
      this.speed = 90;
      this.special = 50;
      this.attack[0] = "DoubleSlap()";
      this.attack[1] = "WaterGun()";
      this.attack[2] = "Hypnosis()";
      this.attack[3] = "Amnesia()";
   }
   if(this.name == "Poliwrath")
   {
      this.type[0] = "Water";
      this.type[1] = "Fighting";
      this.health = 90;
      this.strength = 85;
      this.defense = 95;
      this.speed = 70;
      this.special = 70;
      this.attack[0] = "BodySlam()";
      this.attack[1] = "HydroPump()";
      this.attack[2] = "Hypnosis()";
      this.attack[3] = "Amnesia()";
   }
   if(this.name == "Abra")
   {
      this.type[0] = "Psychic";
      this.type[1] = "";
      this.health = 25;
      this.strength = 20;
      this.defense = 15;
      this.speed = 90;
      this.special = 105;
      this.attack[0] = "Confusion()";
      this.attack[1] = "Disable()";
      this.attack[2] = "";
      this.attack[3] = "";
   }
   if(this.name == "Kadabra")
   {
      this.type[0] = "Psychic";
      this.type[1] = "";
      this.health = 40;
      this.strength = 35;
      this.defense = 30;
      this.speed = 105;
      this.special = 120;
      this.attack[0] = "Psybeam()";
      this.attack[1] = "Kinesis()";
      this.attack[2] = "Disable()";
      this.attack[3] = "Recover()";
   }
   if(this.name == "Alakazam")
   {
      this.type[0] = "Psychic";
      this.type[1] = "";
      this.health = 55;
      this.strength = 50;
      this.defense = 45;
      this.speed = 120;
      this.special = 135;
      this.attack[0] = "Psychic()";
      this.attack[1] = "Recover()";
      this.attack[2] = "Reflect()";
      this.attack[3] = "Kinesis()";
   }
   if(this.name == "Machop")
   {
      this.type[0] = "Fighting";
      this.type[1] = "";
      this.health = 70;
      this.strength = 80;
      this.defense = 50;
      this.speed = 35;
      this.special = 35;
      this.attack[0] = "KarateChop()";
      this.attack[1] = "LowKick()";
      this.attack[2] = "Leer()";
      this.attack[3] = "";
   }
   if(this.name == "Machoke")
   {
      this.type[0] = "Fighting";
      this.type[1] = "";
      this.health = 80;
      this.strength = 100;
      this.defense = 70;
      this.speed = 45;
      this.special = 50;
      this.attack[0] = "LowKick()";
      this.attack[1] = "SeismicToss()";
      this.attack[2] = "FocusEnergy()";
      this.attack[3] = "Leer()";
   }
   if(this.name == "Machamp")
   {
      this.type[0] = "Fighting";
      this.type[1] = "";
      this.health = 90;
      this.strength = 130;
      this.defense = 80;
      this.speed = 55;
      this.special = 65;
      this.attack[0] = "Submission()";
      this.attack[1] = "SeismicToss()";
      this.attack[2] = "FocusEnergy()";
      this.attack[3] = "Leer()";
   }
   if(this.name == "Bellsprout")
   {
      this.type[0] = "Grass";
      this.type[1] = "Poison";
      this.health = 50;
      this.strength = 75;
      this.defense = 35;
      this.speed = 40;
      this.special = 70;
      this.attack[0] = "VineWhip()";
      this.attack[1] = "Wrap()";
      this.attack[2] = "Growth()";
      this.attack[3] = "";
   }
   if(this.name == "Weepinbell")
   {
      this.type[0] = "Grass";
      this.type[1] = "Poison";
      this.health = 65;
      this.strength = 90;
      this.defense = 50;
      this.speed = 55;
      this.special = 85;
      this.attack[0] = "Acid()";
      this.attack[1] = "RazorLeaf()";
      this.attack[2] = "StunSpore()";
      this.attack[3] = "Growth()";
   }
   if(this.name == "Victreebel")
   {
      this.type[0] = "Grass";
      this.type[1] = "Poison";
      this.health = 80;
      this.strength = 105;
      this.defense = 65;
      this.speed = 70;
      this.special = 100;
      this.attack[0] = "Slam()";
      this.attack[1] = "Acid()";
      this.attack[2] = "RazorLeaf()";
      this.attack[3] = "SleepPowder()";
   }
   if(this.name == "Tentacool")
   {
      this.type[0] = "Water";
      this.type[1] = "Poison";
      this.health = 40;
      this.strength = 40;
      this.defense = 35;
      this.speed = 70;
      this.special = 100;
      this.attack[0] = "PoisonSting()";
      this.attack[1] = "SuperSonic()";
      this.attack[2] = "Wrap()";
      this.attack[3] = "";
   }
   if(this.name == "Tentacruel")
   {
      this.type[0] = "Water";
      this.type[1] = "Poison";
      this.health = 80;
      this.strength = 70;
      this.defense = 65;
      this.speed = 100;
      this.special = 120;
      this.attack[0] = "Acid()";
      this.attack[1] = "HydroPump()";
      this.attack[2] = "Screech()";
      this.attack[3] = "Barrier()";
   }
   if(this.name == "Geodude")
   {
      this.type[0] = "Rock";
      this.type[1] = "Ground";
      this.health = 40;
      this.strength = 80;
      this.defense = 100;
      this.speed = 20;
      this.special = 30;
      this.attack[0] = "Tackle()";
      this.attack[1] = "DefenseCurl()";
      this.attack[2] = "RockThrow()";
      this.attack[3] = "";
   }
   if(this.name == "Graveler")
   {
      this.type[0] = "Rock";
      this.type[1] = "Ground";
      this.health = 55;
      this.strength = 95;
      this.defense = 115;
      this.speed = 35;
      this.special = 45;
      this.attack[0] = "Tackle()";
      this.attack[1] = "RockThrow()";
      this.attack[2] = "SelfDestruct()";
      this.attack[3] = "Harden()";
   }
   if(this.name == "Golem")
   {
      this.type[0] = "Rock";
      this.type[1] = "Ground";
      this.health = 80;
      this.strength = 110;
      this.defense = 130;
      this.speed = 45;
      this.special = 55;
      this.attack[0] = "Earthquake()";
      this.attack[1] = "RockThrow()";
      this.attack[2] = "Explosion()";

      this.attack[3] = "Harden()";
   }
   if(this.name == "Ponyta")
   {
      this.type[0] = "Fire";
      this.type[1] = "";
      this.health = 50;
      this.strength = 85;
      this.defense = 55;
      this.speed = 90;
      this.special = 65;
      this.attack[0] = "Stomp()";
      this.attack[1] = "Ember()";
      this.attack[2] = "TailWhip()";
      this.attack[3] = "";
   }
   if(this.name == "Rapidash")
   {
      this.type[0] = "Fire";
      this.type[1] = "";
      this.health = 65;
      this.strength = 100;
      this.defense = 70;
      this.speed = 105;
      this.special = 80;
      this.attack[0] = "Stomp()";
      this.attack[1] = "TakeDown()";
      this.attack[2] = "FireSpin()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Slowpoke")
   {
      this.type[0] = "Water";
      this.type[1] = "Psychic";
      this.health = 90;
      this.strength = 65;
      this.defense = 65;
      this.speed = 15;
      this.special = 40;
      this.attack[0] = "HeadButt()";
      this.attack[1] = "Confusion()";
      this.attack[2] = "Disable()";
      this.attack[3] = "";
   }
   if(this.name == "Slowbro")
   {
      this.type[0] = "Water";
      this.type[1] = "Psychic";
      this.health = 95;
      this.strength = 75;
      this.defense = 110;
      this.speed = 30;
      this.special = 80;
      this.attack[0] = "WaterGun()";
      this.attack[1] = "Psychic()";
      this.attack[2] = "Amnesia()";
      this.attack[3] = "Withdraw()";
   }
   if(this.name == "Magnemite")
   {
      this.type[0] = "Electric";
      this.type[1] = "";
      this.health = 25;
      this.strength = 35;
      this.defense = 70;
      this.speed = 45;
      this.special = 95;
      this.attack[0] = "SonicBoom()";
      this.attack[1] = "ThunderShock()";
      this.attack[2] = "SuperSonic()";
      this.attack[3] = "";
   }
   if(this.name == "Magneton")
   {
      this.type[0] = "Electric";
      this.type[1] = "";
      this.health = 50;
      this.strength = 60;
      this.defense = 95;
      this.speed = 70;
      this.special = 120;
      this.attack[0] = "Swift()";
      this.attack[1] = "ThunderShock()";
      this.attack[2] = "ThunderWave()";
      this.attack[3] = "Screech()";
   }
   if(this.name == "Farfetch\'d")
   {
      this.type[0] = "Normal";
      this.type[1] = "Flying";
      this.health = 52;
      this.strength = 65;
      this.defense = 55;
      this.speed = 60;
      this.special = 58;
      this.attack[0] = "Slash()";
      this.attack[1] = "FuryAttack()";
      this.attack[2] = "SwordsDance()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Doduo")
   {
      this.type[0] = "Normal";
      this.type[1] = "Flying";
      this.health = 35;
      this.strength = 85;
      this.defense = 45;
      this.speed = 75;
      this.special = 35;
      this.attack[0] = "Peck()";
      this.attack[1] = "FuryAttack()";
      this.attack[2] = "Growl()";
      this.attack[3] = "";
   }
   if(this.name == "Dodrio")
   {
      this.type[0] = "Normal";
      this.type[1] = "Flying";
      this.health = 60;
      this.strength = 110;
      this.defense = 70;
      this.speed = 100;
      this.special = 60;
      this.attack[0] = "DrillPeck()";
      this.attack[1] = "TriAttack()";
      this.attack[2] = "Rage()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Seel")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 65;
      this.strength = 45;
      this.defense = 55;
      this.speed = 45;
      this.special = 70;
      this.attack[0] = "HeadButt()";
      this.attack[1] = "AuroraBeam()";
      this.attack[2] = "Growl()";
      this.attack[3] = "";
   }
   if(this.name == "Dewgong")
   {
      this.type[0] = "Water";
      this.type[1] = "Ice";
      this.health = 90;
      this.strength = 70;
      this.defense = 80;
      this.speed = 70;
      this.special = 95;
      this.attack[0] = "TakeDown()";
      this.attack[1] = "IceBeam()";
      this.attack[2] = "Rest()";
      this.attack[3] = "Growl()";
   }
   if(this.name == "Grimer")
   {
      this.type[0] = "Poison";
      this.type[1] = "";
      this.health = 80;
      this.strength = 80;
      this.defense = 50;
      this.speed = 25;
      this.special = 40;
      this.attack[0] = "Pound()";
      this.attack[1] = "Disable()";
      this.attack[2] = "PoisonGas()";
      this.attack[3] = "";
   }
   if(this.name == "Muk")
   {
      this.type[0] = "Poison";
      this.type[1] = "";
      this.health = 105;
      this.strength = 105;
      this.defense = 75;
      this.speed = 50;
      this.special = 65;
      this.attack[0] = "Sludge()";
      this.attack[1] = "AcidArmor()";
      this.attack[2] = "Screech()";
      this.attack[3] = "Minimize()";
   }
   if(this.name == "Shellder")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 30;
      this.strength = 65;
      this.defense = 100;
      this.speed = 40;
      this.special = 45;
      this.attack[0] = "Tackle()";
      this.attack[1] = "Withdraw()";
      this.attack[2] = "SuperSonic()";
      this.attack[3] = "";
   }
   if(this.name == "Cloyster")
   {
      this.type[0] = "Water";
      this.type[1] = "Ice";
      this.health = 50;
      this.strength = 85;
      this.defense = 180;
      this.speed = 70;
      this.special = 85;
      this.attack[0] = "Clamp()";
      this.attack[1] = "SpikeCannon()";
      this.attack[2] = "IceBeam()";
      this.attack[3] = "Leer()";
   }
   if(this.name == "Gastly")
   {
      this.type[0] = "Ghost";
      this.type[1] = "Poison";
      this.health = 30;
      this.strength = 35;
      this.defense = 30;
      this.speed = 80;
      this.special = 100;
      this.attack[0] = "Lick()";
      this.attack[1] = "NightShade()";
      this.attack[2] = "ConfuseRay()";
      this.attack[3] = "";
   }
   if(this.name == "Haunter")
   {
      this.type[0] = "Ghost";
      this.type[1] = "Poison";
      this.health = 45;
      this.strength = 50;
      this.defense = 45;
      this.speed = 95;
      this.special = 115;
      this.attack[0] = "Lick()";
      this.attack[1] = "NightShade()";
      this.attack[2] = "ConfuseRay()";
      this.attack[3] = "Hypnosis()";
   }
   if(this.name == "Gengar")
   {
      this.type[0] = "Ghost";
      this.type[1] = "Poison";
      this.health = 60;
      this.strength = 65;
      this.defense = 60;
      this.speed = 110;
      this.special = 130;
      this.attack[0] = "NightShade()";
      this.attack[1] = "DreamEater()";
      this.attack[2] = "ConfuseRay()";
      this.attack[3] = "Hypnosis()";
   }
   if(this.name == "Onix")
   {
      this.type[0] = "Rock";
      this.type[1] = "Ground";
      this.health = 35;
      this.strength = 45;
      this.defense = 160;
      this.speed = 70;
      this.special = 30;
      this.attack[0] = "Bind()";
      this.attack[1] = "RockThrow()";
      this.attack[2] = "Harden()";
      this.attack[3] = "Screech()";
   }
   if(this.name == "Drowzee")
   {
      this.type[0] = "Psychic";
      this.type[1] = "";
      this.health = 60;
      this.strength = 48;
      this.defense = 45;
      this.speed = 42;
      this.special = 90;
      this.attack[0] = "Pound()";
      this.attack[1] = "Confusion()";
      this.attack[2] = "Hypnosis()";
   }
   if(this.name == "Hypno")
   {
      this.type[0] = "Psychic";
      this.type[1] = "";
      this.health = 85;
      this.strength = 73;
      this.defense = 70;
      this.speed = 67;
      this.special = 115;
      this.attack[0] = "HeadButt()";
      this.attack[1] = "Psychic()";
      this.attack[2] = "Meditate()";
      this.attack[3] = "Hypnosis()";
   }
   if(this.name == "Krabby")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 30;
      this.strength = 105;
      this.defense = 90;
      this.speed = 50;
      this.special = 25;
      this.attack[0] = "ViceGrip()";
      this.attack[1] = "Bubble()";
      this.attack[2] = "Leer()";
      this.attack[3] = "";
   }
   if(this.name == "Kingler")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 55;
      this.strength = 130;
      this.defense = 115;
      this.speed = 75;
      this.special = 50;
      this.attack[0] = "Stomp()";
      this.attack[1] = "CrabHammer()";
      this.attack[2] = "Guillotine()";
      this.attack[3] = "Harden()";
   }
   if(this.name == "Voltorb")
   {
      this.type[0] = "Electric";
      this.type[1] = "";
      this.health = 40;
      this.strength = 30;
      this.defense = 50;
      this.speed = 100;
      this.special = 55;
      this.attack[0] = "SonicBoom()";
      this.attack[1] = "SelfDestruct()";
      this.attack[2] = "Screech()";
      this.attack[3] = "";
   }
   if(this.name == "Electrode")
   {
      this.type[0] = "Electric";
      this.type[1] = "";
      this.health = 60;
      this.strength = 50;
      this.defense = 70;
      this.speed = 140;
      this.special = 80;
      this.attack[0] = "Swift()";
      this.attack[1] = "Explosion()";
      this.attack[2] = "LightScreen()";
      this.attack[3] = "Screech()";
   }
   if(this.name == "Exeggcute")
   {
      this.type[0] = "Grass";
      this.type[1] = "Psychic";
      this.health = 60;
      this.strength = 40;
      this.defense = 80;
      this.speed = 40;
      this.special = 60;
      this.attack[0] = "Barrage()";
      this.attack[1] = "Hypnosis()";
      this.attack[2] = "LeechSeed()";
      this.attack[3] = "";
   }
   if(this.name == "Exeggutor")
   {
      this.type[0] = "Grass";
      this.type[1] = "Psychic";
      this.health = 95;
      this.strength = 95;
      this.defense = 85;
      this.speed = 55;
      this.special = 125;
      this.attack[0] = "Stomp()";
      this.attack[1] = "SolarBeam()";
      this.attack[2] = "SleepPowder()";
      this.attack[3] = "Reflect()";
   }
   if(this.name == "Cubone")
   {
      this.type[0] = "Ground";
      this.type[1] = "";
      this.health = 50;
      this.strength = 50;
      this.defense = 85;
      this.speed = 35;
      this.special = 40;
      this.attack[0] = "BoneClub()";
      this.attack[1] = "Growl()";
      this.attack[2] = "Leer()";
      this.attack[3] = "";
   }
   if(this.name == "Marowak")
   {
      this.type[0] = "Ground";
      this.type[1] = "";
      this.health = 60;
      this.strength = 80;
      this.defense = 110;
      this.speed = 45;
      this.special = 50;
      this.attack[0] = "Bonemerang()";
      this.attack[1] = "Thrash()";
      this.attack[2] = "Rage()";
      this.attack[3] = "FocusEnergy()";
   }
   if(this.name == "Hitmonlee")
   {
      this.type[0] = "Fighting";
      this.type[1] = "";
      this.health = 50;
      this.strength = 120;
      this.defense = 53;
      this.speed = 87;
      this.special = 35;
      this.attack[0] = "MegaKick()";
      this.attack[1] = "HighJumpKick()";
      this.attack[2] = "Meditate()";
      this.attack[3] = "FocusEnergy()";
   }
   if(this.name == "Hitmonchan")
   {
      this.type[0] = "Fighting";
      this.type[1] = "";
      this.health = 50;
      this.strength = 105;
      this.defense = 79;
      this.speed = 76;
      this.special = 35;
      this.attack[0] = "MegaPunch()";
      this.attack[1] = "CometPunch()";
      this.attack[2] = "Counter()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Lickitung")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 90;
      this.strength = 55;
      this.defense = 75;
      this.speed = 30;
      this.special = 60;
      this.attack[0] = "Wrap()";
      this.attack[1] = "Slam()";
      this.attack[2] = "DefenseCurl()";
      this.attack[3] = "Screech()";
   }
   if(this.name == "Koffing")
   {
      this.type[0] = "Poison";
      this.type[1] = "";
      this.health = 40;
      this.strength = 65;
      this.defense = 95;
      this.speed = 35;
      this.special = 60;
      this.attack[0] = "Tackle()";
      this.attack[1] = "Smog()";
      this.attack[2] = "SelfDestruct()";
      this.attack[3] = "";
   }
   if(this.name == "Weezing")
   {
      this.type[0] = "Poison";
      this.type[1] = "";
      this.health = 65;
      this.strength = 90;
      this.defense = 120;
      this.speed = 60;
      this.special = 85;
      this.attack[0] = "Sludge()";
      this.attack[1] = "Explosion()";
      this.attack[2] = "Haze()";
      this.attack[3] = "SmokeScreen()";
   }
   if(this.name == "Rhyhorn")
   {
      this.type[0] = "Rock";
      this.type[1] = "Ground";
      this.health = 80;
      this.strength = 85;
      this.defense = 95;
      this.speed = 25;
      this.special = 30;
      this.attack[0] = "Stomp()";
      this.attack[1] = "FuryAttack()";
      this.attack[2] = "TailWhip()";
      this.attack[3] = "";
   }
   if(this.name == "Rhydon")
   {
      this.type[0] = "Ground";
      this.type[1] = "Rock";
      this.health = 105;
      this.strength = 130;
      this.defense = 120;
      this.speed = 40;
      this.special = 45;
      this.attack[0] = "FuryAttack()";
      this.attack[1] = "TakeDown()";
      this.attack[2] = "HornDrill()";
      this.attack[3] = "Leer()";
   }
   if(this.name == "Chansey")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 250;
      this.strength = 5;
      this.defense = 5;
      this.speed = 50;
      this.special = 105;
      this.attack[0] = "DoubleEdge()";
      this.attack[1] = "DefenseCurl()";
      this.attack[2] = "LightScreen()";
      this.attack[3] = "Minimize()";
   }
   if(this.name == "Tangela")
   {
      this.type[0] = "Grass";
      this.type[1] = "";
      this.health = 65;
      this.strength = 55;
      this.defense = 115;
      this.speed = 60;
      this.special = 100;
      this.attack[0] = "Slam()";
      this.attack[1] = "Absorb()";
      this.attack[2] = "Growth()";
      this.attack[3] = "SleepPowder()";
   }
   if(this.name == "Kangaskhan")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 105;
      this.strength = 95;
      this.defense = 80;
      this.speed = 90;
      this.special = 40;
      this.attack[0] = "DizzyPunch()";
      this.attack[1] = "CometPunch()";
      this.attack[2] = "Rage()";
      this.attack[3] = "Leer()";
   }
   if(this.name == "Horsea")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 30;
      this.strength = 40;
      this.defense = 70;
      this.speed = 60;
      this.special = 70;
      this.attack[0] = "WaterGun()";
      this.attack[1] = "SmokeScreen()";
      this.attack[2] = "Leer()";
      this.attack[3] = "";
   }
   if(this.name == "Seadra")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 55;
      this.strength = 65;
      this.defense = 95;
      this.speed = 85;
      this.special = 95;
      this.attack[0] = "HydroPump()";
      this.attack[1] = "Agility()";
      this.attack[2] = "SmokeScreen()";
      this.attack[3] = "Leer()";
   }
   if(this.name == "Goldeen")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 45;
      this.strength = 67;
      this.defense = 60;
      this.speed = 63;
      this.special = 50;
      this.attack[0] = "Peck()";
      this.attack[1] = "TailWhip()";
      this.attack[2] = "SuperSonic()";
      this.attack[3] = "";
   }
   if(this.name == "Seaking")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 80;
      this.strength = 92;
      this.defense = 65;
      this.speed = 68;
      this.special = 80;
      this.attack[0] = "FuryAttack()";
      this.attack[1] = "Waterfall()";
      this.attack[2] = "HornDrill()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Staryu")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 30;
      this.strength = 45;
      this.defense = 55;
      this.speed = 85;
      this.special = 70;
      this.attack[0] = "Tackle()";
      this.attack[1] = "WaterGun()";
      this.attack[2] = "Harden()";
      this.attack[3] = "";
   }
   if(this.name == "Starmie")
   {
      this.type[0] = "Water";
      this.type[1] = "Psychic";
      this.health = 60;
      this.strength = 75;
      this.defense = 85;
      this.speed = 115;
      this.special = 100;
      this.attack[0] = "Swift()";
      this.attack[1] = "HydroPump()";
      this.attack[2] = "LightScreen()";
      this.attack[3] = "Recover()";
   }
   if(this.name == "Mr.Mime")
   {
      this.type[0] = "Psychic";
      this.type[1] = "";
      this.health = 40;
      this.strength = 45;
      this.defense = 65;
      this.speed = 90;
      this.special = 100;
      this.attack[0] = "DoubleSlap()";
      this.attack[1] = "Confusion()";
      this.attack[2] = "Substitute()";
      this.attack[3] = "Barrier()";
   }
   if(this.name == "Scyther")
   {
      this.type[0] = "Bug";
      this.type[1] = "Flying";
      this.health = 70;
      this.strength = 110;
      this.defense = 80;
      this.speed = 105;
      this.special = 55;
      this.attack[0] = "Slash()";
      this.attack[1] = "SwordsDance()";
      this.attack[2] = "Agility()";
      this.attack[3] = "DoubleTeam()";
   }
   if(this.name == "Jynx")
   {
      this.type[0] = "Ice";
      this.type[1] = "Psychic";
      this.health = 65;
      this.strength = 50;
      this.defense = 35;
      this.speed = 95;
      this.special = 95;
      this.attack[0] = "IcePunch()";
      this.attack[1] = "Blizzard()";
      this.attack[2] = "LovelyKiss()";
      this.attack[3] = "Meditate()";
   }
   if(this.name == "Electabuzz")
   {
      this.type[0] = "Electric";
      this.type[1] = "";
      this.health = 65;
      this.strength = 83;
      this.defense = 57;
      this.speed = 105;
      this.special = 85;
      this.attack[0] = "ThunderPunch()";
      this.attack[1] = "Thunder()";
      this.attack[2] = "Screech()";
      this.attack[3] = "LightScreen()";
   }
   if(this.name == "Magmar")
   {
      this.type[0] = "Fire";
      this.type[1] = "";
      this.health = 65;
      this.strength = 95;
      this.defense = 57;
      this.speed = 93;
      this.special = 85;
      this.attack[0] = "FirePunch()";
      this.attack[1] = "FlameThrower()";
      this.attack[2] = "ConfuseRay()";
      this.attack[3] = "SmokeScreen()";
   }
   if(this.name == "Pinsir")
   {
      this.type[0] = "Bug";
      this.type[1] = "";
      this.health = 65;
      this.strength = 125;
      this.defense = 100;
      this.speed = 85;
      this.special = 55;
      this.attack[0] = "Slash()";
      this.attack[1] = "Guillotine()";
      this.attack[2] = "SwordsDance()";
      this.attack[3] = "Harden()";
   }
   if(this.name == "Tauros")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 75;
      this.strength = 100;
      this.defense = 95;
      this.speed = 110;
      this.special = 70;
      this.attack[0] = "Stomp()";
      this.attack[1] = "TakeDown()";
      this.attack[2] = "Rage()";
      this.attack[3] = "Leer()";
   }
   if(this.name == "Magikarp")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 20;
      this.strength = 10;
      this.defense = 55;
      this.speed = 80;
      this.special = 20;
      this.attack[0] = "Tackle()";
      this.attack[1] = "Splash()";
      this.attack[2] = "";
      this.attack[3] = "";
   }
   if(this.name == "Gyarados")
   {
      this.type[0] = "Water";
      this.type[1] = "Flying";
      this.health = 95;
      this.strength = 125;
      this.defense = 79;
      this.speed = 81;
      this.special = 100;
      this.attack[0] = "HyperBeam()";
      this.attack[1] = "HydroPump()";
      this.attack[2] = "DragonRage()";
      this.attack[3] = "Leer()";
   }
   if(this.name == "Lapras")
   {
      this.type[0] = "Water";
      this.type[1] = "Ice";
      this.health = 130;
      this.strength = 85;
      this.defense = 80;
      this.speed = 60;
      this.special = 95;
      this.attack[0] = "BodySlam()";
      this.attack[1] = "IceBeam()";
      this.attack[2] = "HydroPump()";
      this.attack[3] = "ConfuseRay()";
   }
   if(this.name == "Ditto")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 48;
      this.strength = 48;
      this.defense = 48;
      this.speed = 48;
      this.special = 48;
      this.attack[0] = "Transform()";
      this.attack[1] = "";
      this.attack[2] = "";
      this.attack[3] = "";
   }
   if(this.name == "Eevee")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 55;
      this.strength = 55;
      this.defense = 50;
      this.speed = 55;
      this.special = 65;
      this.attack[0] = "QuickAttack()";
      this.attack[1] = "TakeDown()";
      this.attack[2] = "TailWhip()";
      this.attack[3] = "";
   }
   if(this.name == "Vaporeon")
   {
      this.type[0] = "Water";
      this.type[1] = "";
      this.health = 130;
      this.strength = 65;
      this.defense = 60;
      this.speed = 65;
      this.special = 110;
      this.attack[0] = "Bite()";
      this.attack[1] = "HydroPump()";
      this.attack[2] = "AcidArmor()";
      this.attack[3] = "Mist()";
   }
   if(this.name == "Jolteon")
   {
      this.type[0] = "Electric";
      this.type[1] = "";
      this.health = 65;
      this.strength = 65;
      this.defense = 60;
      this.speed = 130;
      this.special = 110;
      this.attack[0] = "PinMissile()";
      this.attack[1] = "Thunder()";
      this.attack[2] = "ThunderWave()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Flareon")
   {
      this.type[0] = "Fire";
      this.type[1] = "";
      this.health = 65;
      this.strength = 130;
      this.defense = 60;
      this.speed = 65;
      this.special = 110;
      this.attack[0] = "Bite()";
      this.attack[1] = "FireSpin()";
      this.attack[2] = "FlameThrower()";
      this.attack[3] = "FocusEnergy()";
   }
   if(this.name == "Porygon")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 65;
      this.strength = 60;
      this.defense = 70;
      this.speed = 40;
      this.special = 75;
      this.attack[0] = "TriAttack()";
      this.attack[1] = "Psybeam()";
      this.attack[2] = "Recover()";
      this.attack[3] = "Conversion()";
   }
   if(this.name == "Omanyte")
   {
      this.type[0] = "Rock";
      this.type[1] = "Water";
      this.health = 35;
      this.strength = 40;
      this.defense = 100;
      this.speed = 35;
      this.special = 90;
      this.attack[0] = "HornAttack()";
      this.attack[1] = "WaterGun()";
      this.attack[2] = "Withdraw()";
      this.attack[3] = "";
   }
   if(this.name == "Omastar")
   {
      this.type[0] = "Rock";
      this.type[1] = "Water";
      this.health = 70;
      this.strength = 60;
      this.defense = 125;
      this.speed = 55;
      this.special = 115;
      this.attack[0] = "SpikeCannon()";
      this.attack[1] = "HydroPump()";
      this.attack[2] = "Leer()";
      this.attack[3] = "Withdraw()";
   }
   if(this.name == "Kabuto")
   {
      this.type[0] = "Rock";
      this.type[1] = "Water";
      this.health = 30;
      this.strength = 80;
      this.defense = 90;
      this.speed = 55;
      this.special = 45;
      this.attack[0] = "Scratch()";
      this.attack[1] = "Absorb()";
      this.attack[2] = "Harden()";
      this.attack[3] = "";
   }
   if(this.name == "Kabutops")
   {
      this.type[0] = "Rock";
      this.type[1] = "Water";
      this.health = 60;
      this.strength = 115;
      this.defense = 105;
      this.speed = 80;
      this.special = 70;
      this.attack[0] = "Slash()";
      this.attack[1] = "HydroPump()";
      this.attack[2] = "Absorb()";
      this.attack[3] = "Leer()";
   }
   if(this.name == "Aerodactyl")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 105;
      this.strength = 65;
      this.defense = 130;
      this.speed = 60;
      this.special = 2;
      this.attack[0] = "WingAttack()";
      this.attack[1] = "HyperBeam()";
      this.attack[2] = "SuperSonic()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Snorlax")
   {
      this.type[0] = "Normal";
      this.type[1] = "";
      this.health = 160;
      this.strength = 110;
      this.defense = 65;
      this.speed = 30;
      this.special = 65;
      this.attack[0] = "DoubleEdge()";
      this.attack[1] = "HyperBeam()";
      this.attack[2] = "Harden()";
      this.attack[3] = "Rest()";
   }
   if(this.name == "Articuno")
   {
      this.type[0] = "Ice";
      this.type[1] = "Flying";
      this.health = 90;
      this.strength = 85;
      this.defense = 100;
      this.speed = 85;
      this.special = 125;
      this.attack[0] = "Peck()";
      this.attack[1] = "Blizzard()";
      this.attack[2] = "Agility()";
      this.attack[3] = "Mist()";
   }
   if(this.name == "Zapdos")
   {
      this.type[0] = "Electric";
      this.type[1] = "Flying";
      this.health = 90;
      this.strength = 90;
      this.defense = 85;
      this.speed = 100;
      this.special = 125;
      this.attack[0] = "DrillPeck()";
      this.attack[1] = "Thunder()";
      this.attack[2] = "Agility()";
      this.attack[3] = "LightScreen()";
   }
   if(this.name == "Moltres")
   {
      this.type[0] = "Fire";
      this.type[1] = "Flying";
      this.health = 90;
      this.strength = 90;
      this.defense = 85;
      this.speed = 100;
      this.special = 125;
      this.attack[0] = "SkyAttack()";
      this.attack[1] = "FireSpin()";
      this.attack[2] = "Leer()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Dratini")
   {
      this.type[0] = "Dragon";
      this.type[1] = "";
      this.health = 41;
      this.strength = 65;
      this.defense = 45;
      this.speed = 50;
      this.special = 50;
      this.attack[0] = "Wrap()";
      this.attack[1] = "Leer()";
      this.attack[2] = "ThunderWave()";
      this.attack[3] = "";
   }
   if(this.name == "Dragonair")
   {
      this.type[0] = "Dragon";
      this.type[1] = "";
      this.health = 61;
      this.strength = 84;
      this.defense = 65;
      this.speed = 70;
      this.special = 70;
      this.attack[0] = "Slam()";
      this.attack[1] = "Wrap()";
      this.attack[2] = "ThunderWave()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Dragonite")
   {
      this.type[0] = "Dragon";
      this.type[1] = "Flying";
      this.health = 91;
      this.strength = 134;
      this.defense = 95;
      this.speed = 80;
      this.special = 100;
      this.attack[0] = "Slam()";
      this.attack[1] = "HyperBeam()";
      this.attack[2] = "DragonRage()";
      this.attack[3] = "Agility()";
   }
   if(this.name == "Mewtwo")
   {
      this.type[0] = "Psychic";
      this.type[1] = "";
      this.health = 106;
      this.strength = 110;
      this.defense = 90;
      this.speed = 130;
      this.special = 154;
      this.attack[0] = "Swift()";
      this.attack[1] = "Psychic()";
      this.attack[2] = "Recover()";
      this.attack[3] = "Amnesia()";
   }
   if(this.name == "Mew")
   {
      this.type[0] = "Psychic";
      this.type[1] = "";
      this.health = 100;
      this.strength = 100;
      this.defense = 100;
      this.speed = 100;
      this.special = 100;
      this.attack[0] = "MegaPunch()";
      this.attack[1] = "Psychic()";
      this.attack[2] = "Metronome()";
      this.attack[3] = "Transform()";
   }
   this.maxhealth = this.health;
   this.lastlife = this.maxhealth;
   for(var pp = 0; pp < 4; pp++)
	this.power[pp] = getPowerPoints(this.attack[pp]);
   this.basestrength = this.strength;
   this.basedefense = this.defense;
   this.basespeed = this.speed;
   this.basespecial = this.special;
   this.baseaccuracy = this.accuracy;
   this.baseevade = this.evade;
   this.modstrength = 0;
   this.moddefense = 0;
   this.modspeed = 0;
   this.modspecial = 0;
   this.modaccuracy = 0;
   this.modevade = 0;
}
function getPowerPoints(name)
{
   var rval = 0;
   if(name == "Absorb()")
	rval = 20;
   if(name == "Acid()")
	rval = 30;
   if(name == "AcidArmor()")
	rval = 40;
   if(name == "Agility()")
	rval = 30;
   if(name == "Amnesia()")
	rval = 20;
   if(name == "AuroraBeam()")
	rval = 20;
   if(name == "Barrage()")
	rval = 20;
   if(name == "Barrier()")
	rval = 30;
   if(name == "Bide()")
	rval = 10;
   if(name == "Bind()")
	rval = 20;
   if(name == "Bite()")
	rval = 25;
   if(name == "Blizzard()")
	rval = 5;
   if(name == "BodySlam()")
	rval = 15;
   if(name == "BoneClub()")
	rval = 20;
   if(name == "Bonemerang()")
	rval = 20;
   if(name == "Bubble()")
	rval = 30;
   if(name == "BubbleBeam()")
	rval = 20;
   if(name == "Clamp()")
	rval = 10;
   if(name == "CometPunch()")
	rval = 15;
   if(name == "ConfuseRay()")
	rval = 10;
   if(name == "Confusion()")
	rval = 25;
   if(name == "Constrict()")
	rval = 35;
   if(name == "Conversion()")
	rval = 30;
   if(name == "Counter()")
	rval = 20;
   if(name == "Crabhammer()")
	rval = 10;
   if(name == "Cut()")
	rval = 30;
   if(name == "DefenseCurl()")
	rval = 40;
   if(name == "Dig()")
	rval = 10;
   if(name == "Disable()")
	rval = 20;
   if(name == "DizzyPunch()")
	rval = 10;
   if(name == "DoubleEdge()")
	rval = 15;
   if(name == "DoubleKick()")
	rval = 30;
   if(name == "DoubleSlap()")
	rval = 10;
   if(name == "DoubleTeam()")
	rval = 15;
   if(name == "DragonRage()")
	rval = 10;
   if(name == "DreamEater()")
	rval = 15;
   if(name == "DrillPeck()")
	rval = 20;
   if(name == "Earthquake()")
	rval = 10;
   if(name == "EggBomb()")
	rval = 10;
   if(name == "Ember()")
	rval = 25;
   if(name == "Explosion()")
	rval = 5;
   if(name == "FireBlast()")
	rval = 5;
   if(name == "FirePunch()")
	rval = 15;
   if(name == "FireSpin()")
	rval = 15;
   if(name == "Fissure()")
	rval = 5;
   if(name == "FlameThrower()")
	rval = 15;
   if(name == "Flash()")
	rval = 20;
   if(name == "Fly()")
	rval = 15;
   if(name == "FocusEnergy()")
	rval = 30;
   if(name == "FuryAttack()")
	rval = 20;
   if(name == "FurySwipes()")
	rval = 15;
   if(name == "Glare()")
	rval = 30;
   if(name == "Growl()")
	rval = 40;
   if(name == "Growth()")
	rval = 40;
   if(name == "Guillotine()")
	rval = 5;
   if(name == "Gust()")
	rval = 35;
   if(name == "Harden()")
	rval = 30;
   if(name == "Haze()")
	rval = 30;
   if(name == "HeadButt()")
	rval = 15;
   if(name == "HighJumpKick()")
	rval = 20;
   if(name == "HornAttack()")
	rval = 25;
   if(name == "HornDrill()")
	rval = 5;
   if(name == "HydroPump()")
	rval = 5;
   if(name == "HyperBeam()")
	rval = 5;
   if(name == "HyperFang()")
	rval = 15;
   if(name == "Hypnosis()")
	rval = 20;
   if(name == "IceBeam()")
	rval = 10;
   if(name == "IcePunch()")
	rval = 15;
   if(name == "JumpKick()")
	rval = 25;
   if(name == "KarateChop()")
	rval = 25;
   if(name == "Kinesis()")
	rval = 15;
   if(name == "LeechLife()")
	rval = 15;
   if(name == "LeechSeed()")
	rval = 10;
   if(name == "Leer()")
	rval = 30;
   if(name == "Lick()")
	rval = 30;
   if(name == "LovelyKiss()")
	rval = 10;
   if(name == "LightScreen()")
	rval = 30;
   if(name == "LowKick()")
	rval = 20;
   if(name == "Meditate()")
	rval = 40;
   if(name == "MegaDrain()")
	rval = 10;
   if(name == "MegaKick()")
	rval = 5;
   if(name == "MegaPunch()")
	rval = 20;
   if(name == "Metronome()")
	rval = 10;
   if(name == "Mimic()")
	rval = 10;
   if(name == "Minimize()")
	rval = 20;
   if(name == "MirrorMove()")
	rval = 20;
   if(name == "Mist()")
	rval = 30;
   if(name == "NightShade()")
	rval = 15;
   if(name == "PayDay()")
	rval = 20;
   if(name == "Peck()")
	rval = 35;
   if(name == "PetalDance()")
	rval = 20;
   if(name == "PinMissile()")
	rval = 20;
   if(name == "PoisonGas()")
	rval = 40;
   if(name == "PoisonSting()")
	rval = 35;
   if(name == "PoisonPowder()")
	rval = 35;
   if(name == "Pound()")
	rval = 35;
   if(name == "Psybeam()")
	rval = 20;
   if(name == "Psychic()")
	rval = 10;
   if(name == "Psywave()")
	rval = 15;
   if(name == "QuickAttack()")
	rval = 30;
   if(name == "Rage()")
	rval = 20;
   if(name == "RazorLeaf()")
	rval = 25;
   if(name == "RazorWind()")
	rval = 10;
   if(name == "Recover()")
	rval = 20;
   if(name == "Reflect()")
	rval = 20;
   if(name == "Rest()")
	rval = 10;
   if(name == "Roar()")
	rval = 20;
   if(name == "RockSlide()")
	rval = 10;
   if(name == "RockThrow()")
	rval = 15;
   if(name == "RollingKick()")
	rval = 15;
   if(name == "SandAttack()")
	rval = 15;
   if(name == "Scratch()")
	rval = 30;
   if(name == "Screech()")
	rval = 40;
   if(name == "SeismicToss()")
	rval = 20;
   if(name == "SelfDestruct()")
	rval = 5;
   if(name == "Sharpen()")
	rval = 30;
   if(name == "Sing()")
	rval = 15;
   if(name == "SkullBash()")
	rval = 15;
   if(name == "SkyAttack()")
	rval = 5;
   if(name == "Slam()")
	rval = 20;
   if(name == "Slash()")
	rval = 20;
   if(name == "SleepPowder()")
	rval = 15;
   if(name == "Sludge()")
	rval = 20;
   if(name == "Smog()")
	rval = 20;
   if(name == "SmokeScreen()")
	rval = 20;
   if(name == "SoftBoiled()")
	rval = 10;
   if(name == "SolarBeam()")
	rval = 10;
   if(name == "SonicBoom()")
	rval = 20;
   if(name == "SpikeCannon()")
	rval = 15;
   if(name == "Splash()")
	rval = 40;
   if(name == "Spore()")
	rval = 15;
   if(name == "Stomp()")
	rval = 20;
   if(name == "Strength()")
	rval = 15;
   if(name == "StringShot()")
	rval = 40;
   if(name == "StunSpore()")
	rval = 30;
   if(name == "Submission()")
	rval = 25;
   if(name == "Substitute()")
	rval = 10;
   if(name == "SuperFang()")
	rval = 10;
   if(name == "SuperSonic()")
	rval = 20;
   if(name == "Surf()")
	rval = 15;
   if(name == "Swift()")
	rval = 20;
   if(name == "SwordsDance()")
	rval = 30;
   if(name == "Tackle()")
	rval = 35;
   if(name == "TailWhip()")
	rval = 30;
   if(name == "TakeDown()")
	rval = 20;
   if(name == "Teleport()")
	rval = 20;
   if(name == "Thrash()")
	rval = 20;
   if(name == "Thunder()")
	rval = 10;
   if(name == "ThunderBolt()")
	rval = 15;
   if(name == "ThunderPunch()")
	rval = 15;
   if(name == "ThunderShock()")
	rval = 30;
   if(name == "ThunderWave()")
	rval = 20;
   if(name == "Toxic()")
	rval = 10;
   if(name == "Transform()")
	rval = 10;
   if(name == "TriAttack()")
	rval = 10;
   if(name == "Twineedle()")
	rval = 20;
   if(name == "ViceGrip()")
	rval = 30;
   if(name == "VineWhip()")
	rval = 10;
   if(name == "WaterGun()")
	rval = 25;
   if(name == "Waterfall()")
	rval = 15;
   if(name == "WhirlWind()")
	rval = 20;
   if(name == "WingAttack()")
	rval = 35;
   if(name == "Withdraw()")
	rval = 40;
   if(name == "Wrap()")
	rval = 20;
   if(name == "DragonFlare()")
      rval = 15;
   return rval;
}
function revertPokemon(name)
{
   var rval = name;
   if(name == "Ivysaur" || name == "Venusaur")
	rval = "Bulbasaur";
   if(name == "Charmeleon" || name == "Charizard")
	rval = "Charmander";
   if(name == "Wartortle" || name == "Blastoise")
	rval = "Squirtle";
   if(name == "Metapod" || name == "Butterfree")
	rval = "Caterpie";
   if(name == "Kakuna" || name == "Beedrill")
	rval = "Weedle";
   if(name == "Pidgeotto" || name == "Pidgeot")
	rval = "Pidgey";
   if(name == "Raticate")
	rval = "Rattata";
   if(name == "Fearow")
	rval = "Spearow";
   if(name == "Arbok")
	rval = "Ekans";
   if(name == "Raichu")
	rval = "Pikachu";
   if(name == "Sandslash")
	rval = "Sandshrew";
   if(name == "Nidorina" || name == "Nidoqueen")
	rval = "NidoranF";
   if(name == "Nidorino" || name == "Nidoking")
	rval = "NidoranM";
   if(name == "Clefable")
	rval = "Clefairy";
   if(name == "Ninetales")
	rval = "Vulpix";
   if(name == "Wigglytuff")
	rval = "Jigglypuff";
   if(name == "Golbat")
	rval = "Zubat";
   if(name == "Gloom" || name == "Vileplume")
	rval = "Oddish";
   if(name == "Parasect")
	rval = "Paras";
   if(name == "Venomoth")
	rval = "Venonat";
   if(name == "Dugtrio")
	rval = "Diglett";
   if(name == "Persian")
	rval = "Meowth";
   if(name == "Golduck")
	rval = "Psyduck";
   if(name == "Primeape")
	rval = "Mankey";
   if(name == "Arcanine")
	rval = "Growlithe";
   if(name == "Poliwhirl" || name == "Poliwrath")
	rval = "Poliwag";
   if(name == "Kadabra" || name == "Alakazam")
	rval = "Abra";
   if(name == "Machoke" || name == "Machamp")
	rval = "Machop";
   if(name == "Weepinbell" || name == "Victreebel")
	rval = "Bellsprout";
   if(name == "Tentacruel")
	rval = "Tentacool";
   if(name == "Graveler" || name == "Golem")
	rval = "Geodude";
   if(name == "Rapidash")
	rval = "Ponyta";
   if(name == "Slowbro")
	rval = "Slowpoke";
   if(name == "Magneton")
	rval = "Magnemite";
   if(name == "Dodrio")
	rval = "Doduo";
   if(name == "Dewgong")
	rval = "Seel";
   if(name == "Muk")
	rval = "Grimer";
   if(name == "Cloyster")
	rval = "Shelder";
   if(name == "Haunter" || name == "Gengar")
	rval = "Gastly";
   if(name == "Hypno")
	rval = "Drowzee";
   if(name == "Kingler")
	rval = "Krabby";
   if(name == "Electrode")
	rval = "Voltorb";
   if(name == "Exeggutor")
	rval = "Exeggcute";
   if(name == "Marowak")
	rval = "Cubone";
   if(name == "Weezing")
	rval = "Koffing";
   if(name == "Rhydon")
	rval = "Rhyhorn";
   if(name == "Seadra")
	rval = "Horsea";
   if(name == "Seaking")
	rval = "Goldeen";
   if(name == "Starmie")
	rval = "Staryu";
   if(name == "Gyarados")
	rval = "Magikarp";
   if(name == "Vaporeon" || name == "Jolteon" || name == "Flareon")
	rval = "Eevee";
   if(name == "Omastar")
	rval = "Omanyte";
   if(name == "Kabutops")
	rval = "Kabuto";
   if(name == "Dragonair" || name == "Dragonite")
	rval = "Dratini";
   return rval;
}
//Begin Attack List
function Absorb()
{
   message.value+= active[attacker].name + " uses Absorb\n";
   steallife(100, 20, "Grass", "Special", .25);
}
function AcidArmor()
{
   message.value+= active[attacker].name + " uses Acid Armor\n";
   modify(2, attacker, "defense");
}
function Acid()
{
   message.value+= active[attacker].name + " uses Acid\n";
   attackandmod(100, 40, "Poison", "Physical", "defense", -1, 10);
}
function Agility()
{
   message.value+= active[attacker].name + " uses Agility\n";
   modify(2, attacker, "speed");
}
function Amnesia()
{
   message.value+= active[attacker].name + " uses Amnesia\n";
   modify(2, attacker, "special");
}
function AuroraBeam()
{
   message.value+= active[attacker].name + " uses Aurora Beam\n";
   attackandmod(100, 65, "Ice", "Special", "strength", -1, 10);
}
function Barrage()
{
   message.value+= active[attacker].name + " uses Barrage\n";
   rapid(85, 15, "Normal", "Physical");
}
function Barrier()
{
   message.value+= active[attacker].name + " uses Barrier\n";
   modify(2, attacker, "defense");
}
function Bide()
{
   if(active[attacker].biding == 3 || active[attacker].biding == 2 && randomize(2) == 2)
   {
      message.value+= active[attacker].name + " uses Bide\n";
 	instantdamage((active[attacker].lastlife - active[attacker].health) * 2, defender);
      active[attacker].biding = 0;
   }
   else
   {
      message.value+= active[attacker].name + " is storing energy\n";
      active[attacker].biding++;
      active[attacker].curattack = "Bide()";
   }
}
function Bind()
{
   if(active[attacker].bound > 0)
      message.value+= active[attacker].name + "\'s attack continues\n";
   else
      message.value+= active[attacker].name + " uses Bind\n";
   continual(75, 15, "Normal", "Physical");
}
function Bite()
{
   message.value+= active[attacker].name + " uses Bite\n";
   attackandeffect(100, 60, "Normal", "Physical", "Scare", 10);
}
function Blizzard()
{
   message.value+= active[attacker].name + " uses Blizzard\n";
   attackandeffect(90, 120, "Ice", "Special", "Frozen", 10);
}
function BodySlam()
{
   message.value+= active[attacker].name + " uses Body Slam\n";
   attackandeffect(100, 85, "Normal", "Physical", "Paralyzed", 10);
}
function BoneClub()
{
   message.value+= active[attacker].name + " uses BoneClub\n";
   attackandeffect(85, 65, "Ground", "Physical", "Scare", 10);
}
function Bonemerang()
{
   message.value+= active[attacker].name + " uses Bonemerang\n";
   double(90, 50, "Ground", "Physical");
}
function Bubble()
{
   message.value+= active[attacker].name + " uses Bubble\n";
   attackandmod(100, 20, "Water", "Special", "speed", -1, 10);
}
function BubbleBeam()
{
   message.value+= active[attacker].name + " uses Bubble Beam\n";
   attackandmod(100, 65, "Water", "Special", "speed", -1, 10);
}
function Clamp()
{
   if(active[attacker].bound > 0)
      message.value+= active[attacker].name + "\'s attack continues\n";
   else
      message.value+= active[attacker].name + " uses Clamp\n";
   continual(75, 35, "Water", "Special");
}
function CometPunch()
{
   message.value+= active[attacker].name + " uses Comet Punch\n";
   rapid(85, 18, "Normal", "Physical");
}
function ConfuseRay()
{
   message.value+= active[attacker].name + " uses Confuse Ray\n";
   hitandeffect(100, "Confusion");
}
function Confusion()
{
   message.value+= active[attacker].name + " uses Confusion\n";
   attackandeffect(100, 50, "Psychic", "Special", "Confusion", 10);
}
function Constrict()
{
   message.value+= active[attacker].name + " uses Constrict\n";
   attackandmod(100, 10, "Normal", "Physical", "speed", -1, 10);
}
function Conversion()
{
   message.value+= active[attacker].name + " uses Conversion\n" + active[attacker].name + "\'s type changed to that of " + active[defender].name + "\'s\n";
   active[attacker].type[0] = active[defender].type[0];
   active[attacker].type[1] = active[defender].type[1];
}
function Counter()
{
   message.value+= active[attacker].name + " uses Counter\n";
   doubleback(100, "Fighting", "Physical");
}
function CrabHammer()
{
   message.value+= active[attacker].name + " uses Crab Hammer\n";
   highcritical(85, 90, "Water", "Special");
}
function Cut()
{
   message.value+= active[attacker].name + " uses Cut\n";
   single(95, 50, "Normal", "Physical");
}
function DefenseCurl()
{
   message.value+= active[attacker].name + " uses Defense Curl\n";
   modify(1, attacker, "defense");
}
function Dig()
{
   if(active[attacker].charging == 1)
   {
      message.value+= active[attacker].name + " uses Dig\n";
     single(95, 100, "Ground", "Physical");
     active[attacker].charging = 0;
     active[attacker].unhit = 0;
   }
   else
   {
      message.value+= active[attacker].name + " digs underground\n";
      active[attacker].charging = 1;
      active[attacker].unhit = 1;
      if(attacker == 0)
         active[0].curattack = playerinput;
      if(attacker == 1)
         active[1].curattack = aiinput;
   }
}
function Disable()
{
   message.value+= active[attacker].name + " uses Disable\n";
   var dissed = 0;
   for(var discount = 0; discount < 4; discount++)
      if(active[defender].disabled[discount] == 1)
         dissed++;
   if(dissed >= 3)
   {
      message.value+= active[attacker].name + "\'s Disable failed.\n";
   }
   else if(hit(55) == 1)
   {
      var disattack = randomize(4) - 1;
      active[defender].disabled[disattack] = 1;
      message.value+= active[defender].name + "\'s " + active[defender].attack[disattack].substring(0, active[defender].attack[disattack].length - 2) + " attack was disabled\n";
   }
   else
      message.value+= active[attacker].name + "\'s attack missed\n";
}
function DizzyPunch()
{
   message.value+= active[attacker].name + " uses Dizzy Punch\n";
   single(100, 70, "Normal", "Physical");
}
function DoubleEdge()
{
   message.value+= active[attacker].name + " uses Double-Edge\n";
   recoil(100, 100, "Normal", "Physical", .25);
}
function DoubleKick()
{
   message.value+= active[attacker].name + " uses Double Kick\n";
   double(100, 30, "Fighting", "Physical");
}
function DoubleSlap()
{
   message.value+= active[attacker].name + " uses Double Slap\n";
   rapid(85, 15, "Normal", "Physical");
}
function DoubleTeam()
{
   message.value+= active[attacker].name + " uses Double Team\n";
   modify(1, attacker, "evade");
}
function DragonRage()
{
   message.value+= active[attacker].name + " uses Dragon Rage\n";
   hitandinstant(100, 40, "Dragon", "Special");
}
function DreamEater()
{
   message.value+= active[attacker].name + " uses Dream Eater\n";
   if(active[defender].status == "Sleep")
      steallife(100, 100, "Psychic", "Special", .5);
   else
      message.value+= active[attacker].name + "\'s attack missed\n";
}
function DrillPeck()
{
   message.value+= active[attacker].name + " uses Drill Peck\n";
   single(100, 80, "Flying", "Physical");
}
function Earthquake()
{
   message.value+= active[attacker].name + " uses Earth Quake\n";
   single(100, 100, "Ground", "Physical");
}
function EggBomb()
{
   message.value+= active[attacker].name + " uses Egg Bomb\n";
   single(75, 100, "Normal", "Physical");
}
function Ember()
{
   message.value+= active[attacker].name + " uses Ember\n";
   attackandeffect(100, 40, "Fire", "Special", "Burned", 10);
}
function Explosion()
{
   message.value+= active[attacker].name + " uses Explosion\n";
   if(single(100, 340, "Normal", "Physical") > 0)
      instantdamage(active[attacker].health, attacker);
}
function FireBlast()
{
   message.value+= active[attacker].name + " uses Fire Blast\n";
   attackandeffect(85, 120, "Fire", "Special", "Burned", 20);
}
function FirePunch()
{
   message.value+= active[attacker].name + " uses Fire Punch\n";
   attackandeffect(100, 75, "Fire", "Physical", "Burned", 10);
}
function FireSpin()
{
   if(active[attacker].bound > 0)
      message.value+= active[attacker].name + "\'s attack continues\n";
   else
      message.value+= active[attacker].name + " uses Fire Spin\n";
   continual(70, 15, "Fire", "Special");
}
function Fissure()
{
   message.value+= active[attacker].name + " uses Fissure\n";
   killornil(30);
}
function FlameThrower()
{
   message.value+= active[attacker].name + " uses Flame Thrower\n";
   attackandeffect(100, 95, "Fire", "Special", "Burned", 10);
}
function Flash()
{
   message.value+= active[attacker].name + " uses Flash\n";
   enemymod(70, -1, defender, "accuracy");
}
function Fly()
{
   if(active[attacker].charging == 1)
   {
      message.value+= active[attacker].name + " uses Fly\n";
     single(95, 70, "Flying", "Physical");
     active[attacker].charging = 0;
     active[attacker].unhit = 0;
   }
   else
   {
      message.value+= active[attacker].name + " flies high into the air\n";
      active[attacker].charging = 1;
      active[attacker].unhit = 1;
      if(attacker == 0)
         active[0].curattack = playerinput;
      if(attacker == 1)
         active[1].curattack = aiinput;
   }
}
function FocusEnergy()
{
   message.value+= active[attacker].name + " uses Focus Energy\n" + active[attacker].name + "\'s getting pumped\n";
   active[attacker].critical+= 2;
}
function FuryAttack()
{
   message.value+= active[attacker].name + " uses Fury Attack\n";
   rapid(85, 15, "Normal", "Physical");
}
function FurySwipes()
{
   message.value+= active[attacker].name + " uses Fury Swipes\n";
   rapid(80, 18, "Normal", "Physical");
}
function Glare()
{
   message.value+= active[attacker].name + " uses Glare\n";
   hitandeffect(75, "Paralyzed");
}
function Growl()
{
   message.value+= active[attacker].name + " uses Growl\n";
   enemymod(100, -1, defender, "strength");
}
function Growth()
{
   message.value+= active[attacker].name + " uses Growth\n";
   modify(1, attacker, "special");
}
function Guillotine()
{
   message.value+= active[attacker].name + " uses Guillotine\n";
   killornil(30);
}
function Gust()
{
   message.value+= active[attacker].name + " uses Gust\n";
   single(100, 40, "Flying", "Physical");
}
function Harden()
{
   message.value+= active[attacker].name + " uses Harden\n";
   modify(1, attacker, "defense");
}
function Haze()
{
   message.value+= active[attacker].name + " uses Haze\nAll status effect removed\n";
   NullOut(0);
   NullOut(1);
}
function HeadButt()
{
   message.value+= active[attacker].name + " uses Head Butt\n";
   attackandeffect(100, 70, "Normal", "Physical", "Scare", 30);
}
function HighJumpKick()
{
   message.value+= active[attacker].name + " uses High Jump Kick\n";
   missandinjure(90, 85, "Fighting", "Physical", .125);
}
function HornAttack()
{
   message.value+= active[attacker].name + " uses Horn Attack\n";
   single(100, 65, "Normal", "Physical");
}
function HornDrill()
{
   message.value+= active[attacker].name + " uses Horn Drill\n";
   killornil(30);
}
function HydroPump()
{
   message.value+= active[attacker].name + " uses Hydro Pump\n";
   single(80, 120, "Water", "Special");
}
function HyperBeam()
{
   if(active[attacker].charging == 2)
   {
      message.value+= active[attacker].name + " is recharging\n";
      active[attacker].charging = 0;
   }
   else
   {
      message.value+= active[attacker].name + " uses Hyper Beam\n";
      single(90, 150, "Normal", "Physical");
      active[attacker].charging = 2;
      if(attacker == 0)
         active[0].curattack = playerinput;
      if(attacker == 1)
         active[1].curattack = aiinput;
   }
}
function HyperFang()
{
   message.value+= active[attacker].name + " uses Hyper Fang\n";
   attackandeffect(90, 80, "Normal", "Physical", "Scare", 10);
}
function Hypnosis()
{
   message.value+= active[attacker].name + " uses Hypnosis\n";
   hitandeffect(60, "Sleep");
}
function IceBeam()
{
   message.value+= active[attacker].name + " uses Ice Beam\n";
   attackandeffect(100, 95, "Ice", "Special", "Frozen", 10);
}
function IcePunch()
{
   message.value+= active[attacker].name + " uses Ice Punch\n";
   attackandeffect(100, 75, "Ice", "Physical", "Frozen", 10);
}
function JumpKick()
{
   message.value+= active[attacker].name + " uses Jump Kick\n";
   missandinjure(90, 70, "Fighting", "Physical", .125);
}
function KarateChop()
{
   message.value+= active[attacker].name + " uses Karate Chop\n";
   highcritical(100, 50, "Fighting", "Physical");
}
function Kinesis()
{
   message.value+= active[attacker].name + " uses Kinesis\n";
   enemymod(80, -1, defender, "accuracy");
}
function LeechLife()
{
   message.value+= active[attacker].name + " uses Leech Life\n";
   steallife(100, 20, "Bug", "Physical", .25);
}
function LeechSeed()
{
   message.value+= active[attacker].name + " uses Leech Seed\n";
   if(hit(90) == 1)
   {
      message.value+= active[defender].name + " was Seeded\n";
      active[defender].leechseed = 1;
   }
   else
      message.value+= active[attacker].name + "\'s attack missed\n";
}
function Leer()
{
   message.value+= active[attacker].name + " uses Leer\n";
   enemymod(100, -1, defender, "defense");
}
function Lick()
{
   message.value+= active[attacker].name + " uses Lick\n";
   attackandeffect(100, 20, "Ghost", "Physical", "Paralyzed", 30);
}
function LightScreen()
{
   message.value+= active[attacker].name + " uses Light Screen\n";
   active[attacker].screen = 1;
}
function LovelyKiss()
{
   message.value+= active[attacker].name + " uses Lovely Kiss\n";
   hitandeffect(75, "Sleep");
}
function LowKick()
{
   message.value+= active[attacker].name + " uses LowKick\n";
   attackandeffect(90, 50, "Fighting", "Physical", "Scare", 30);
}
function Meditate()
{
   message.value+= active[attacker].name + " uses Meditate\n";
   modify(1, attacker, "strength");
}
function MegaDrain()
{
   message.value+= active[attacker].name + " uses Mega Drain\n";
   steallife(100, 40, "Grass", "Special", .25);
}
function MegaKick()
{
   message.value+= active[attacker].name + " uses MegaKick\n";
   single(75, 120, "Normal", "Physical");
}
function MegaPunch()
{
   message.value+= active[attacker].name + " uses Mega Punch\n";
   single(85, 80, "Normal", "Physical");
}
function Metronome()
{
   var m = randomize(159);
   var r = "";
   if(m == 1) r = "Absorb()";
   if(m == 2) r = "Acid()";
   if(m == 3) r = "AcidArmor()";
   if(m == 4) r = "Acid()";
   if(m == 5) r = "Agility()";
   if(m == 6) r = "Amnesia()";
   if(m == 7) r = "AuroraBeam()";
   if(m == 8) r = "Barrage()";
   if(m == 9) r = "Barrier()";
   if(m == 10) r = "Bide()";
   if(m == 11) r = "Bind()";
   if(m == 12) r = "Bite()";
   if(m == 13) r = "Blizzard()";
   if(m == 14) r = "BodySlam()";
   if(m == 15) r = "BoneClub()";
   if(m == 16) r = "Bonemerang()";
   if(m == 17) r = "Bubble()";
   if(m == 18) r = "BubbleBeam()";
   if(m == 19) r = "Clamp()";
   if(m == 20) r = "CometPunch()";
   if(m == 21) r = "ConfuseRay()";
   if(m == 22) r = "Confusion()";
   if(m == 23) r = "Constrict()";
   if(m == 24) r = "Conversion()";
   if(m == 25) r = "Counter()";
   if(m == 26) r = "CrabHammer()";
   if(m == 27) r = "Cut()";
   if(m == 28) r = "DefenseCurl()";
   if(m == 29) r = "Dig()";
   if(m == 30) r = "Disable()";
   if(m == 31) r = "DizzyPunch()";
   if(m == 32) r = "DoubleEdge()";
   if(m == 33) r = "DoubleKick()";
   if(m == 34) r = "DoubleSlap()";
   if(m == 35) r = "DoubleTeam()";
   if(m == 36) r = "DragonRage()";
   if(m == 37) r = "DreamEater()";
   if(m == 38) r = "DrillPeck()";
   if(m == 39) r = "Earthquake()";
   if(m == 40) r = "EggBomb()";
   if(m == 41) r = "Ember()";
   if(m == 42) r = "Explosion()";
   if(m == 43) r = "FireBlast()";
   if(m == 44) r = "FirePunch()";
   if(m == 45) r = "FireSpin()";
   if(m == 46) r = "Fissure()";
   if(m == 47) r = "FlameThrower()";
   if(m == 48) r = "Flash()";
   if(m == 49) r = "Fly()";
   if(m == 50) r = "FocusEnergy()";
   if(m == 51) r = "FuryAttack()";
   if(m == 52) r = "FurySwipes()";
   if(m == 53) r = "Glare()";
   if(m == 54) r = "Growl()";
   if(m == 55) r = "Growth()";
   if(m == 56) r = "Guillotine()";
   if(m == 57) r = "Gust()";
   if(m == 58) r = "Harden()";
   if(m == 59) r = "Haze()";
   if(m == 60) r = "HeadButt()";
   if(m == 61) r = "HighJumpKick()";
   if(m == 62) r = "HornAttack()";
   if(m == 63) r = "HornDrill()";
   if(m == 64) r = "HydroPump()";
   if(m == 65) r = "HyperBeam()";
   if(m == 66) r = "HyperFang()";
   if(m == 67) r = "Hypnosis()";
   if(m == 68) r = "IceBeam()";
   if(m == 69) r = "IcePunch()";
   if(m == 70) r = "JumpKick()";
   if(m == 71) r = "KarateChop()";
   if(m == 72) r = "LeechLife()";
   if(m == 73) r = "LeechSeed()";
   if(m == 74) r = "Leer()";
   if(m == 75) r = "Lick()";
   if(m == 76) r = "LightScreen()";
   if(m == 77) r = "LovelyKiss()";
   if(m == 78) r = "LowKick()";
   if(m == 79) r = "Meditate()";
   if(m == 80) r = "MegaDrain()";
   if(m == 81) r = "MegaKick()";
   if(m == 82) r = "MegaPunch()";
   if(m == 83) r = "Minimize()";
   if(m == 84) r = "Mist()";
   if(m == 85) r = "NightShade()";
   if(m == 86) r = "PayDay()";
   if(m == 87) r = "Peck()";
   if(m == 88) r = "PetalDance()";
   if(m == 89) r = "PinMissile()";
   if(m == 90) r = "PoisonGas()";
   if(m == 91) r = "PoisonSting()";
   if(m == 92) r = "PoisonPowder()";
   if(m == 93) r = "Pound()";
   if(m == 94) r = "Psybeam()";
   if(m == 95) r = "Psychic()";
   if(m == 96) r = "Psywave()";
   if(m == 97) r = "QuickAttack()";
   if(m == 98) r = "Rage()";
   if(m == 99) r = "RazorLeaf()";
   if(m == 100) r = "RazorWind()";
   if(m == 101) r = "Recover()";
   if(m == 102) r = "Reflect()";
   if(m == 103) r = "Rest()";
   if(m == 104) r = "Roar()";
   if(m == 105) r = "RockSlide()";
   if(m == 106) r = "RockThrow()";
   if(m == 107) r = "RollingKick()";
   if(m == 108) r = "SandAttack()";
   if(m == 109) r = "Scratch()";
   if(m == 110) r = "Screech()";
   if(m == 111) r = "SeismicToss()";
   if(m == 112) r = "SelfDestruct()";
   if(m == 113) r = "Sharpen()";
   if(m == 114) r = "Sing()";
   if(m == 115) r = "SkullBash()";
   if(m == 116) r = "SkyAttack()";
   if(m == 117) r = "Slam()";
   if(m == 118) r = "Slash()";
   if(m == 119) r = "SleepPowder()";
   if(m == 120) r = "Sludge()";
   if(m == 121) r = "Smog()";
   if(m == 122) r = "SmokeScreen()";
   if(m == 123) r = "SoftBoiled()";
   if(m == 124) r = "SolarBeam()";
   if(m == 125) r = "SonicBoom()";
   if(m == 126) r = "SpikeCannon()";
   if(m == 127) r = "Splash()";
   if(m == 128) r = "Spore()";
   if(m == 129) r = "Stomp()";
   if(m == 130) r = "Strength()";
   if(m == 131) r = "StringShot()";
   if(m == 132) r = "StunSpore()";
   if(m == 133) r = "Submission()";
   if(m == 134) r = "Substitute()";
   if(m == 135) r = "SuperFang()";
   if(m == 136) r = "SuperSonic()";
   if(m == 137) r = "Surf()";
   if(m == 138) r = "Swift()";
   if(m == 139) r = "SwordsDance()";
   if(m == 140) r = "Tackle()";
   if(m == 141) r = "TailWhip()";
   if(m == 142) r = "TakeDown()";
   if(m == 143) r = "Thrash()";
   if(m == 144) r = "Thunder()";
   if(m == 145) r = "ThunderWave()";
   if(m == 146) r = "ThunderBolt()";
   if(m == 147) r = "ThunderPunch()";
   if(m == 148) r = "ThunderShock()";
   if(m == 149) r = "Toxic()";
   if(m == 150) r = "Transform()";
   if(m == 151) r = "TriAttack()";
   if(m == 152) r = "Twineedle()";
   if(m == 153) r = "ViceGrip()";
   if(m == 154) r = "VineWhip()";
   if(m == 155) r = "WaterGun()";
   if(m == 156) r = "Waterfall()";
   if(m == 157) r = "WingAttack()";
   if(m == 158) r = "Withdraw()";
   if(m == 159) r = "Wrap()";
   return r;
}
function Mimic()
{
   message.value+= active[attacker].name + " uses Mimic\n";
   for(var getMimic = 0; getMimic < 4; getMimic++)
   {
      if(active[attacker].attack[getMimic] == "Mimic()")
         break;
   }
   if(attacker == 0)
   {
      active[0].mimiced = randomize(4);
   }
   if(attacker == 1)
   {
      active[1].mimiced = randomize(4);
   }
   active[attacker].attack[getMimic] = active[defender].attack[active[attacker].mimiced -1];
   message.value+= active[attacker].name + " mimics " + active[defender].attack[active[attacker].mimiced -1].substring(0, active[defender].attack[active[attacker].mimiced -1].length - 2) + "\n";
}
function Minimize()
{
   message.value+= active[attacker].name + " uses Minimize\n";
   modify(1, attacker, "evade");
}
function MirrorMove()
{
   message.value+= active[attacker].name + " uses MirrorMove\n";
   if(lastattack == "MirrorMove()")
      eval(active[defender].attack[randomize(4) - 1]);
}
function Mist()
{
   message.value+= active[attacker].name + " uses Mist\n";
   active[attacker].mist = 1;
}
function NightShade()
{
   message.value+= active[attacker].name + " uses NightShade\n";
   hitandinstant(90, active[attacker].level, "Ghost", "Physical");
}
function PayDay()
{
   message.value+= active[attacker].name + " uses Pay Day\n";
   if(single(100, 40, "Normal", "Physical") > 0)
   {
	message.value+= "Coins scatter everywhere\n";
      payday+= 50;
   }
}
function Peck()
{
   message.value+= active[attacker].name + " uses Peck\n";
   single(100, 35, "Flying", "Physical");
}
function PetalDance()
{
   if(active[attacker].thrashing == 0)
   {
      message.value+= active[attacker].name + " uses Petal Dance\n";
      active[attacker].curattack = "PetalDance()";
   }
   thrashabout(100, 70, "Grass", "Special");
}
function PoisonGas()
{
   message.value+= active[attacker].name + " uses Poison Gas\n";
   hitandeffect(55, "Poisoned");
}
function PinMissile()
{
   message.value+= active[attacker].name + " uses Pin Missile\n";
   rapid(85, 14, "Bug", "Physical");
}
function PoisonSting()
{
   message.value+= active[attacker].name + " uses Poison Sting\n";
   attackandeffect(100, 15, "Poison", "Physical", "Poisoned", 20);
}
function PoisonPowder()
{
   message.value+= active[attacker].name + " uses Poison Powder\n";
   hitandeffect(75, "Poisoned");
}
function Pound()
{
   message.value+= active[attacker].name + " uses Pound\n";
   single(100, 40, "Normal", "Physical");
}
function Psybeam()
{
   message.value+= active[attacker].name + " uses Psybeam\n";
   attackandeffect(100, 65, "Psychic", "Special", "Confusion", 10);
}
function Psychic()
{
   message.value+= active[attacker].name + " uses Psychic\n";
   attackandmod(100, 90, "Psychic", "Special", "special", -1, 40);
}
function Psywave()
{
   message.value+= active[attacker].name + " uses Psywave\n";
   hitandinstant(80, (randomize(1.5) + 1) * active[attacker].level, "Psychic", "Special");
}
function QuickAttack()
{
   message.value+= active[attacker].name + " uses Quick Attack\n";
   single(100, 40, "Normal", "Physical");
}
function Rage()
{
   if(active[attacker].enraged == 1 && active[attacker].health < active[attacker].lastlife)
   {
      message.value+= active[attacker].name + "\'s Rage is building\n";
      modify(1, attacker, "strength");
   }
   message.value+= active[attacker].name + " uses Rage\n";
   active[attacker].curattack = "Rage()";
   active[attacker].enraged = 1;
   single(100, 20, "Normal", "Physical");
   active[attacker].lastlife = active[attacker].health;
}
function RazorLeaf()
{
   message.value+= active[attacker].name + " uses Razor Leaf\n";
   highcritical(95, 55, "Grass", "Special");
}
function RazorWind()
{
   if(active[attacker].charging == 1)
   {
      message.value+= active[attacker].name + " uses Razor Wind\n";
      single(75, 80, "Normal", "Physical");
      active[attacker].charging = 0;
   }
   else
   {
      message.value+= active[attacker].name + " summons a whirlwind\n";
      active[attacker].charging = 1;
      if(attacker == 0)
         active[0].curattack = playerinput;
      if(attacker == 1)
         active[1].curattack = aiinput;
   }
}
function Recover()
{
   message.value+= active[attacker].name + " uses Recover\n";
   halfheal(attacker);
}
function Reflect()
{
   message.value+= active[attacker].name + " uses Reflect\n";
   active[attacker].armor = 1;
}
function Rest()
{
   message.value+= active[attacker].name + " uses Rest\n" + active[attacker].name + " began to Sleep\n";
   healing(active[attacker].maxhealth, attacker);
   active[attacker].status = "Sleep";
   active[attacker].rested = 2;
}
function RockSlide()
{
   message.value+= active[attacker].name + " uses Rock Slide\n";
   single(90, 75, "Rock", "Physical");
}
function RockThrow()
{
   message.value+= active[attacker].name + " uses Rock Throw\n";
   single(65, 50, "Rock", "Physical");
}
function RollingKick()
{
   message.value+= active[attacker].name + " uses Rolling Kick\n";
   attackandeffect(85, 60, "Fighting", "Physical", "Scare", 30);
}
function SandAttack()
{
   message.value+= active[attacker].name + " uses Sand Attack\n";
   enemymod(100, -1, defender, "accuracy");
}
function Scratch()
{
   message.value+= active[attacker].name + " uses Scratch\n";
   single(100, 40, "Normal", "Physical");
}
function Screech()
{
   message.value+= active[attacker].name + " uses Screech\n";
   enemymod(85, -2, defender, "defense");
}
function SeismicToss()
{
   message.value+= active[attacker].name + " uses Seismic Toss\n";
   hitandinstant(100, active[attacker].level, "Fighting", "Physical");
}
function SelfDestruct()
{
   message.value+= active[attacker].name + " uses Self Destruct\n";
   if(single(100, 260, "Normal", "Physical") > 0)
      instantdamage(active[attacker].health, attacker);
}
function Sharpen()
{
   message.value+= active[attacker].name + " uses Sharpen\n";
   modify(1, attacker, "strength");
}
function Sing()
{
   message.value+= active[attacker].name + " uses Sing\n";
   hitandeffect(55, "Sleep");
}
function SkullBash()
{
   if(active[attacker].charging == 1)
   {
      message.value+= active[attacker].name + " uses Skull Bash\n";
     single(100, 100, "Normal", "Physical");
     active[attacker].charging = 0;
   }
   else
   {
      message.value+= active[attacker].name + " lowers its head\n";
      active[attacker].charging = 1;
      if(attacker == 0)
         active[0].curattack = playerinput;
      if(attacker == 1)
         active[1].curattack = aiinput;
   }
}
function SkyAttack()
{
   if(active[attacker].charging == 1)
   {
      message.value+= active[attacker].name + " uses Sky Attack\n";
      single(90, 140, "Flying", "Physical");
      active[attacker].charging = 0;
   }
   else
   {
      message.value+= active[attacker].name + " is glowing\n";
      active[attacker].charging = 1;
      if(attacker == 0)
         active[0].curattack = playerinput;
      if(attacker == 1)
         active[1].curattack = aiinput;
   }
}
function Slam()
{
   message.value+= active[attacker].name + " uses Slam\n";
   single(75, 80, "Normal", "Physical");
}
function Slash()
{
   message.value+= active[attacker].name + " uses Slash\n";
   highcritical(100, 70, "Normal", "Physical");
}
function SleepPowder()
{
   message.value+= active[attacker].name + " uses Sleep Powder\n";
   hitandeffect(75, "Sleep");
}
function Sludge()
{
   message.value+= active[attacker].name + " uses Sludge\n";
   attackandeffect(100, 65, "Poison", "Physical", "Poisoned", 40);
}
function Smog()
{
   message.value+= active[attacker].name + " uses Smog\n";
   if(single(70, 20, "Poison", "Physical") > 0)
      changestatus("Poisoned");
}
function SmokeScreen()
{
   message.value+= active[attacker].name + " uses Smoke Screen\n";
   enemymod(100, -1, defender, "accuracy");
}
function SoftBoiled()
{
   message.value+= active[attacker].name + " uses Soft Boiled\n";
   halfheal(attacker);
}
function SolarBeam()
{
   if(active[attacker].charging == 1)
   {
      message.value+= active[attacker].name + " uses Solar Beam\n";
      single(100, 120, "Grass", "Special");
      active[attacker].charging = 0;
   }
   else
   {
      message.value+= active[attacker].name + " is gathering light\n";
      active[attacker].charging = 1;
      if(attacker == 0)
         active[0].curattack = playerinput;
      if(attacker == 1)
         active[1].curattack = aiinput;
   }
}
function SonicBoom()
{
   message.value+= active[attacker].name + " uses Sonic Boom\n";
   hitandinstant(90, 20, "Normal", "SonicBoom", "Physical");
}
function SpikeCannon()
{
   message.value+= active[attacker].name + " uses Spike Cannon\n";
   rapid(100, 20, "Normal", "Physical");
}
function Splash()
{
   message.value+= active[attacker].name + " uses Splash\n";
   single(80, 10, "Water", "Special");
}
function Spore()
{
   message.value+= active[attacker].name + " uses Spore\n";
   hitandeffect(100, "Sleep");
}
function Stomp()
{
   message.value+= active[attacker].name + " uses Stomp\n";
   attackandeffect(100, 65, "Normal", "Physical", "Scare", 30);
}
function Strength()
{
   message.value+= active[attacker].name + " uses Strength\n";
   single(100, 80, "Normal", "Physical");
}
function StringShot()
{
   message.value+= active[attacker].name + " uses String Shot\n";
   enemymod(95, -1, defender, "speed");
}
function Struggle()
{
   message.value+= active[attacker].name + " has no choice but to Struggle\n";
   recoil(50, 100, "Normal", "Physical", .25);
}
function StunSpore()
{
   message.value+= active[attacker].name + " uses Stun Spore\n";
   hitandeffect(75, "Paralyzed");
}
function Submission()
{
   message.value+= active[attacker].name + " uses Submission\n";
   recoil(80, 80, "Fighting", "Physical", .25);
}
function Substitute()
{
   if(active[attacker].substitute > 0)
      message.value+= active[attacker].name + " uses Substitute\n" + active[attacker].name + " already has a clone out.\n";
   else if(active[attacker].health - Math.floor(active[attacker].maxhealth * .25) > 0)
   {
      message.value+= active[attacker].name + " uses Substitute\n" + active[attacker].name + " sent out a clone\n";
      instantdamage(Math.floor(active[attacker].maxhealth * .25), attacker);
      active[attacker].substitute = Math.ceil(active[attacker].maxhealth * .25);
   }
   else
      message.value+= active[attacker].name + " uses Substitute\n" + active[attacker].name + " didn't have enough energy to create a clone.\n";
}
function SuperFang()
{
   message.value+= active[attacker].name + " uses Super Fang\n";
   hitandinstant(90, active[defender].health * .5, "Normal", "Physical");
}
function SuperSonic()
{
   message.value+= active[attacker].name + " uses Super Sonic\n";
   hitandeffect(55, "Confusion");
}
function Surf()
{
   message.value+= active[attacker].name + " uses Surf\n";
   single(100, 95, "Water", "Special");
}
function Swift()
{
   message.value+= active[attacker].name + " uses Swift\n";
   damage(60, "Normal", "Physical");
}
function SwordsDance()
{
   message.value+= active[attacker].name + " uses Swords Dance\n";
   modify(2, attacker, "strength");
}
function Tackle()
{
   message.value+= active[attacker].name + " uses Tackle\n";
   single(95, 35, "Normal", "Physical");
}
function TailWhip()
{
   message.value+= active[attacker].name + " uses Tail Whip\n";
   enemymod(100, -1, defender, "defense");
}
function TakeDown()
{
   message.value+= active[attacker].name + " uses Take Down\n";
   recoil(85, 90, "Normal", "Physical", .25);
}
function Thrash()
{
   if(active[attacker].thrashing == 0)
   {
      message.value+= active[attacker].name + " uses Thrash\n";
      active[attacker].curattack = "Thrash()";
   }
   thrashabout(100, 90, "Normal", "Physical");
}
function Thunder()
{
   message.value+= active[attacker].name + " uses Thunder\n";
   attackandeffect(70, 120, "Electric", "Special", "Paralyzed", 10);
}
function ThunderWave()
{
   message.value+= active[attacker].name + " uses Thunder Wave\n";
   if(active[defender].type[0] != "Ground" && active[defender].type[1] != "Ground")
      hitandeffect(100, "Paralyzed");
   else
      message.value+= "The attack had no effect\n";
}
function ThunderBolt()
{
   message.value+= active[attacker].name + " uses Thunder Bolt\n";
   attackandeffect(100, 95, "Electric", "Special", "Paralyzed", 10);
}
function ThunderPunch()
{
   message.value+= active[attacker].name + " uses Thunder Punch\n";
   attackandeffect(100, 75, "Electric", "Special", "Paralyzed", 10);
}
function ThunderShock()
{
   message.value+= active[attacker].name + " uses Thunder Shock\n";
   attackandeffect(100, 40, "Electric", "Special", "Paralyzed", 10);
}
function Toxic()
{
   message.value+= active[attacker].name + " uses Toxic\n";
   hitandeffect(85, "Toxiced");
}
function Transform()
{
   message.value+= active[attacker].name + " uses Transform\n";
   for(var trans = 0; trans < 4; trans++)
   {
	active[attacker].transattack[trans] = active[attacker].attack[trans];
	active[attacker].transpower[trans] = active[attacker].power[trans];
	active[attacker].attack[trans] = active[defender].attack[trans];
	active[attacker].power[trans] = 5;
   }
   active[attacker].strength = active[defender].strength;
   active[attacker].defense = active[defender].defense;
   active[attacker].speed = active[defender].speed;
   active[attacker].special= active[defender].special;
   active[attacker].basestrength = active[defender].basestrength;
   active[attacker].basedefense = active[defender].basedefense;
   active[attacker].basespeed = active[defender].basespeed;
   active[attacker].basespecial= active[defender].basespecial;
   active[attacker].accuracy = active[defender].accuracy;
   active[attacker].evade = active[defender].evade;
   active[attacker].baseaccuracy = active[defender].basespeed;
   active[attacker].baseevade= active[defender].basespecial;
   active[attacker].type[0] = active[defender].type[0];
   active[attacker].type[1] = active[defender].type[1];
   SetBattleField(attacker, current[attacker]);
   if(attacker == 0)
   {
	if(active[defender].name == "Farfetch\'d")
	   pokepic0.src = "Farfetchd.jpg";
	else
         pokepic0.src = active[defender].name + ".jpg";
   }
   if(attacker == 1)
   {
	if(active[defender].name == "Farfetch\'d")
	   pokepic1.src = "Farfetchd.jpg";
	else
         pokepic1.src = active[defender].name + ".jpg";
   }
}
function TriAttack()
{
   message.value+= active[attacker].name + " uses TriAttack\n";
   single(100, 80, "Normal", "Physical");
}
function Twineedle()
{
   message.value+= active[attacker].name + " uses Twineedle\n";
   if(double(100, 25, "Bug", "Physical") > 0)
      statuseffect("Poisoned", 20);
}
function ViceGrip()
{
   message.value+= active[attacker].name + " uses Vice Grip\n";
   single(100, 55, "Normal", "Physical");
}
function VineWhip()
{
   message.value+= active[attacker].name + " uses Vine Whip\n";
   single(100, 35, "Grass", "Special");
}
function WaterGun()
{
   message.value+= active[attacker].name + " uses Water Gun\n";
   single(100, 40, "Water", "Special");
}
function Waterfall()
{
   message.value+= active[attacker].name + " uses Waterfall\n";
   single(100, 80, "Water", "Special");
}
function WingAttack()
{
   message.value+= active[attacker].name + " uses Wing Attack\n";
   single(100, 60, "Flying", "Physical");
}
function Withdraw()
{
   message.value+= active[attacker].name + " uses Withdraw\n";
   modify(1, attacker, "defense");
}
function Wrap()
{
   if(active[attacker].bound > 0)
      message.value+= active[attacker].name + "\'s attack continues\n";
   else
      message.value+= active[attacker].name + " uses Wrap\n";
   continual(85, 15, "Normal", "Physical");
}
//Begin Made Up Attacks
function DragonFlare()
{
   message.value+= active[attacker].name + " uses Dragon Flare\n";
   attackandeffect(90, 80, "Dragon", "Physical", "Burned", 10);
}
//Begin Attack Skeletons
function statuseffect(effect, chance)
{
   if(randomize(100) <= chance)
      changestatus(effect);
}
function changestatus(effect)
{
   if(effect == "Confusion")
   {
      active[defender].confused = 4;
      message.value+= active[defender].name + " became Confused\n";
   }
   else if(effect == "Scare")
   {
      active[defender].scared = 1;
   }
   else
   {
      if(active[defender].status != "OK")
         return 0;
      if((active[defender].type[0] == "Poison" || active[defender].type[1] == "Poison") && (effect == "Poisoned" || effect == "Toxiced"))
         return 0;
      if(active[defender].substitute > 0)
         return 0;
      active[defender].status = effect;
	if(effect == "Paralyzed")
		active[defender].speed = Math.ceil(active[defender].speed * .25);
	if(effect == "Frozen")
		active[defender].speed = Math.ceil(active[defender].speed * .1);;      
	if(effect == "Burned")
		modify(-2, defender, "strength");
      if(effect == "Sleep")
	{
         message.value+= active[defender].name + " was put to Sleep\n";
	   active[defender].sleep = 8;
	}
      else
         message.value+= active[defender].name + " was " + effect + "\n";
   }
}
function damage(powerrating, type, state)
{
   var damagedone;
   if(state == "Physical")
      damagedone = damagephys(powerrating, type);
   if(state == "Special")
      damagedone = damagespec(powerrating, type);
   damagedone = Math.ceil(damagedone);
   var elementaltimes = elementalcheck(type, active[defender].type[0]) * elementalcheck(type, active[defender].type[1]);
   if(elementaltimes == .5 || elementaltimes == .25)
      message.value+= "The attack isn't very effective\n";
   if(elementaltimes == 0)
      message.value+= "The attack has no effect\n";
   if(elementaltimes == 2 || elementaltimes == 4)
      message.value+= "The attack is super effective\n";
   if(active[defender].substitute == 0)
      active[defender].health-= damagedone;
   if(active[defender].substitute > 0)
   {
      active[defender].substitute-= damagedone;
      if(active[defender].substitute <= 0)
      {
         message.value+= active[defender].name + "\'s substitute was destroyed\n";
         active[defender].substitute = -1;
      }
   }
   if(active[defender].health <= 0)
   {
      active[defender].health = 0;
	deathCheck(defender);
   }
   if(defender == 0)
   {
      life0.value = active[0].health + "/" + active[0].maxhealth;
   }
   if(defender == 1)
   {
      life1.value = "";
      for(var setlife = Math.ceil((active[1].health / active[1].maxhealth) * 10); setlife > 0; setlife--)
         life1.value+= "<";
   }
   return Math.ceil(damagedone);
}
function damagephys(powerrating, type)
{
   var defenserating = active[defender].defense;
   var attackrating = active[attacker].strength;
   if(active[defender].armor == 1)
      defenserating*= 2;
   var critical = Math.ceil((active[attacker].speed / active[defender].speed) * 5);
   if(active[attacker].critical > 0)
      critical+= 55;
   else if(active[attacker].critical == 3)
      critical+= 85;
   if(hit(critical) == 1 || randomize(100) == 1)
   {
      if(attackrating < active[attacker].basestrength * 2)
         attackrating = active[attacker].basestrength * 2;
      if(defenserating > active[defender].basedefense)
	   defenserating = active[defender].basedefense;
      message.value+= "Critical hit\n";
   }
   var matching = 1;
   if(type == active[attacker].type[0] && type == active[attacker].type[1])
      matching = 1.5;
   var damagedone = (((((((2 * active[attacker].level / 5 + 2) * powerrating * attackrating / defenserating) / 50) + 2) * matching) * elementalcheck(type, active[defender].type[0]) * elementalcheck(type, active[defender].type[1])) * (randomize(38) + 217) / 255);
   active[defender].physdam+= damagedone;
   return damagedone;
}
function damagespec(powerrating, type)
{
   var defenserating = active[defender].special;
   var attackrating = active[attacker].special;
   if(active[defender].screen == 1)
      defenserating*= 2;
   var critical = Math.ceil((active[attacker].speed / active[defender].speed) * 5);
   if(active[attacker].critical > 0)
      critical+= 55;
   else if(active[attacker].critical == 3)
      critical+= 85;
   if(hit(critical) == 1 || randomize(100) == 1)
   {
      if(attackrating < active[attacker].basespecial * 2)
         attackrating = active[attacker].basespecial * 2;
      if(defenserating > active[defender].basespecial)
	   defenserating = active[defender].basespecial;
      message.value+= "Critical hit\n";
   }
   var matching = 1;
   if(type == active[attacker].type[0] && type == active[attacker].type[1])
      matching = 1.5;
   var damagedone = (((((((2 * active[attacker].level / 5 + 2) * powerrating * attackrating / defenserating) / 50) + 2) * matching) * elementalcheck(type, active[defender].type[0]) * elementalcheck(type, active[defender].type[1])) * (randomize(38) + 217) / 255);
   active[defender].specdam+= damagedone;
   return damagedone;
}
function disabled()
{
   message.value+= active[attacker].name + "\'s attack is disabled\n";
}
function killornil(accuracy)
{
   if(hit(accuracy) == 1 && active[attacker].speed >= active[defender].speed)
      instantdamage(active[defender].health, defender);
   else
      message.value+= active[attacker].name + "\'s attack missed\n";
}
function hitandinstant(accuracy, amount, type, state)
{
   if(hit(accuracy) == 1)
   {
      if(elementalcheck(type, active[defender].type[0]) * elementalcheck(type, active[defender].type[1]) == 0)
         message.value+= "The attack had no effect\n";
      else
	{
	   if(state == "Physical")
		active[defender].physdam+= amount;
	   if(state == "Special")
		active[defender].specdam+= amount;
	   if(active[defender].substitute == 0)
	      active[defender].health-= amount;
	   if(active[defender].substitute > 0)
	   {
	      active[defender].substitute-= amount;
	      if(active[defender].substitute <= 0)
	      {
	         message.value+= active[defender].name + "\'s substitute was destroyed\n";
	         active[defender].substitute = 0;
	      }
	   }
	   if(active[defender].health <= 0)
	   {
	      active[defender].health = 0;
		deathCheck(defender);
	   }
	   if(defender == 0)
	   {
	      life0.value = active[0].health + "/" + active[0].maxhealth;
	   }
	   if(defender == 1)
	   {
	      life1.value = "";
	      for(var setlife = Math.ceil((active[1].health / active[1].maxhealth) * 10); setlife > 0; setlife--)
	         life1.value+= "<";
	   }
	}
   }
   else
      message.value+= active[attacker].name + "\'s attack missed\n";
}
function doubleback(accuracy, type, state)
{
   if(state == "Physical")
      hitandinstant(accuracy, active[attacker].physdam * 2, type, state);
   if(state == "Special")
      hitandinstant(accuracy, active[attacker].specdam * 2, type, state);
}
function instantdamage(amount, towhom)
{
   active[towhom].health-= Math.ceil(amount);
   if(active[towhom].health <= 0)
   {
      active[towhom].health = 0;
      deathCheck(towhom);
   }
   if(towhom == 0)
   {
      life0.value = active[0].health + "/" + active[0].maxhealth;
   }
   if(towhom == 1)
   {
      life1.value = "";
      for(var setlife = Math.ceil((active[1].health / active[1].maxhealth) * 10); setlife > 0; setlife--)
         life1.value+= "<";
   }
}
function healing(amount, towhom)
{
   active[towhom].health+= Math.ceil(amount);
   if(active[towhom].health > active[towhom].maxhealth)
   {
      active[towhom].health = active[towhom].maxhealth;
   }
   if(towhom == 0)
   {
      life0.value = active[0].health + "/" + active[0].maxhealth;
   }
   if(towhom == 1)
   {
      life1.value = "";
      for(var setlife = Math.ceil((active[1].health / active[1].maxhealth) * 10); setlife > 0; setlife--)
         life1.value+= "<";
   }
   return Math.ceil(amount);
}
function halfheal(towhom)
{
   healing(active[attacker].maxhealth * .5, towhom);
}
function hit(accuracy)
{
   var hitchance = randomize(100);
   if(accuracy * active[attacker].accuracy * (1 - active[defender].evade) > hitchance && active[defender].unhit != 1 && hitchance != 100)
      return 1;
   return 0;
}
function single(accuracy, powerrating, type, state)
{
   var damagedone = 0;
   if(hit(accuracy) == 1)
      damagedone = damage(powerrating, type, state); 
   else
      message.value+= active[attacker].name + " missed\n";
   return damagedone;
}
function steallife(accuracy, powerrating, type, state, percentage)
{
   healing(single(accuracy, powerrating, type, state) * percentage, attacker);
}
function recoil(accuracy, powerrating, type, state, percentage)
{
   instantdamage(single(accuracy, powerrating, type, state) * percentage, attacker);
}
function highcritical(accuracy, powerrating, type, state)
{
   active[attacker].critical++;
   single(accuracy, powerrating, type, state);
}
function double(accuracy, powerrating, type, state)
{
   var hits = 0;
   if(hit(accuracy) == 1)
   {
      damage(powerrating, type, state);
      hits++;
   }
   if(hit(accuracy) == 1)
   {
      damage(powerrating, type, state);
      hits++
   }
   message.value+= "Hit " + hits + " times\n";
   return hits;
}
function thrashabout(accuracy, powerrating, type, state)
{
   message.value+= active[attacker].name + " is thrashing about\n";
   active[attacker].thrashing++;
   single(accuracy, powerrating, type, state);
   if(attacker == 0)
      active[0].curattack = playerinput;
   if(attacker == 1)
      active[1].curattack = aiinput;
   if(active[attacker].thrashing == 3 && randomize(2) == 1 || active[attacker].thrashing == 3)
   {
      message.value+= active[attacker].name + " became confused\n";
      active[attacker].confused = 1;
      active[attacker].thrashing = 0;
   }
}
function rapid(accuracy, powerrating, type, state)
{
   if(hit(accuracy) == 1)
   {
      damage(powerrating, type, state);
      damage(powerrating, type, state);
      var timehit = 2;
      while(timehit < 5 && hit(accuracy) == 1)
      {
         timehit++;
         damage(powerrating, type, state);
	   accuracy-= Math.round(5 * (active[defender].speed / active[attacker].speed));
      }
      message.value+= "Hit " + timehit + " times\n";
   }
   else
      message.value+= active[attacker].name + " missed\n";
}
function continual(accuracy, powerrating, type, state)
{
   var damagedone = 0;
   if(active[attacker].bound > 1)
   {
      if(hit(accuracy) == 1)
      {
         active[attacker].bound++;
         damagedone = damage(powerrating, type, state);
      }
      else
      {
         message.value+= active[attacker].name + " missed\n";
         active[attacker].bound = 0;
         active[defender].bound = 0;
         return 0;
      }
   }
   if(active[attacker].bound == 1)
   {
      damagedone = damage(powerrating, type, state);
      active[attacker].bound++;
   }
   if(active[attacker].bound >= 5)
   {
      active[attacker].bound = 0;
      active[defender].bound = 0;
      return 0;
   };
   if(active[attacker].bound == 0)
   {
      if(hit(accuracy) == 1)
      {
         active[attacker].bound = 1;
         active[defender].bound = -1;
         damagedone = damage(powerrating, type, state);
      if(attacker == 0)
         active[0].curattack = playerinput;
      if(attacker == 1)
         active[1].curattack = aiinput;
      }
      else
         message.value+= active[attacker].name + " missed\n";
   }
   return damagedone;
}
function missandinjure(accuracy, attackpower, type, state, failuredamage)
{
   if(single(accuracy, attackpower, type, state) == 0)
   {
      message.value+= active[attacker].name + " kept going and crashed\n";
      if(state == "Physical")
         instantdamage(Math.ceil(damagephys(attackpower, type) * failuredamage), attacker);
      if(state == "Special")
         instantdamage(Math.ceil(damagespec(attackpower, type) * failuredamage), attacker);
   }
}
function modify(amount, towhom, towhat)
{
   if(active[defender].mist == 1 && amount < 0 || active[defender].substitute > 0 && amount < 0 || (eval('active[towhom].mod' + towhat) == 6 && amount > 0) || (eval('active[towhom].mod' + towhat) == -6 && amount < 0))
   {
      message.value+= "Nothing happended\n";
   }
   else
   {
      eval('active[towhom].mod' + towhat + '+= amount');
      if(eval('active[towhom].mod' + towhat) > 6)
         eval('active[towhom].mod' + towhat + ' = 6');
      if(eval('active[towhom].mod' + towhat) < -6)
         eval('active[towhom].mod' + towhat + ' = -6');
	if(towhat == "accuracy")
	{
         if(eval('active[towhom].mod' + towhat) == -6)
		active[towhom].accuracy = .284;
         if(eval('active[towhom].mod' + towhat) == -5)
		active[towhom].accuracy = .329;
         if(eval('active[towhom].mod' + towhat) == -4)
		active[towhom].accuracy = .404;
         if(eval('active[towhom].mod' + towhat) == -3)
		active[towhom].accuracy = .427;
         if(eval('active[towhom].mod' + towhat) == -2)
		active[towhom].accuracy = .533;
         if(eval('active[towhom].mod' + towhat) == -1)
		active[towhom].accuracy = .674;
         if(eval('active[towhom].mod' + towhat) == 0)
		active[towhom].accuracy = 1;
	}
	else if(towhat == "evade")
	{
         if(eval('active[towhom].mod' + towhat) == 6)
		active[towhom].evade = .716;
         if(eval('active[towhom].mod' + towhat) == 5)
		active[towhom].evade = .671;
         if(eval('active[towhom].mod' + towhat) == 4)
		active[towhom].evade = .596;
         if(eval('active[towhom].mod' + towhat) == 3)
		active[towhom].evade = .558;
         if(eval('active[towhom].mod' + towhat) == 2)
		active[towhom].evade = .5;
         if(eval('active[towhom].mod' + towhat) == 1)
		active[towhom].evade = .341;
         if(eval('active[towhom].mod' + towhat) == 0)
		active[towhom].evade = 0;
	}
	else
	{
         if(eval('active[towhom].mod' + towhat) == -6)
            eval('active[towhom].' + towhat + ' = Math.round(active[towhom].base' + towhat + ' * (1 / 4))');
         if(eval('active[towhom].mod' + towhat) == -5)
            eval('active[towhom].' + towhat + ' = Math.round(active[towhom].base' + towhat + ' * (2 / 7))');
         if(eval('active[towhom].mod' + towhat) == -4)
            eval('active[towhom].' + towhat + ' = Math.round(active[towhom].base' + towhat + ' * (1 / 3))');
         if(eval('active[towhom].mod' + towhat) == -3)
            eval('active[towhom].' + towhat + ' = Math.round(active[towhom].base' + towhat + ' * (1 / 2.5))');
         if(eval('active[towhom].mod' + towhat) == -2)
            eval('active[towhom].' + towhat + ' = Math.round(active[towhom].base' + towhat + ' * (1 / 2))');
         if(eval('active[towhom].mod' + towhat) == -1)
            eval('active[towhom].' + towhat + ' = Math.round(active[towhom].base' + towhat + ' * (1 / 1.5))');
         if(eval('active[towhom].mod' + towhat) == 0)
            eval('active[towhom].' + towhat + ' = Math.round(active[towhom].base' + towhat + ')');
         if(eval('active[towhom].mod' + towhat) == 1)
            eval('active[towhom].' + towhat + ' = Math.round(active[towhom].base' + towhat + ' * 1.5)');
         if(eval('active[towhom].mod' + towhat) == 2)
            eval('active[towhom].' + towhat + ' = Math.round(active[towhom].base' + towhat + ' * 2)');
         if(eval('active[towhom].mod' + towhat) == 3)
            eval('active[towhom].' + towhat + ' = Math.round(active[towhom].base' + towhat + ' * 2.5)');
         if(eval('active[towhom].mod' + towhat) == 4)
            eval('active[towhom].' + towhat + ' = Math.round(active[towhom].base' + towhat + ' * 3)');
         if(eval('active[towhom].mod' + towhat) == 5)
            eval('active[towhom].' + towhat + ' = Math.round(active[towhom].base' + towhat + ' * 3.5)');
         if(eval('active[towhom].mod' + towhat) == 6)
            eval('active[towhom].' + towhat + ' = Math.round(active[towhom].base' + towhat + ' * 4)');
	}
      message.value+= active[towhom].name + "\'s " + towhat.charAt(0).toUpperCase() + towhat.substring(1, towhat.length) + " ";
      if(amount == -2)
         message.value+= "decreased greatly\n";
      if(amount == -1)
         message.value+= "decreased\n";
      if(amount == 1)
         message.value+= "increased\n";
      if(amount == 2)
         message.value+= "increased greatly\n";
   }
}
function enemymod(accuracy, amount, towhom, towhat)
{
   if(hit(accuracy) == 1)
      modify(amount, towhom, towhat);
   else
      message.value+= active[attacker].name + "\'s attack missed\n";
}
function hitandeffect(accuracy, statuscon)
{
   if(hit(accuracy) == 1)
      changestatus(statuscon);
   else
      message.value+= active[attacker].name + "\'s attack missed\n";
}
function attackandeffect(accuracy, attackpower, type, state, statuscon, chance)
{
   if(single(accuracy, attackpower, type, state) > 0 && active[defender].health > 0)
      statuseffect(statuscon, chance);
}
function attackandmod(accuracy, attackpower, type, state, towhat, amount, chance)
{
   if(single(accuracy, attackpower, type, state) > 0)
      if(randomize(100) <= chance && active[defender].health > 0)
         modify(amount, defender, towhat);
}
function deathCheck(index)
{
   active[index].status = "Fainted";
   if(index  == 0)
   {
	message.value+= active[0].name + " was knocked out\nChoose a new one\n";
	if(trainer[0][0].health == 0 && trainer[0][1].health == 0 && trainer[0][2].health == 0 && trainer[0][3].health == 0 && trainer[0][4].health == 0 && trainer[0][5].health == 0)
	{
         if(getSearch("tourney") != "")
         {
	      alert("You lose.");
	      message.value+= parent.loginname + " has lost to " + getSearch("trainer") + "\n";
         }
	   else if(getSearch("kpb") != "")
	   {
		alert("You have lost to " + getSearch("lead") + ".");
		setTimeout("submitKPB()", 1000);
	   }
	   else
	   {
            alert("All of your Pokemon have been knocked out. You lose the match and half of your yen.");
            setCookie("repokecash", Math.round(getCookie("repokecash") / 2));
            history.back();
	   }
	}
   }
   if(index == 1)
   {
      message.value+= active[1].name + " was knocked out\n";
      if(getSearch("tourney") != "")
         GetTourneyPoke();
      else
         SwitchPokemon(GetStrongerAI(), 1);
      aiinput = "";
   }
}
function randomize(seed)
{
   var returnthing = Math.round((Math.random() * (seed -1)) + 1);
   return returnthing;
}
function bigelementalcheck(type11, type12, type21, type22)
{
   return elementalcheck(type11, type21) * elementalcheck(type11, type22) + elementalcheck(type12, type21) * elementalcheck(type12, type22);
}
function elementalcheck(type1, type2)
{
   var advantage = 1;
   if(type1 == "Normal" && type2 == "Rock")
      advantage*= .5;
   if(type1 == "Normal" && type2 == "Ghost")
      advantage = 0;
   if(type1 == "Fire" && (type2 == "Grass" || type2 == "Bug" || type2 == "Ice"))
      advantage*= 2;
   if(type1 == "Fire" && (type2 == "Fire" || type2 == "Rock" || type2 == "Water" || type2 == "Dragon"))
      advantage*= .5;
   if(type1 == "Water" && (type2 == "Fire" || type2 == "Rock" || type2 == "Ground"))
      advantage*= 2;
   if(type1 == "Water" && (type2 == "Water" || type2 == "Grass" || type2 == "Dragon"))
      advantage*= .5;
   if(type1 == "Electric" && (type2 == "Water" || type2 == "Flying"))
      advantage*= 2;
   if(type1 == "Electric" && (type2 == "Electric" || type2 == "Grass" || type2 == "Dragon"))
      advantage*= .5;
   if(type1 == "Electric" && type2 == "Ground")
      advantage*= 0;
   if(type1 == "Grass" && (type2 == "Water" || type2 == "Ground" || type2 == "Rock"))
      advantage*= 2;
   if(type1 == "Grass" && (type2 == "Fire" || type2 == "Grass" || type2 == "Poison" || type2 == "Flying" || type2 == "Bug" || type2 == "Dragon"))
      advantage*= .5;
   if(type1 == "Ice" && (type2 == "Grass" || type2 == "Flying" || type2 == "Ground" || type2 == "Dragon"))
      advantage*= 2;
   if(type1 == "Ice" && (type2 == "Water" || type2 == "Ice"))
      advantage*= .5;
   if(type1 == "Fighting" && (type2 == "Normal" || type2 == "Rock" || type2 == "Ice"))
      advantage*= 2;
   if(type1 == "Fighting" && (type2 == "Poison" || type2 == "Flying" || type2 == "Psychic" || type2 == "Bug"))
      advantage*= .5;
   if(type1 == "Fighting" && type2 == "Ghost")
      advantage*= 0;
   if(type1 == "Poison" && (type2 == "Grass" || type2 == "Bug"))
      advantage*= 2;
   if(type1 == "Poison" && (type2 == "Poison" || type2 == "Ground" || type2 == "Rock" || type2 == "Ghost"))
      advantage*= .5;
   if(type1 == "Ground" && (type2 == "Fire" || type2 == "Electric" || type2 == "Rock" || type2 == "Poison"))
      advantage*= 2;
   if(type1 == "Ground" && (type2 == "Bug" || type2 == "Grass"))
      advantage*= .5;
   if(type1 == "Ground" && type2 == "Flying")
      advantage*= 0;
   if(type1 == "Flying" && (type2 == "Grass" || type2 == "Fighting" || type2 == "Bug"))
      advantage*= 2;
   if(type1 == "Flying" && (type2 == "Electric" || type2 == "Rock"))
      advantage*= .5;
   if(type1 == "Psychic" && (type2 == "Fighting" || type2 == "Poison"))
      advantage*= 2;
   if(type1 == "Psychic" && type2 == "Psychic")
      advantage*= .5;
   if(type1 == "Bug" && (type2 == "Grass" || type2 == "Psychic" || type2 == "Poison"))
      advantage*= 2;
   if(type1 == "Bug" && (type2 == "Fire" || type2 == "Fighting" || type2 == "Flying"))
      advantage*= .5;
   if(type1 == "Rock" && (type2 == "Fire" || type2 == "Ice" || type2 == "Bug" || type2 == "Flying"))
      advantage*= 2;
   if(type1 == "Rock" && (type2 == "Fighting" || type2 == "Ground"))
      advantage*= .5;
   if(type1 == "Ghost" && (type2 == "Ghost" || type2 == "Psychic"))
      advantage*= 2;
   if(type1 == "Ghost" && type2 == "Normal")
      advantage*= 0;
   if(type1 == "Dragon" && type2 == "Dragon")
      advantage*= 2;
   return advantage;
}
//Begin Other Functions
function SwitchOptions()
{
   if(chooseact.value == "attack")
   {
      if(CheckOption(0) == 0)
      {
         playerinput = " ";
         return 0;
      };
      playerchoice.length = 5;
	for(var atts = 0; atts < 4; atts++)
	{
	   playerchoice.options[atts + 1].value = active[0].attack[atts];
	   playerchoice.options[atts + 1].text = active[0].attack[atts].substring(0, active[0].attack[atts].length - 2) + " - " + active[0].power[atts];
	}
      for(var dissed = 1; dissed <= 4; dissed++)
      {
         if(active[0].disabled[dissed - 1] == 1)
         {
            playerchoice.options[dissed].text = "disabled";
            playerchoice.options[dissed].value = "disabled()";
         }
      }
   }
   if(chooseact.value == "switch")
   {
      playerchoice.length = 7;
	for(var poks = 0; poks < 6; poks++)
	{
         playerchoice.options[poks + 1].value = poks;
         playerchoice.options[poks + 1].text = trainer[0][poks].name + " - " + trainer[0][poks].status;
	}
   }
   if(chooseact.value == "catch")
   {
      playerchoice.length = 1;
	if(getSearch("kpb") != "")
	{
         playerchoice.length+=2;
         playerchoice.options[0].value = 25;
         playerchoice.options[0].text = "Pokeball " + getSearch("pokeball");
         playerchoice.options[1].value = 35;
         playerchoice.options[1].text = "GreatBall " + getSearch("greatball");
	}
      else if(getCookie("repokeball") != 0)
      {
         playerchoice.length++;
         playerchoice.options[1].value = 25;
         playerchoice.options[1].text = "Pokeball " + getCookie("repokeball");
      }
   }
   playerchoice.selectedIndex = 0;
   playerchoice.focus();
}
function findAttack(name, index)
{
   rval = -1;
   for(var n = 0; n < 4; n++)
   {
	if(active[index].attack[n] == name)
	   rval = n;
   }
   return rval;
}
function noOption(index)
{
   if((active[index].disabled[0] > 0 || active[index].power[0] == 0) && (active[index].disabled[1] > 0 || active[index].power[1] == 0) && (active[index].disabled[2] > 0 || active[index].power[2] == 0) && (active[index].disabled[3] > 0 || active[index].power[3] == 0))
	return true;
   else
	return false;
}
function CheckChoice()
{
   if(chooseact.value == "attack")
   {
      if(noOption(0))
	   playerinput = "Struggle()";
      else if(playerchoice.value != -1)
	   if(active[0].power[(playerchoice.selectedIndex - 1)] > 0)
            playerinput = playerchoice.value;
   }
   if(chooseact.value == "switch")
      Retreat(playerchoice.value);
   if(chooseact.value == "catch")
      CatchPokemon(playerchoice.value);
}
function CheckTourneyChoice()
{
   CheckChoice();
   if(chooseact.value == "switch")
   {
      current[0] = playerchoice.value;
      active[0] = trainer[0][current[0]];
      SetBattleField(0, current[0]);
      playerinput = "switch" + current[0];
   }
   if(active[0].health > 0)
   {
      parent.main.postin.postit.value = '*/if(parent.battle.getSearch("tourney") == 1 && parent.turn == ' + parent.turn + ') parent.tourneyinput = "' + playerinput + '";/* ';
      parent.main.postin.submit();
      chooseact.selectedIndex = 0;
      playerchoice.selectedIndex = 0;
      parent.turn++;
      chooseact.focus();
   }
}
function NullOut(trainernum)
{
   with(active[trainernum])
   {
      strength = basestrength;
      defense = basedefense;
      speed = basespeed;
      special = basespecial;
      accuracy = baseaccuracy;
      evade = baseevade;
      modstrength = 0;
      modspeed = 0;
      moddefense = 0;
      modspecial = 0;
      modaccuracy = 0;
      modevade = 0;
      critical = 0;
      confused = 0;
	sleep = 0;
      toxic = 0;
      disabled[0] = 0;
      disabled[1] = 0;
      disabled[2] = 0;
      disabled[3] = 0;
      armor = 0;
      screen = 0;
      mist = 0;
      leechseed = 0;
   }
}
function SwitchPokemon(newpoke, trainernum)
{
   if(active[trainernum].mimiced > 0)
   {
      active[trainernum].attack[active[trainernum].mimiced - 1] = "Mimic()";
   }
   if(active[trainernum].transattack[0] != "")
   {
      var deadflag = 0;
	var lifemark = trainer[trainernum][current[trainernum]].health;
	var maxlifemark = trainer[trainernum][current[trainernum]].maxhealth;
      if(active[trainernum].health <= 0)
         deadflag = 1;
	poke[current[trainernum]] = new Pokemon(active[trainernum].name);
	equalizePoke(current[trainernum], trainernum, 0);
	for(var trans = 0; trans < 4; trans++)
	{
	   active[trainernum].attack[trans] = active[trainernum].transattack[trans];
	   active[trainernum].power[trans] = active[trainernum].transpower[trans];
	   active[trainernum].transattack[trans] = "";
	   active[trainernum].transpower[trans] = 0;
	}
	active[trainernum].health = lifemark;
	active[trainernum].maxhealth = maxlifemark;
      if(deadflag == 1)
         trainer[trainernum][current[trainernum]].health = 0;
   }
   NullOut(trainernum);
   with(active[trainernum])
   {
      charging = 0;
      unhit = 0;
      curattack = "";
      scared = 0;
      mimiced = 0;
      enraged = 0;
      thrashing = 0;
      biding = 0;
      substitute = 0;
   };
   active[0].bound = 0;
   active[1].bound = 0;
   current[trainernum] = newpoke;
   SetBattleField(trainernum, newpoke);
   message.value+= active[trainernum].name + " was brought out\n";
}
function CatchPokemon(chance)
{
   if(getSearch("kpb") != "" && chance == 25)
   {
	var ballsleft = getSearch("pokeball");
   }
   else if(getSearch("kpb") != "" && chance == 35)
   {
	var ballsleft = getSearch("greatball");
   }
   else
   {
	var ballsleft = getCookie("repokeball");
   }
   if(ballsleft == 0)
   {
      message.value+= "You are out of PokeBalls\nYou cannot catch the Pokmeon\n";
      return false;
   }
   if(getSearch("kpb") == "")
   {
      setCookie("repokeball", ballsleft - 1);
   }
   var catchval = randomize(chance);
   var difval = Math.round((trainer[1][current[1]].health / trainer[1][current[1]].maxhealth) * 100);
   if(trainer[1][current[1]].status != "OK")
      difval=- 5;
   if(trainer[1][current[1]].status == "Asleep" || trainer[1][current[1]].status == "Paralyzed" || trainer[1][current[1]].status == "Frozen")
      difval=- 5;
   if(catchval > difval && getSearch("kpb") == "")
   {
      var slot = FindNextSpace();
      if(slot == 13)
      {
         message.value+= "Your PokeBox is full\nYou cannot catch the Pokemon\n";
         return false;
      }
      trainer[1][current[1]] = new Pokemon(trainer[1][current[1]].name);
      setCookie("repokemon" + slot, codePokeEnemy(current[1]));
      message.value+= "You caught a " + trainer[1][current[1]].name + "\n";
      trainer[1][current[1]].health = 0;
	return true;
   }
   if(catchval > difval && getSearch("kpb") != "")
   {
      trainer[1][current[1]].health = 0;
      message.value+= "You caught a " + trainer[1][current[1]].name + "\n";
      SwitchPokemon(GetStrongerAI(), 1);
	return true;
   }
   else
   {
      message.value+= "The PokeBall missed\nYou did not catch the Pokemon\n";
      return false;
   }
}
function Retreat(pokeindex)
{
   if(active[0].health <= 0)
      playerinput = "";
   if(playerinput == "" && pokeindex != -1 && trainer[0][pokeindex].health > 0)
   {
      playerinput = " ";
      SwitchPokemon(pokeindex, 0);
   }
}
function GetStrongerAI()
{
   var strongpoke = -1;
   var pokecheck = 0;
   for(var supereffect = 8; supereffect >= 0; supereffect-= .25)
   {
      for(pokecheck = 0; pokecheck < 6; pokecheck++)
      {
         if(trainer[1][pokecheck].health > 0 && bigelementalcheck(trainer[1][pokecheck].type[0], trainer[1][pokecheck].type[1], active[0].type[0], active[0].type[1]) > supereffect)
         {
            strongpoke = pokecheck;
            break;
         }
      }
   }
   if(strongpoke == -1)
   {
      if(getSearch("rebadgeatt") != "")
      {
         if(formnotyetsubmitted)
         {
            formnotyetsubmitted = false;
            alert("Congratulations! You won a " + getSearch("rebadgeatt") + " Badge. Fill out this information to get it.");
            alert("You receive " + ((getBadgeBonus(getSearch("rebadgeatt")) * 250) - -250 - -payday) + " yen.");
            setCookie("repokecash", (getCookie("repokecash") - -(getBadgeBonus(getSearch("rebadgeatt")) * 250) - -250 - -payday));
            setCookie("rebadgeown", getCookie("rebadgeown") + getSearch("rebadgeatt") + "_"); 
            submitWinForm();
         }
      }
      else if(getSearch("trainer") != "" && formnotyetsubmitted)
      {
         formnotyetsubmitted = false;
         alert(getSearch("messageafter"));
         alert("You receive " + ((getSearch("difficulty") * 25 * numofPokes()) - -payday) + " yen.");
         setCookie("repokecash", (getCookie("repokecash") - -(getSearch("difficulty") * 25 * numofPokes()) - -payday));
         if(getSearch("tourney") != "")
         {
            message.value+= parent.loginname + " has defeated " + getSearch("trainer") + "\n";
         }
         else
            history.back();
      }
	else if(getSearch("kpb") == 1 && formnotyetsubmitted)
	{
	   formnotyetsubmitted = false;
	   alert("You have defeated " + getSearch("lead") + "!");
	   winform.victor.value = getSearch("chal");
	   setTimeout("submitKPB()", 1000);
	}
      strongpoke = current[1];
   }
   return strongpoke;
}
function GetTourneyPoke()
{
   playerinput = "";
   var anyleft = false;
   for(var pokecheck = 0; pokecheck < 6; pokecheck++)
      if(trainer[1][pokecheck].health <= 0)
         anyleft = true;
   if(anyleft)
   {
      message.value+= "Waiting for opponent to select new Pokemon....\n";
      parent.tourneyinput = "-";
	parent.turn++;
      setTimeout("GetTourney()", 10);
   }
   else 
   {
      if(getSearch("trainer") != "" && formnotyetsubmitted)
      {
         formnotyetsubmitted = false;
         alert(getSearch("messageafter"));
         alert("You receive " + ((getSearch("difficulty") * 25 * numofPokes()) - -payday) + " yen.");
         setCookie("repokecash", (getCookie("repokecash") - -(getSearch("difficulty") * 25 * numofPokes()) - -payday));
         if(getSearch("tourney") != "")
         {
            message.value+= parent.loginname + " has defeated " + getSearch("trainer") + "\n";
         }
         else
            history.back();
      }
   }
}
function GetNewChoice()
{
   if(playerinput == " ")
   {
      chooseact.options[1].text = "Attack";
      SetBattleField(0, current[0]);
      setTimeout("BeginTurn()", 100);
   }
   else
      setTimeout("GetNewChoice()", 100);
}
function GetNewTourneyChoice()
{
   if(playerinput == " ")
   {
      chooseact.options[1].text = "Attack";
      SetBattleField(0, current[0]);
      parent.main.postin.postit.value = '*/if(parent.battle.getSearch("tourney") == 1 && parent.turn == ' + (parent.turn - 1) + '){parent.tourneyinput = "switch' + current[0] + '";}/* ';
      parent.main.postin.submit();
   }
   else
      setTimeout("GetNewTourneyChoice()", 100);
}
function SetBattleField(trainernum, switchto)
{
   active[trainernum] = trainer[trainernum][switchto];
   if(trainernum == 1)
   {
      if(active[1].name != "Farfetch\'d")
         pokepic1.src = active[1].name + ".jpg";
      else
         pokepic1.src = "Farfetchd.jpg";
      pokepic1.alt = active[1].name;
      life1.value = "<<<<<<<<<<";
   }
   if(trainernum == 0)
   {
      if(active[0].name != "Farfetch\'d")
         pokepic0.src = active[0].name + ".jpg";
      else
         pokepic0.src = "Farfetchd.jpg";
      pokepic0.alt = active[0].name;
      life0.value = active[0].health + "/" + active[0].maxhealth;
   }
}
function CheckOption(trainernum)
{
   var canact = 1;
   if(active[trainernum].critical == 3)
      active[trainernum].critical = 0;
   if(active[trainernum].critical > 0)
      active[trainernum].critical--;
   if(active[trainernum].status == "Sleep")
   {
      canact = 0;
   }
   if(active[trainernum].bound < 0)
   {
      canact = 0;
   }
   if(active[trainernum].bound > 0)
   {
      if(trainernum == 0)
         playerinput = active[0].curattack;
      if(trainernum == 1)
         aiinput = active[1].curattack;
   }
   if(active[trainernum].charging == 1)
   {
      if(trainernum == 0)
         playerinput = active[0].curattack;
      if(trainernum == 1)
         aiinput = active[1].curattack;
   }
   if(active[trainernum].charging == 2)
   {
      if(trainernum == 0)
         playerinput = active[0].curattack;
      if(trainernum == 1)
         aiinput = active[1].curattack;
   }
   if(active[trainernum].enraged == 1)
   {
      if(trainernum == 0)
         playerinput = active[0].curattack;
      if(trainernum == 1)
         aiinput = active[1].curattack;
   }
   if(active[trainernum].thrashing > 0)
   {
      if(trainernum == 0)
         playerinput = active[0].curattack;
      if(trainernum == 1)
         aiinput = active[1].curattack;
   }
   if(active[trainernum].biding> 0)
   {
      if(trainernum == 0)
         playerinput = active[0].curattack;
      if(trainernum == 1)
         aiinput = active[1].curattack;
   }
   return canact;
}
function CheckAct(trainernum)
{
   var canact = 1;
   if(active[trainernum].status == "Paralyzed")
   {
      if(randomize(4) == 1)
      {
         message.value+= active[trainernum].name + " was unable to move\n";
         canact = 0;
      }
   }
   if(active[trainernum].status == "Frozen")
   {
      if(randomize(2) == 1)
      {
         message.value+= active[trainernum].name + " was unable to move\n";
         canact = 0;
      }
   }
   if(active[trainernum].status == "Sleep")
   {
      canact = 0;
	active[trainernum].sleep--;
      if((randomize(4) == 1 || active[trainernum].sleep == 0) && active[trainernum].rested == 0)
      {
         active[trainernum].status = "OK";
         message.value+= active[trainernum].name + " woke up\n";
      }
      else if(active[trainernum].rested > 0)
      {
         active[trainernum].rested--;
         if(active[trainernum].rested == 0)
         {
            message.value+= active[trainernum].name + " woke up\n";
            active[trainernum].status = "OK";
         }
         else
            message.value+= active[trainernum].name + " is fast Asleep\n";
      }
      else
         message.value+= active[trainernum].name + " is fast Asleep\n";
   }
   if(active[trainernum].status == "Poisoned")
   {
      message.value+= active[trainernum].name + " was hurt by the Poison\n";
      instantdamage(active[trainernum].maxhealth / 16, trainernum);
   }
   if(active[trainernum].status == "Burned")
   {
      message.value+= active[trainernum].name + " was hurt by the Burn\n";
      instantdamage(active[trainernum].maxhealth / 16, trainernum);
   }
   if(active[trainernum].status == "Toxiced")
   {
      message.value+= active[trainernum].name + " was hurt by the Toxic\n";
      active[trainernum].toxic++;
      instantdamage(active[trainernum].maxhealth / (16 / active[trainernum].toxic), trainernum);
   }
   if(active[trainernum].leechseed == 1)
   {
      message.value+= active[trainernum].name + "\'s life was drained by the Leech Seed\n";
      if(trainernum == 0)
      {
         healing(active[trainernum].maxhealth / 16, 1);
         instantdamage(active[trainernum].maxhealth / 16, 0);
      }
      if(trainernum == 1)
      {
         healing(active[trainernum].maxhealth / 16, 0);
         instantdamage(active[trainernum].maxhealth / 16, 1);
      }
   }
   if(active[trainernum].bound < 0)
   {
      message.value+= active[trainernum].name + " can\'t move\n";
      canact = 0;
   }
   if(canact != 0 && active[trainernum].scared == 1)
   {
      message.value+= active[trainernum].name + " flinched\n";
      canact = 0;
   }
   if(canact != 0 && active[trainernum].confused > 0)
   {
	active[trainernum].confused--;
      if(randomize(4) == 1 || active[trainernum].confused == 0)
      {
         message.value+= active[trainernum].name + " is no longer confused\n";
         active[trainernum].confused = 0;
      }
      else
      {
         message.value+= active[trainernum].name + " is Confused\n";
         if(randomize(2) == 1)
         {
             message.value+= active[trainernum].name + " hurt itself in its Confusion\n";
             instantdamage(((((2 * active[trainernum].level / 5 + 2) * 45 * active[trainernum].strength / active[trainernum].defense) / 50) + 2) * (randomize(38) + 217) / 255, trainernum);
             canact = 0;
         }
      }
   }
   return canact;
}
function GetAI()
{
   juggle++;
   var juggleto = getSearch("juggleto");
   if(juggle >= juggleto && juggleto != 0)
   {
      juggle = 0;
      if(bigelementalcheck(active[1].type[0], active[1].type[1], active[0].type[0], active[0].type[1]) < 4)
      {
         var switchto = GetStrongerAI();
         if(switchto != current[1])
         {
            SwitchPokemon(switchto, 1);
            aiinput = " ";
         }
      }
   }
   if(CheckOption(1) == 1)
   {
      if(aiinput == "")
      {
         var aichoice = randomize(4) - 1;
         aiinput = active[1].attack[aichoice];
         while(active[1].disabled[aichoice] == 1 || aiinput.substring(0, aiinput.length - 2) == "")
         {
            aichoice = randomize(4) - 1;
            aiinput = active[1].attack[aichoice];
         }
      }
   }
}
function GetTourney()
{
   if(parent.tourneyinput != "-")
   {
      parent.turn++;
      if(parent.tourneyinput.substring(0,6) == "switch")
      {
         SwitchPokemon(parent.tourneyinput.substring(6,7), 1);
         parent.tourneyinput = " ";
      }
      aiinput = parent.tourneyinput;
      parent.tourneyinput = "-";
      if(CheckOption(1) == 1)
      {
	   if(noOption(1))
		aiinput = "Struggle()";
         if(aiinput == "")
         {
            var aichoice = randomize(4) - 1;
            aiinput = active[1].attack[aichoice];
            while(active[1].disabled[aichoice] == 1 || aiinput.substring(0, aiinput.length - 2) == "" || active[1].power[aichoice] == 0)
            {
               aichoice = randomize(4) - 1;
               aiinput = active[1].attack[aichoice];
            }
         }
      }
   	setTimeout("CheckTurn()", 1);
   }
   else
      setTimeout("GetTourney()", 10);
}
function AIAct()
{
   if(CheckAct(1) == 1)
   {
      if(active[1].health > 0)
      {
         eval(aiinput);
	   if(active[1].otherattack == "" && aiinput != "Struggle()")
            active[1].power[findAttack(aiinput, 1)]--;
	   if(active[1].otherattack != "")
		active[1].power[findAttack(active[1].otherattack, 1)]--;
        lastattack[1] = aiinput;
      }
   }
}
function PlayerAct()
{
   if(CheckAct(0) == 1)
   {
      if(active[0].health > 0)
      {
         eval(playerinput);
	   if(active[0].otherattack == "" && playerinput != "Struggle()")
            active[0].power[findAttack(playerinput, 0)]--;
	   if(active[0].otherattack != "")
		active[0].power[findAttack(active[0].otherattack, 0)]--;
         lastattack[0] = playerinput;
      }
   }
}
function CheckTurn()
{
   active[0].otherattack = "";
   active[1].otherattack = "";
   active[0].physdam = 0;
   active[1].physdam = 0;
   active[0].specdam = 0;
   active[1].specdam = 0;
   if(playerinput == "Metronome()")
   {
      playerinput = Metronome();
      active[0].otherattack = "Metronome()";
   }
   if(aiinput == "Metronome()")
   {
      aiinput = Metronome();
      active[1].otherattack = "Metronome()";
   }
   var gofirst = 0;
   if(active[0].speed > active[1].speed)
   {
      gofirst = 0;
   }
   else
   {
      gofirst = 1;
   };
   if(aiinput == "QuickAttack()" && playerinput != "QuickAttack()")
      gofirst = 1;
   if(playerinput == "QuickAttack()" && aiinput != "QuickAttack()")
      gofirst = 0;
   if(playerinput == "Bide()")
   {
      gofirst = 1;
      if(active[0].biding == 0)
         active[0].lastlife = active[0].health;
   }
   if(aiinput == "Bide()")
   {
      gofirst = 0;
      if(active[1].biding == 0)
         active[1].lastlife = active[1].health;
   }
   if(playerinput == "Counter()")
   {
      gofirst = 1;
      active[0].lastlife = active[0].health;
   }
   if(aiinput == "Counter()")
   {
      gofirst = 0;
      active[1].lastlife = active[1].health;
   }
   if(gofirst == 0)
   {
      attacker = 0;
      defender = 1;
      if(playerinput == "MirrorMove()")
      {
         playerinput = lastattack[1];
         active[attacker].otherattack = "MirrorMove()";
      }
      if(active[attacker].otherattack != "")
         message.value+= active[attacker].name + " uses " + active[attacker].otherattack.substring(0, active[attacker].otherattack.length - 2) + "\n";
      PlayerAct();
      attacker = 1;
      defender = 0;
      if(aiinput == "MirrorMove()")
      {
         aiinput = lastattack[0];
         active[attacker].otherattack = "MirrorMove()";
      }
      if(active[attacker].otherattack != "")
         message.value+= active[attacker].name + " uses " + active[attacker].otherattack.substring(0, active[attacker].otherattack.length - 2) + "\n";
      AIAct();
   }
   else
   {
      attacker = 1;
      defender = 0;
      if(aiinput == "MirrorMove()")
      {
         aiinput = lastattack[0];
         active[attacker].otherattack = "MirrorMove()";
      }
      if(active[attacker].otherattack != "")
         message.value+= active[attacker].name + " uses " + active[attacker].otherattack.substring(0, active[attacker].otherattack.length - 2) + "\n";
      AIAct();
      attacker = 0;
      defender = 1;
      if(playerinput == "MirrorMove()")
      {
         playerinput = lastattack[1];
         active[attacker].otherattack = "MirrorMove()";
      }
      if(active[attacker].otherattack != "")
         message.value+= active[attacker].name + " uses " + active[attacker].otherattack.substring(0, active[attacker].otherattack.length - 2) + "\n";
      PlayerAct();
   }
   if(getSearch("tourney") != "")
   {
      parent.main.postin.postit.value = '*/if(parent.battle.getSearch("tourney") == 2 && parent.turn == ' + parent.turn + '){parent.battle.active[0].health = ' + active[1].health + '; parent.battle.active[0].attack = Array("' + active[1].attack[0] + '", "' + active[1].attack[1] + '", "' + active[1].attack[2] + '", "' + active[1].attack[3] + '"); parent.battle.active[0].power = Array("' + active[1].power[0] + '", "' + active[1].power[1] + '", "' + active[1].power[2] + '", "' + active[1].power[3] + '"); parent.battle.SetBattleField(0, ' + current[1] + '); parent.battle.message.value = unescape("' + escape(message.value) + '");}/* ';
      if(active[1].health <= 0)
         parent.main.postin.postit.value+= '*/if(parent.battle.getSearch("tourney") == 2 && parent.turn == ' + parent.turn + '){parent.turn++; parent.battle.active[0].health = 0; parent.battle.SetBattleField(0, parent.battle.current[0]); parent.battle.chooseact.options[1].text = "Can\'t Attack"; parent.battle.GetNewTourneyChoice();}/* ';
      parent.main.postin.submit();
   }
   if(!(getSearch("tourney") != "" && active[1].health <= 0))
   {
      setTimeout("BeginTurn()", 100);
   }
   blackbox+= message.value;
}
function GetInput()
{
   if(playerinput != "")
   {
      message.value = "";
      if(chooseact.value == "switch")
         message.value+= active[0].name + " was brought out\n";
      if(getSearch("tourney") != "")
      {
         message.value+= "Waiting for opponent's response....\n";
         setTimeout("GetTourney()", 1);
      }
      else
      {
         GetAI();
         setTimeout("CheckTurn()", 1);
      }
   }
   else
   {
      setTimeout("GetInput()", 10);
   }
}
function BeginTurn()
{
   if(active[0].health <= 0)
   {
      chooseact.options[1].text = "Can't Attack";
      GetNewChoice();
   }
   else
   {
      playerinput = "";
      aiinput = "";
      active[0].scared = 0;
      active[1].scared = 0;
      if(active[0].substitute <= -1)
         active[0].substitute = 0;
      if(active[1].substitute <= -1)
         active[1].substitute = 0;
      message.value+= "Choose your action\n";
      playerchoice.length = 1;
      playerchoice.selectedIndex = 0;
      chooseact.selectedIndex = 0;
      chooseact.focus();
      GetInput();
   }
}
function codePokeCookie(index)
{
   return poke[index].name + "_" + poke[index].strength + "_" + poke[index].speed + "_" + poke[index].defense + "_" + poke[index].special + "_" + poke[index].accuracy + "_" + poke[index].evade + "_" + poke[index].attack[0] + "_" + poke[index].attack[1] + "_" + poke[index].attack[2] + "_" + poke[index].attack[3] + ";";
}
function codePokeEnemy(index)
{
   return trainer[1][index].name + "_" + trainer[1][index].strength + "_" + trainer[1][index].speed + "_" + trainer[1][index].defense + "_" + trainer[1][index].special + "_" + trainer[1][index].accuracy + "_" + trainer[1][index].evade + "_" + trainer[1][index].attack[0] + "_" + trainer[1][index].attack[1] + "_" + trainer[1][index].attack[2] + "_" + trainer[1][index].attack[3] + ";";
}
function decodePokeCookie(index, cname)
{
   var cval = getCookie(cname + (index + 1));
   var firstindex = 0;
   var lastindex = cval.indexOf("_", 0) + 1;
   poke[index] = new Pokemon(cval.substring(0, lastindex - 1));
   firstindex = lastindex;
   lastindex = cval.indexOf("_", firstindex) + 1;
   poke[index].strength = cval.substring(firstindex, lastindex -1);
   firstindex = lastindex;
   lastindex = cval.indexOf("_", firstindex) + 1;
   poke[index].speed = cval.substring(firstindex, lastindex -1);
   firstindex = lastindex;
   lastindex = cval.indexOf("_", firstindex) + 1;
   poke[index].defense = cval.substring(firstindex, lastindex -1);
   firstindex = lastindex;
   lastindex = cval.indexOf("_", firstindex) + 1;
   poke[index].special = cval.substring(firstindex, lastindex -1);
   firstindex = lastindex;
   lastindex = cval.indexOf("_", firstindex) + 1;
   poke[index].accuracy = cval.substring(firstindex, lastindex -1);
   firstindex = lastindex;
   lastindex = cval.indexOf("_", firstindex) + 1;
   poke[index].evade = cval.substring(firstindex, lastindex -1);
   firstindex = lastindex;
   lastindex = cval.indexOf("_", firstindex) - 1;
   poke[index].attack[0] = cval.substring(firstindex, lastindex -1);
   firstindex = lastindex + 2;
   lastindex = cval.indexOf("_", firstindex) - 1;
   if(firstindex < cval.length - 3)
      poke[index].attack[1] = cval.substring(firstindex, lastindex -1);
   else
      poke[index].attack[1] = "";
   firstindex = lastindex + 2;
   lastindex = cval.indexOf("_", firstindex) - 1;
   if(firstindex  < cval.length - 2)
      poke[index].attack[2] = cval.substring(firstindex, lastindex -1);
   else
      poke[index].attack[2] = "";
   firstindex = lastindex + 2;
   lastindex = cval.length - 2;
   if(firstindex < cval.length)
      poke[index].attack[3] = cval.substring(firstindex, lastindex);
   else
      poke[index].attack[3] = "";
}
function decodePokeSearch(index, cname)
{
   var cval = getSearch(cname + (index + 1));
   var firstindex = 0;
   var lastindex = cval.indexOf("_", 0) + 1;
   poke[index] = new Pokemon(cval.substring(0, lastindex - 1));
   firstindex = lastindex;
   lastindex = cval.indexOf("_", firstindex) + 1;
   poke[index].strength = cval.substring(firstindex, lastindex -1);
   firstindex = lastindex;
   lastindex = cval.indexOf("_", firstindex) + 1;
   poke[index].speed = cval.substring(firstindex, lastindex -1);
   firstindex = lastindex;
   lastindex = cval.indexOf("_", firstindex) + 1;
   poke[index].defense = cval.substring(firstindex, lastindex -1);
   firstindex = lastindex;
   lastindex = cval.indexOf("_", firstindex) + 1;
   poke[index].special = cval.substring(firstindex, lastindex -1);
   firstindex = lastindex;
   lastindex = cval.indexOf("_", firstindex) + 1;
   poke[index].accuracy = cval.substring(firstindex, lastindex -1);
   firstindex = lastindex;
   lastindex = cval.indexOf("_", firstindex) + 1;
   poke[index].evade = cval.substring(firstindex, lastindex -1);
   firstindex = lastindex;
   lastindex = cval.indexOf("_", firstindex) - 1;
   poke[index].attack[0] = cval.substring(firstindex, lastindex -1);
   firstindex = lastindex + 2;
   lastindex = cval.indexOf("_", firstindex) - 1;
   if(firstindex < cval.length - 3)
      poke[index].attack[1] = cval.substring(firstindex, lastindex -1);
   else
      poke[index].attack[1] = "";
   firstindex = lastindex + 2;
   lastindex = cval.indexOf("_", firstindex) - 1;
   if(firstindex  < cval.length - 2)
      poke[index].attack[2] = cval.substring(firstindex, lastindex -1);
   else
      poke[index].attack[2] = "";
   firstindex = lastindex + 2;
   lastindex = cval.length - 2;
   if(firstindex < cval.length)
      poke[index].attack[3] = cval.substring(firstindex, lastindex);
   else
      poke[index].attack[3] = "";
}
function numofPokes()
{
   var rval = 0;
   for(var count = 0; count < 6; count++)
      if(trainer[1][count].name != "")
         rval++;
   return rval;
}
function submitWinForm()
{
   winningform.email.value = prompt("Please input your e-mail address:","");
   winningform.url.value = prompt("Please input your web site URL (if you have one):", "");
   winningform.pokestring.value = document.cookie + unescape(location.search);
   if(winningform.email.value.substring(winningform.email.value.length - 8, winningform.email.value.length) == "@aol.com" || winningform.email.value.substring(winningform.email.value.length - 7, winningform.email.value.length) == "@cs.com")
      document.URL = "http://www.angelfire.com/oh2/realitysend/poliwhirl/gym/aol.html" + location.search + "emailwho=" + escape(winningform.email.value) + ";url=" + escape(winningform.url.value) + ";";
   else
      winningform.submit();
}
function submitKPB()
{
   winform.blackbox.value = blackbox;
   if(getCookie(getSearch("chal") + getSearch("lead")) == "")
	winform.blackbox.value+= "Beware! This person is using a non-cookie enabled browser and may have cheated.\n";
   winform.submit();
}
function makePokemon(name, att1, att2, att3, att4, index)
{
   index--;
   poke[index] = new Pokemon(name);
   poke[index].attack[0] = att1 + "()";
   poke[index].attack[1] = att2 + "()";
   poke[index].attack[2] = att3 + "()";
   poke[index].attack[3] = att4 + "()";
}
function checkforBadge(name)
{
  name+= "_";
  var badgeFound = false;
  var start = 0;
  var end = 0;
  var badgeString = getCookie("rebadgeown");
  var i = 0;
  while (i <= badgeString.length)
  {
    start = i;
    end = start + name.length;
    if (badgeString.substring(start,end) == name)
    {
      badgeFound = true;
      break;
    }
    i++;
  }
  return badgeFound;
}
function getBadgeBonus(badge)
{
   if(badge == "Maelstrom")
      return 1;
   else if(badge == "Venom")
      return 1;
   else if(badge == "Luna")
      return 1;
   else if(badge == "ReBolt")
      return 1;
   else if(badge == "Chance") // leave for memorial purposes
      return 1;
   else if(badge == "Beholders")
      return 1;
   else if(badge == "Wastelands")
      return 1;
   else if(badge == "StarSiege")
      return 1;
   else if(badge == "Char")
      return 1;
   else if(badge == "Aqua")
      return 1;
   else if(badge == "Element")
      return 1;
   else if(badge == "Dimensional")
      return 1;
   else if(badge == "Fierce")
      return 1;
   else if(badge == "PsyBlast")
      return 1;
   else if(badge == "Spark")
      return 1;
   else if(badge == "Desert")
      return 1;
   else if(badge == "Legend")
      return 1;
   else if(badge == "Kirmas")
      return 1;
   else if(badge == "RPG")
      return 1;
   else if(badge == "Gemini")
      return 1;
   else if(badge == "Psythudojo")
      return 1;
   else if(badge == "Star")
      return 1;
   else if(badge == "ZeroStryke")
      return 1;
   else if(badge == "Nova")
      return 1;
   else if(badge == "ClearHand")
      return 1;
   else if(badge == "Heart")
      return 1;
   else if(badge == "Azure") // http://seadreasrealm.surf.to/ (limit Sept 5)
      return 1;
   else if(badge == "Sky") // http://nav.to/ashlovesmist/ (limit Sept 16)
      return 1;
   else if(badge == "Marlen") // http://www.geocities.com/pokemonmaniac_au (limit Sept 15)
      return 1;
   else
      return 0;
}
function getBadgeValue(level)
{
   var badgestr = getCookie("rebadgeown");
   var start = 0;
   var end = badgestr.indexOf("_", 0);
   var amount = 0;
   while(end > start)
   {
      if(getBadgeBonus(badgestr.substring(start, end)) == level)
         amount++;
      start = end + 1;
      end = badgestr.indexOf("_", start);
   }
   return amount;
}
function getThePokemon()
{
   var returnit = "";
   for(var i = 0; i < 6; i++)
   {
      returnit+= "regympoke" + (i + 1) + "=" + codePokeCookie(i);
   }
   return returnit;
}
function getRandomWildPokemon(common, uncommon, rare)
{
   if(common == "Mewtwo" || common == "Mew" || common == "Zapdos" || common == "Articuno" || common == "Moltres" || uncommon == "Mewtwo" || uncommon == "Mew" || uncommon == "Zapdos" || uncommon == "Articuno" || uncommon == "Moltres" || rare == "Mewtwo" || rare == "Mew" || rare == "Zapdos" || rare == "Articuno" || rare == "Moltres")
   {
      common = "Magikarp";
      uncommon = "Magikarp";
      rare = "Magikarp";
   }
   var returnit = "";
   var seed = 0;
   for(var i = 0; i < 6; i++)
   {
      seed = randomize(100);
      if(seed <= 50)
         poke[i] = new Pokemon(common);
      if(seed > 50 && seed <= 85)
         poke[i] = new Pokemon(uncommon);
      if(seed > 85)
         poke[i] = new Pokemon(rare);
      returnit+= "regympoke" + (i + 1) + "=" + codePokeCookie(i);
   }
   return returnit;
}
function getBestPokemon()
{
   var taken = new Array();
   var antipode = new Array();
   var enemypokemon;
   var cval = "";
   var stoplooking = 0;
   for(var tpoke = 0; tpoke < 6; tpoke++)
   {
      cval = getCookie("repokemon" + (tpoke + 1));
      enemypokemon = new Pokemon(cval.substring(0, cval.indexOf("_", 0)));
      stoplooking = 0;
      for(var supereffect = 8; supereffect >= 0; supereffect-= .25)
      {
         for(var pokecheck = 0; pokecheck < 12; pokecheck++)
         {
            if(bigelementalcheck(poke[pokecheck].type[0], poke[pokecheck].type[1], enemypokemon.type[0], enemypokemon.type[1]) >= supereffect && taken[pokecheck] != 1 && stoplooking != 1)
            {
               taken[pokecheck] = 1;
               antipode[tpoke] = pokecheck;
               stoplooking = 1;
            }
         }
      }
   }
   var returnit = "";
   for(var i = 0; i < 6; i++)
   {
      returnit+= "regympoke" + (i + 1) + "=" + codePokeCookie(antipode[i]);
   }
   return returnit;
}
function equalizePoke(index, trainernum, plus)
{
   //trainer[trainernum][index].health = poke[index].health; //all cookies are corrupt, so this must be ommitted
   trainer[trainernum][index].strength = poke[index].strength;
   trainer[trainernum][index].speed = poke[index].speed;
   trainer[trainernum][index].defense = poke[index].defense;
   trainer[trainernum][index].special = poke[index].special;
   with(trainer[trainernum][index])
   {
	level--;
      health--;
      strength--;
      defense--;
      speed--;
      special--;
	level++;
      health++;
      strength++;
      defense++;
      speed++;
      special++;
      //accuracy--; //Evasion cookies are corrupt, fix later
      //evade--;
   }
   plus*= 2;
   with(trainer[trainernum][index])
   {
      health = Math.round(((trainer[trainernum][index].level + plus) * (health + 50) / 50) + 10);
      strength = Math.round(((trainer[trainernum][index].level + plus) * strength / 50) + 5);
      defense = Math.round(((trainer[trainernum][index].level + plus) * defense / 50) + 5);
      speed = Math.round(((trainer[trainernum][index].level + plus) * speed / 50) + 5);
      special = Math.round(((trainer[trainernum][index].level + plus) * special / 50) + 5);
      //accuracy++;
      //evade++;
      maxhealth = health;
      basestrength = strength;
      basedefense = defense;
      basespeed = speed;
      basespecial = special;
      //baseaccuracy = accuracy;
      //baseevade = evade;
   }
   //trainer[trainernum][index].accuracy = poke[index].accuracy;
   //trainer[trainernum][index].evade = poke[index].evade;
   for(var atts = 0; atts < 4; atts++)
   {
	trainer[trainernum][index].attack[atts] = poke[index].attack[atts] + "()";
	trainer[trainernum][index].power[atts] = getPowerPoints(trainer[trainernum][index].attack[atts]);
   }
}
function luckyLucky(index)
{
   var unlucky = 0;
   for(var i = 0; i < 6; i++)
   {
      if(trainer[index][i].name == "Mewtwo")
         unlucky++;
      if(trainer[index][i].name == "Mew")
         unlucky++;
      if(trainer[index][i].name == "Articuno")
         unlucky++;
      if(trainer[index][i].name == "Zapdos")
         unlucky++;
      if(trainer[index][i].name == "Moltres")
         unlucky++;
      if(trainer[index][i].name == "Dragonite")
         unlucky++;
   }
   if(unlucky == 1)
      unlucky = 0;
   unlucky*= .1;
   for(var n = 0; n < 6; n++)
   {
      trainer[index][n].accuracy-= unlucky;
      trainer[index][n].evade-= unlucky;
      trainer[index][n].baseaccuracy-= unlucky;
      trainer[index][n].baseevade-= unlucky;
   }
}
function FindNextSpace()
{
   for(var check = 1; check <= 12; check++)
   {
      if(getCookie("repokemon" + check) == "")
         return check;
   }
   return 13;
}
function setCookie(name,value)
{
  var next = new Date();
  next.setYear(next.getYear() + 1);
  document.cookie = name + '=' + value + '; expires=' + next.toGMTString() + ';';
}
function getCookie(name)
{
  name+= "=";
  var cookieFound = false;
  var start = 0;
  var end = 0;
  var cookieString = document.cookie;
  var i = 0;
  while (i <= cookieString.length)
  {
    start = i;
    end = start + name.length;
    if (cookieString.substring(start,end) == name)
    {
      cookieFound = true;
      break;
    }
    i++;
  }
  if(cookieFound)
  {
    start = end;
    end = document.cookie.indexOf(";",start); 
    if (end < start)
      end = document.cookie.length; 
    return document.cookie.substring(start,end); 
  }
  return "";
}
function getSearch(name)
{
  name+= "=";
  var searchFound = false;
  var start = 0;
  var end = 0;
  var searchString = unescape(location.search);
  var i = 0;
  while (i <= searchString.length)
  {
    start = i;
    end = start + name.length;
    if (searchString.substring(start,end) == name)
    {
      searchFound = true;
      break;
    }
    i++;
  }
  if(searchFound)
  {
    start = end;
    end = searchString.indexOf(";",start); 
    if (end < start)
      end = searchString.length; 
    return searchString.substring(start,end); 
  }
  return "";
}
function doKPB()
{
   for(var i = 0; i < 6; i++)
   {
      decodePokeSearch(i, "kpbpok");
      trainer[0][i] = new Pokemon(poke[i].name);
	trainer[0][i].level = poke[i].accuracy;
      if(poke[i].name != "")
         equalizePoke(i, 0, 0);
   }
   for(var n = 0; n < 6; n++)
   {
      decodePokeSearch(n, "kpbgym");
      trainer[1][n] = new Pokemon(poke[n].name);
	trainer[1][n].level = poke[n].accuracy;
      if(poke[n].name != "")
         equalizePoke(n, 1, 0);
   }
   document.write('<center><table border=4 bgcolor="#ffffff"><tr><td align=left><b>' + getSearch("chal") + '</b><td align=right><b>' + getSearch("lead") + '</b><tr><td align=center><img name=pokepic0><td align=center><img name=pokepic1><tr><td align=center><input name=life0 type=text size=7 onFocus="blur();"><td align=center><input name=life1 type=text size=10 onFocus="blur();"><tr><td colspan=2 align=center><select name="chooseact" onChange="SwitchOptions();"><option value="">--Choose--<option value="attack">Attack<option value="switch">Switch');
   if(getSearch("pokeball") != "" || getSearch("greatball") != "")
      document.write('<option value="catch">Catch');
document.write('</select><select name=playerchoice onChange="CheckChoice();"><option value=-1>--Choose--</select><tr><td colspan=2 align=center><textarea name=message cols=50 rows=10 onFocus="blur();">Begin\n</text' + 'area></table></center><form method=post action="http://realitysend.virtualave.net/cgi-bin/kpb.pl" name=winform><input type=hidden name=leader value="' + getSearch("lead") + '"><input type=hidden name=challenger value="' + getSearch("chal") + '"><input type=hidden name=victor value="' + getSearch("lead") + '"><input type=hidden name=blackbox value=""></form>');
   if(getCookie(getSearch("chal") + getSearch("lead")) != "")
   {
	winform.blackbox.value = "This person has attempted to re-enter the battle. He ran before, so this battle counts as a loss.";
	winform.submit();
   }
   blackbox = getSearch("chal") + " is using:\n";
   for(var bb = 0; bb < 6; bb++)
      if(trainer[0][bb].name != "")
         blackbox+= "Level " + trainer[0][bb].level + " " + trainer[0][bb].name + " with " + trainer[0][bb].attack[0].substring(0, trainer[0][bb].attack[0].length - 2) + ", " + trainer[0][bb].attack[1].substring(0, trainer[0][bb].attack[1].length - 2) + ", " + trainer[0][bb].attack[2].substring(0, trainer[0][bb].attack[2].length - 2) + ", and " + trainer[0][bb].attack[3].substring(0, trainer[0][bb].attack[3].length - 2) + "\n"; 
   blackbox+= getSearch("lead") + " is using:\n";
   for(bb = 0; bb < 6; bb++)
      if(trainer[1][bb].name != "")
         blackbox+= "Level " + trainer[1][bb].level + " " + trainer[1][bb].name + " with " + trainer[1][bb].attack[0] + ", " + trainer[1][bb].attack[1] + ", " + trainer[1][bb].attack[2] + ", and " + trainer[1][bb].attack[3] + "\n"; 
   setCookie(getSearch("chal") + getSearch("lead"), "1");
   SetBattleField(0,0);
   SetBattleField(1,0);
   BeginTurn();
}
function doit()
{
   for(var i = 0; i < 6; i++)
   {
      decodePokeCookie(i, "repokemon");
      trainer[0][i] = new Pokemon(poke[i].name);
      equalizePoke(i, 0, 0);
   }
   luckyLucky(0);
   for(var n = 0; n < 6; n++)
   {
      decodePokeSearch(n, "regympoke");
      trainer[1][n] = new Pokemon(poke[n].name);
      if(getSearch("rebadgeatt") != "")
	{
	   var bonus = getBadgeBonus(getSearch("rebadgeatt"));
	   if(bonus == 0)
	   {
	      alert("Warning! You are at a gym using pirated code! You are now being transported to a real gym so that you may earn a true R.E. League badge.");
      	document.URL = "http://www.angelfire.com/oh2/realitysend/poliwhirl/gym/index.html";
	   }
         equalizePoke(n, 1, bonus);
	}
      else
         if(poke[n].name != "")
            equalizePoke(n, 1, getSearch("difficulty"));
   }
   luckyLucky(1);
   document.write('<center><table border=4 , bgcolor="#ffffff"><tr><td align=left><b>Trainer</b><td align=right><b>');
   if(getSearch("rebadgeatt") != "")
      document.write("Leader");
   if(getSearch("trainer") != "")
      document.write(getSearch("trainer"));
   document.write('</b><tr><td align=center><img name=pokepic0><td align=center><img name=pokepic1><tr><td align=center><input name=life0 type=text size=7 onFocus="blur();"><td align=center><input name=life1 type=text size=10 onFocus="blur();"><tr><td colspan=2 align=center><select name="chooseact" onChange="SwitchOptions();"><option value="">--Choose--<option value="attack">Attack<option value="switch">Switch');
   if(getSearch("wild") == 1)
      document.write('<option value="catch">Catch');
   document.write('</select><select name=playerchoice onChange="CheckChoice();"><option value=-1>--Choose--</select><tr><td colspan=2 align=center><textarea name=message cols=50 rows=10 onFocus="blur();">Begin\n</text' + 'area></table></center>');
   SetBattleField(0,0);
   SetBattleField(1,0);
   BeginTurn();
}
//Begin Declaration of Global Variables
var trainer = new Array(1);
trainer[0] = new Array(5);
trainer[1] = new Array(5);
var poke = new Array(11);
var playerinput = "";
var aiinput = "";
var juggle = 0;
var lastattack = new Array(1);
lastattack[0] = "";
lastattack[1] = "";
var payday = 0;
var active = new Array(1);
active[0] = new Pokemon();
active[1] = new Pokemon();
var current = new Array(1);
current[0] = 0;
current[1] = 0;
var formnotyetsubmitted = true;
var blackbox = "";
