//CONSTRUCTOR

function RewardItem(playerFaction, itemName, itemIcon, itemMoneyPrice, itemHonorPrice, itemTokenPrice, itemCost, itemStats, itemHTML)
{													//Constructor for RewardItem datatype; accepts up to 7 arguments
  this.playerFaction	 		= playerFaction;					//string variable, can be "alliance", "horde" or "both"
  this.itemName		 	 			= itemName;								//string variable, contains the name shown in the rewards list
  this.itemIcon		 	 			= itemIcon;								//string variable, contains path to item icon to be used
  this.itemMoneyPrice			=	itemMoneyPrice;
  this.itemHonorPrice		 	= itemHonorPrice;					//how much the item costs, in HONOR POINTS
  this.itemTokenPrice			= itemTokenPrice;
  this.itemCost						= itemCost;
	this.itemStats		 			= itemStats;							//Array
  this.itemHTML			 			= itemHTML;								//string variable, contains the HTML code for the item
}

tokenIcons = new Array("sporeggar","arathi","nether","warsong");
//(thisObject.itemTokenPrice) ? processPrice(thisObject.itemHonorPrice[thisBracket],thisObject.itemTokenPrice[thisBracket]) : 
function selectBracket(thisObject,thisBracket)
{
  if (thisBracket >= 0)
  {
    if (thisObject.itemStats[thisBracket])
		{
			thisObject.itemCost = generateCostString(thisObject,thisBracket);
			thisObject.itemHTML = thisObject.itemStats[thisBracket];
		}
    else
		{
			thisObject.itemHTML = "none";
			thisObject.itemCost = "none";
			//selectBracket(thisObject,thisBracket-1);
		}
  }
}

function generateCostString(thisObject,thisBracket)
{
	outPutString = "";
	if(thisObject.itemMoneyPrice && thisObject.itemMoneyPrice[thisBracket])
	{
		copperPart = thisObject.itemMoneyPrice[thisBracket];
		goldPart = Math.floor(copperPart / 10000);
		if (goldPart >= 1) copperPart -= goldPart * 10000;
		silverPart = Math.floor(copperPart / 100);
		if (silverPart >= 1) copperPart -= silverPart * 100;
		if (goldPart > 0) outPutString += goldPart+"<img src='/shared/wow-com/images/basics/factions/gold.gif'>&nbsp;";
		if (silverPart > 0) outPutString += silverPart+"<img src='/shared/wow-com/images/basics/factions/silver.gif'>&nbsp;";
		if (copperPart > 0) outPutString += copperPart+"<img src='/shared/wow-com/images/basics/factions/copper.gif'>&nbsp;";
	}
	if(thisObject.itemHonorPrice && thisObject.itemHonorPrice[thisBracket])
	{
		outPutString += thisObject.itemHonorPrice[thisBracket]+"<img src='/shared/wow-com/images/basics/factions/"+thisObject.playerFaction+"-honor.gif'>&nbsp;";
	}
	if(thisObject.itemTokenPrice && thisObject.itemTokenPrice[thisBracket])
	{
		for(carl=0; carl<thisObject.itemTokenPrice[thisBracket].length; carl++)
		{
			if (thisObject.itemTokenPrice[thisBracket][carl] > 0) outPutString += thisObject.itemTokenPrice[thisBracket][carl]+"<img src='/shared/wow-com/images/basics/arena/rewards/icons/"+tokenIcons[carl]+".gif'>&nbsp;";
		}
	}
	return outPutString;
}

//------BEGIN REWARDS DEFINITION------
i = 0;
var RewardItems = new Array();

var fDesignPotentFlameSpessarite = new RewardItem("alliance","Design: Potent Flame Spessarite","/shared/wow-com/images/basics/arena/rewards/icons/INV_Scroll_06.gif");
fDesignPotentFlameSpessarite.itemMoneyPrice = new Array();
fDesignPotentFlameSpessarite.itemMoneyPrice[0] = 60000
fDesignPotentFlameSpessarite.itemStats = new Array();
fDesignPotentFlameSpessarite.itemStats[0] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myGreen\">Design: Potent Flame Spessarite</span>\
<br>Binds when picked up<br>Requires Jewelcrafting (325)<br>Requires Lower City - Friendly<br>Use: Teaches you how to cut a Potent Flame Spessarite.<br>\
<br>\
<span class=\"myGreen\">Potent Flame Spessarite</span>\
<br>+3 Spell Critical Rating and +4 Spell Damage <br>\
<span class=\"myYellow\">\"Matches a Yellow or Red Socket.\"</span>\
<br>Requires Flame Spessarite</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fDesignPotentFlameSpessarite; ++i;

var fPatternCloakOfArcaneEvasion = new RewardItem("alliance","Pattern: Cloak of Arcane Evasion","/shared/wow-com/images/basics/arena/rewards/icons/INV_Scroll_03.gif");
fPatternCloakOfArcaneEvasion.itemMoneyPrice = new Array();
fPatternCloakOfArcaneEvasion.itemMoneyPrice[1] = 60000
fPatternCloakOfArcaneEvasion.itemStats = new Array();
fPatternCloakOfArcaneEvasion.itemStats[1] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">Pattern: Cloak of Arcane Evasion<br>Binds when picked up<br>Requires Tailoring (350)<br>Requires Lower City - Honored<br>Use: Teaches you how to sew a Cloak of Arcane Evasion.<br>\
<br>\
<span class=\"myBlue\">Cloak of Arcane Evasion</span>\
<br>Binds when equipped<br>Back<br>76 Armor<br>+12 Stamina<br>+32 Arcane Resistance<br>Requires Level 69<br><br>Requires Bolt of Imbued Netherweave (4), Primal Mana (3), Primal Life (3), Netherweb Spider Silk (2)</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fPatternCloakOfArcaneEvasion; ++i;

var fGlyphOfShadowWarding = new RewardItem("alliance","Glyph of Shadow Warding","/shared/wow-com/images/basics/arena/rewards/icons/Spell_Shadow_SealOfKings.gif");
fGlyphOfShadowWarding.itemMoneyPrice = new Array();
fGlyphOfShadowWarding.itemMoneyPrice[1] = 1000000
fGlyphOfShadowWarding.itemStats = new Array();
fGlyphOfShadowWarding.itemStats[1] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myGreen\">Glyph of Shadow Warding</span>\
<br>Binds when picked up<br>Requires Level 70<br>Requires Lower City - Honored<br>\
<span class=\"myGreen\">Use: Permanently adds 20 Shadow resistance to a head slot item. Does not stack with other enchantments for the selected equipment slot.</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fGlyphOfShadowWarding; ++i;

var fDesignFelsteelBoar = new RewardItem("alliance","Design: Felsteel Boar","/shared/wow-com/images/basics/arena/rewards/icons/INV_Scroll_05.gif");
fDesignFelsteelBoar.itemMoneyPrice = new Array();
fDesignFelsteelBoar.itemMoneyPrice[2] = 120000
fDesignFelsteelBoar.itemStats = new Array();
fDesignFelsteelBoar.itemStats[2] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myBlue\">Design: Felsteel Boar</span>\
<br>Binds when picked up<br>Requires Jewelcrafting (370)<br>Requires Lower City - Revered<br>Use: Teaches you how to craft a Felsteel Boar.<br>\
<br>\
<span class=\"myBlue\">Figurine - Felsteel Boar</span>\
<br>Binds when picked up<br>Unique<br>Trinket<br>Requires Level 70<br>\
<span class=\"myGreen\">Equip: Increases attack power by 68.</span>\
<br>\
<span class=\"myGreen\">Use: Summons the Felsteel Boar to fight for you for 30 seconds.</span>\
<br><br>Requires Felsteel Bar (8), Blood Garnet (2), Primal Earth (4)</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fDesignFelsteelBoar; ++i;

var fDesignPendantOfThawing = new RewardItem("alliance","Design: Pendant of Thawing","/shared/wow-com/images/basics/arena/rewards/icons/INV_Scroll_05.gif");
fDesignPendantOfThawing.itemMoneyPrice = new Array();
fDesignPendantOfThawing.itemMoneyPrice[2] = 120000
fDesignPendantOfThawing.itemStats = new Array();
fDesignPendantOfThawing.itemStats[2] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myBlue\">Design: Pendant of Thawing</span>\
<br>Binds when picked up<br>Requires Jewelcrafting (360)<br>Requires Lower City - Revered<br>Use: Teaches you how to craft a Pendant of Thawing.<br>\
<br>\
<span class=\"myBlue\">Pendant of Thawing</span>\
<br>Binds when equipped<br>Neck<br>+18 Stamina<br>+30 Frost Resistance<br>Requires Level 70<br>\
<span class=\"myGreen\">Use: Absorbs 900 to 2700 frost damage on all nearby party members.  Lasts 5 min.<br>10 Charges</span>\
<br><br>Requires Felsteel Bar (2), Primal Fire (6), Primal Water (4), Mercurial Adamantite</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fDesignPendantOfThawing; ++i;

var fRecipeElixirOfMajorShadowPower = new RewardItem("alliance","Recipe: Elixir of Major Shadow Power","/shared/wow-com/images/basics/arena/rewards/icons/INV_Scroll_06.gif");
fRecipeElixirOfMajorShadowPower.itemMoneyPrice = new Array();
fRecipeElixirOfMajorShadowPower.itemMoneyPrice[2] = 80000
fRecipeElixirOfMajorShadowPower.itemStats = new Array();
fRecipeElixirOfMajorShadowPower.itemStats[2] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myGreen\">Recipe: Elixir of Major Shadow Power</span>\
<br>Binds when picked up<br>Requires Alchemy (350)<br>Requires Lower City - Revered<br>Use: Teaches you how to make an Elixir of Major Shadow Power.<br>\
<br>Elixir of Major Shadow Power<br>Requires Level 60<br>\
<span class=\"myGreen\">Use: Increases shadow spell damage by up to 55 for 1 hour. Battle Elixir.</span>\
<br><br>Requires Ancient Lichen, Nightmare Vine, Imbued Vial</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fRecipeElixirOfMajorShadowPower; ++i;

var fAuchenaiKey = new RewardItem("alliance","Auchenai Key","/shared/wow-com/images/basics/arena/rewards/icons/INV_Misc_Key_11.gif");
fAuchenaiKey.itemMoneyPrice = new Array();
fAuchenaiKey.itemMoneyPrice[1] = 100000
fAuchenaiKey.itemStats = new Array();
fAuchenaiKey.itemStats[1] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">Auchenai Key<br>Binds when picked up<br>Unique<br>Requires Lower City - Revered<br>\
<span class=\"myYellow\">\"Unlocks access to  Heroic mode for Auchindoun dungeons.\"</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fAuchenaiKey; ++i;

var fGlyphOfTheOutcast = new RewardItem("alliance","Glyph of the Outcast","/shared/wow-com/images/basics/arena/rewards/icons/Ability_Rogue_MasterOfSubtl.gif");
fGlyphOfTheOutcast.itemMoneyPrice = new Array();
fGlyphOfTheOutcast.itemMoneyPrice[2] = 1000000
fGlyphOfTheOutcast.itemStats = new Array();
fGlyphOfTheOutcast.itemStats[2] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myGreen\">Glyph of the Outcast</span>\
<br>Binds when picked up<br>Requires Level 70<br>Requires Lower City - Revered<br>\
<span class=\"myGreen\">Use: Permanently adds 17 Strength and 16 Intellect to a head slot item. Does not stack with other enchantments for the selected equipment slot.</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fGlyphOfTheOutcast; ++i;

var fLeggingsOfTheSkettisExile = new RewardItem("alliance","Leggings of the Skettis Exile","/shared/wow-com/images/basics/arena/rewards/icons/INV_Pants_Cloth_09.gif");
fLeggingsOfTheSkettisExile.itemMoneyPrice = new Array();
fLeggingsOfTheSkettisExile.itemMoneyPrice[2] = 174403
fLeggingsOfTheSkettisExile.itemStats = new Array();
fLeggingsOfTheSkettisExile.itemStats[2] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myBlue\">Leggings of the Skettis Exile</span>\
<br>Binds when picked up<br>Legs<span class=\"myRight\">Cloth</span>\
<br>136 Armor<br>+33 Intellect<br>+33 Spirit<br>Durability 65 / 65<br>Requires Level 70<br>Requires Lower City - Revered<br>\
<span class=\"myGreen\">Equip: Increases damage and healing done by magical spells and effects by up to 39.</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fLeggingsOfTheSkettisExile; ++i;

var fSalvagersHauberk = new RewardItem("alliance","Salvager's Hauberk","/shared/wow-com/images/basics/arena/rewards/icons/INV_Chest_Plate09.gif");
fSalvagersHauberk.itemMoneyPrice = new Array();
fSalvagersHauberk.itemMoneyPrice[2] = 260629
fSalvagersHauberk.itemStats = new Array();
fSalvagersHauberk.itemStats[2] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myBlue\">Salvager's Hauberk</span>\
<br>Binds when picked up<br>Chest<span class=\"myRight\">Mail</span>\
<br>652 Armor<br>+49 Stamina<br>Durability 120 / 120<br>Requires Level 70<br>Requires Lower City - Revered<br>\
<span class=\"myGreen\">Equip: Improves critical strike rating by 33.</span>\
<br>\
<span class=\"myGreen\">Equip: Increases attack power by 66.</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fSalvagersHauberk; ++i;

var fLowerCityPrayerbook = new RewardItem("alliance","Lower City Prayerbook","/shared/wow-com/images/basics/arena/rewards/icons/INV_Misc_Book_11.gif");
fLowerCityPrayerbook.itemMoneyPrice = new Array();
fLowerCityPrayerbook.itemMoneyPrice[2] = 175952
fLowerCityPrayerbook.itemStats = new Array();
fLowerCityPrayerbook.itemStats[2] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myBlue\">Lower City Prayerbook</span>\
<br>Binds when picked up<br>Trinket<br>Requires Level 70<br>Requires Lower City - Revered<br>\
<span class=\"myGreen\">Equip: Increases healing done by spells and effects by up to 70.</span>\
<br>\
<span class=\"myGreen\">Use: Your heals each cost 22 less mana for the next 15 sec.</span>\
<br>\
<span class=\"myYellow\">\"Short prayers from a dozen different faiths are contained in this book.\"</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fLowerCityPrayerbook; ++i;

var fRecipeFlaskOfChromaticResistance = new RewardItem("alliance","Recipe: Flask of Chromatic Resistance","/shared/wow-com/images/basics/arena/rewards/icons/INV_Scroll_06.gif");
fRecipeFlaskOfChromaticResistance.itemMoneyPrice = new Array();
fRecipeFlaskOfChromaticResistance.itemMoneyPrice[3] = 40000
fRecipeFlaskOfChromaticResistance.itemStats = new Array();
fRecipeFlaskOfChromaticResistance.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myGreen\">Recipe: Flask of Chromatic Resistance</span>\
<br>Requires Alchemy (300)<br>Requires Lower City - Exalted<br>Use: Teaches you how to make a Flask of Chromatic Resistance.<br>\
<br>Flask of Chromatic Resistance<br>Requires Level 50<br>\
<span class=\"myGreen\">Use: Increases your resistance to all schools of magic by 25 for 2 hours. Counts as both a Battle and Guardian Elixir. This effect persists through death.</span>\
<br>\
<br>Requires Icecap (7), Mountain Silversage (3), Black Lotus, Crystal Vial</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fRecipeFlaskOfChromaticResistance; ++i;

var fGavelOfUnearthedSecrets = new RewardItem("alliance","Gavel of Unearthed Secrets","/shared/wow-com/images/basics/arena/rewards/icons/INV_Hammer_08.gif");
fGavelOfUnearthedSecrets.itemMoneyPrice = new Array();
fGavelOfUnearthedSecrets.itemMoneyPrice[3] = 482214
fGavelOfUnearthedSecrets.itemStats = new Array();
fGavelOfUnearthedSecrets.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myPurple\">Gavel of Unearthed Secrets</span>\
<br>Binds when picked up<br>Main Hand<span class=\"myRight\">Mace</span>\
<br>45 - 178 Damage<span class=\"myRight\">Speed 2.70</span>\
<br>(41.3 damage per second)<br>+24 Stamina<br>+16 Intellect<br>Durability 105 / 105<br>Requires Level 70<br>Requires Lower City - Exalted<br>\
<span class=\"myGreen\">Equip: Improves spell critical strike rating by 15.</span>\
<br>\
<span class=\"myGreen\">Equip: Increases damage and healing done by magical spells and effects by up to 159.</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fGavelOfUnearthedSecrets; ++i;

var fShapeshiftersSignet = new RewardItem("alliance","Shapeshifter's Signet","/shared/wow-com/images/basics/arena/rewards/icons/INV_Jewelry_Ring_41.gif");
fShapeshiftersSignet.itemMoneyPrice = new Array();
fShapeshiftersSignet.itemMoneyPrice[3] = 197528
fShapeshiftersSignet.itemStats = new Array();
fShapeshiftersSignet.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myPurple\">Shapeshifter's Signet</span>\
<br>Binds when picked up<br>Unique<br>Finger<br>+25 Agility<br>+18 Stamina<br>Requires Level 70<br>Requires Lower City - Exalted<br>\
<span class=\"myGreen\">Equip: Increases feral combat skill rating by 20.</span>\
<br>\
<span class=\"myGreen\">Equip: Increases dagger skill rating by 20.</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fShapeshiftersSignet; ++i;

var fTridentOfTheOutcastTribe = new RewardItem("alliance","Trident of the Outcast Tribe","/shared/wow-com/images/basics/arena/rewards/icons/INV_Spear_04.gif");
fTridentOfTheOutcastTribe.itemMoneyPrice = new Array();
fTridentOfTheOutcastTribe.itemMoneyPrice[3] = 2392799
fTridentOfTheOutcastTribe.itemStats = new Array();
fTridentOfTheOutcastTribe.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myPurple\">Trident of the Outcast Tribe</span>\
<br>Binds when picked up<br>Two Hand<span class=\"myRight\">Polearm</span>\
<br>270 - 406 Damage<span class=\"myRight\">Speed 3.20</span>\
<br>(105.6 damage per second)<br>+37 Strength<br>+54 Stamina<br>Durability 120 / 120<br>Requires Level 70<br>Requires Lower City - Exalted<br>\
<span class=\"myGreen\">Equip: Improves hit rating by 36.</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fTridentOfTheOutcastTribe; ++i;

var fLowerCityTabard = new RewardItem("alliance","Lower City Tabard","/shared/wow-com/images/basics/factions/alteracvalley/stormpikebattletabard.gif");
fLowerCityTabard.itemMoneyPrice = new Array();
fLowerCityTabard.itemMoneyPrice[3] = 10000
fLowerCityTabard.itemStats = new Array();
fLowerCityTabard.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">Lower City Tabard<br>Binds when picked up<br>Unique<br>Tabard<br>Requires Lower City - Exalted</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fLowerCityTabard; ++i;



//-------------------------------------------------------------------
//---Horde below







//------END REWARDS DEFINITION------
