//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("apexis_shard","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='http://wowimg.the9.com/images_wow/gameinfo/factions/icons/gold.gif'>&nbsp;";
		if (silverPart > 0) outPutString += silverPart+"<img src='http://wowimg.the9.com/images_wow/gameinfo/factions/icons/silver.gif'>&nbsp;";
		if (copperPart > 0) outPutString += copperPart+"<img src='http://wowimg.the9.com/images_wow/gameinfo/factions/icons/copper.gif'>&nbsp;";
	}
	if(thisObject.itemHonorPrice && thisObject.itemHonorPrice[thisBracket])
	{
		outPutString += thisObject.itemHonorPrice[thisBracket]+"<img src='http://wowimg.the9.com/images_wow/gameinfo/factions/ogrila/apexis_crystal.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='http://wowimg.the9.com/images_wow/gameinfo/factions/ogrila/"+tokenIcons[carl]+".gif'>&nbsp;";
		}
	}
	return outPutString;
}

//------BEGIN REWARDS DEFINITION------
i = 0;
var RewardItems = new Array();

//---Friendly below

var fEnrichedTeroconeJuice = new RewardItem("alliance","浓缩泰罗果汁","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/inv_drink_09.gif");
fEnrichedTeroconeJuice.itemMoneyPrice = new Array();
fEnrichedTeroconeJuice.itemMoneyPrice[0] = 4000
fEnrichedTeroconeJuice.itemStats = new Array();
fEnrichedTeroconeJuice.itemStats[0] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myWhite\">浓缩泰罗果汁</span>\
<br>唯一 (20)<br>\
需要等级 65<br>\
需要 沙塔尔天空卫队 - 友善<br>\
<span class=\"myGreen\">使用：在30秒内恢复4320点生命值和5100点法力值。进食时必须保持坐姿。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fEnrichedTeroconeJuice; ++i;



//---Honored below

var fSkyguardRations = new RewardItem("alliance","天空卫队军粮","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/inv_misc_food_63.gif");
fSkyguardRations.itemMoneyPrice = new Array();
fSkyguardRations.itemMoneyPrice[1] = 4500
fSkyguardRations.itemStats = new Array();
fSkyguardRations.itemStats[1] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myWhite\">天空卫队军粮</span>\
<br>唯一 (20)<br>\
需要等级 56<br>\
需要 沙塔尔天空卫队 - 尊敬<br>\
<span class=\"myGreen\">使用：在30秒内恢复6000点生命值。进食时必须保持坐姿。如果你花费至少10秒钟来进食，你的耐力将提高15点，精神将提高15点，持续15分钟。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fSkyguardRations; ++i;


//---Revered below

var fSkyguardsDrape = new RewardItem("alliance","天空卫队的披风","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/inv_misc_cape_08.gif");
fSkyguardsDrape.itemMoneyPrice = new Array();
fSkyguardsDrape.itemMoneyPrice[2] = 138166
fSkyguardsDrape.itemStats = new Array();
fSkyguardsDrape.itemStats[2] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myBlue\">天空巫师的披风</span>\
<br>拾取后绑定<br>背部<br>\
78点护甲<br>+15 敏捷<br>\
需要等级 70<br>\
需要 沙塔尔天空卫队 - 崇敬<br>\
<span class=\"myGreen\">装备：攻击强度提高52点。<br>使用：使你的坠落速度减缓10秒。（30分钟冷却时间）</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fSkyguardsDrape; ++i;

var fSkywitchsDrape = new RewardItem("alliance","天空巫师的披风","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/inv_misc_cape_05.gif");
fSkywitchsDrape.itemMoneyPrice = new Array();
fSkywitchsDrape.itemMoneyPrice[2] = 137691
fSkywitchsDrape.itemStats = new Array();
fSkywitchsDrape.itemStats[2] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myBlue\">天空巫师的披风</span>\
<br>拾取后绑定<br>背部<br>\
78点护甲<br>+15 智力<br>\
需要等级 70<br>\
需要 沙塔尔天空卫队 - 崇敬<br>\
<span class=\"myGreen\">装备：提高所有法术和魔法效果所造成的伤害和治疗效果，最多30点。<br>使用：使你的坠落速度减缓10秒。（30分钟冷却时间）</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fSkywitchsDrape; ++i;



//---Exalted below

var fAirmansRibbonofGallantry = new RewardItem("alliance","飞行员的勇气绶带","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/inv_misc_ribbon_01.gif");
fAirmansRibbonofGallantry.itemMoneyPrice = new Array();
fAirmansRibbonofGallantry.itemMoneyPrice[3] = 41230
fAirmansRibbonofGallantry.itemStats = new Array();
fAirmansRibbonofGallantry.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myPurple\">飞行员的勇气绶带</span>\
<br>拾取后绑定<br>唯一<br>饰品<br>需要等级 70<br>\
需要 沙塔尔天空卫队 - 崇拜<br>\
<span class=\"myGreen\">装备：法术爆击等级提高34。<br>装备：当你杀死一个可以为你提供经验值或荣誉值的目标之后，有50%的几率获得80点的法术伤害和治疗效果加成，持续30秒。这个效果每10秒只能出现一次。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fAirmansRibbonofGallantry; ++i;

var fSkyguardSilverCross = new RewardItem("alliance","天空卫队银十字勋章","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/inv_jewelry_talisman_06.jpg");
fSkyguardSilverCross.itemMoneyPrice = new Array();
fSkyguardSilverCross.itemMoneyPrice[3] = 41230
fSkyguardSilverCross.itemStats = new Array();
fSkyguardSilverCross.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myPurple\">天空卫队银十字勋章</span>\
<br>拾取后绑定<br>唯一<br>饰品<br>需要等级 70<br>\
需要 沙塔尔天空卫队 - 崇拜<br>\
<span class=\"myGreen\">装备：爆击等级提高34。<br>装备：当你杀死一个可以为你提供经验值或荣誉值的目标之后，有50%的几率获得140点的攻击强度加成，持续30秒。这个效果每10秒只能出现一次。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fSkyguardSilverCross; ++i;

var fGreenRidingNetherRay = new RewardItem("alliance","绿色骑乘虚空鳐","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/ability_hunter_pet_netherray.gif");
fGreenRidingNetherRay.itemMoneyPrice = new Array();
fGreenRidingNetherRay.itemMoneyPrice[3] = 2000000
fGreenRidingNetherRay.itemStats = new Array();
fGreenRidingNetherRay.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myPurple\">绿色骑乘虚空鳐</span>\
<br>拾取后绑定<br>唯一<br>\
需要等级 70<br>需要骑术 (300)<br>\
需要 沙塔尔天空卫队 - 崇拜<br>\
<span class=\"myGreen\">使用：召唤或解散一头可供骑乘的虚空鳐坐骑。这是一种速度非常快的坐骑。只能在外域召唤这种坐骑。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fGreenRidingNetherRay; ++i;

var fPurpleRidingNetherRay = new RewardItem("alliance","紫色骑乘虚空鳐","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/ability_hunter_pet_netherray.gif");
fPurpleRidingNetherRay.itemMoneyPrice = new Array();
fPurpleRidingNetherRay.itemMoneyPrice[3] = 2000000
fPurpleRidingNetherRay.itemStats = new Array();
fPurpleRidingNetherRay.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myPurple\">紫色骑乘虚空鳐</span>\
<br>拾取后绑定<br>唯一<br>\
需要等级 70<br>需要骑术 (300)<br>\
需要 沙塔尔天空卫队 - 崇拜<br>\
<span class=\"myGreen\">使用：召唤或解散一头可供骑乘的虚空鳐坐骑。这是一种速度非常快的坐骑。只能在外域召唤这种坐骑。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fPurpleRidingNetherRay; ++i;

var fSilverRidingNetherRay = new RewardItem("alliance","银色骑乘虚空鳐","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/ability_hunter_pet_netherray.gif");
fSilverRidingNetherRay.itemMoneyPrice = new Array();
fSilverRidingNetherRay.itemMoneyPrice[3] = 2000000
fSilverRidingNetherRay.itemStats = new Array();
fSilverRidingNetherRay.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myPurple\">银色骑乘虚空鳐</span>\
<br>拾取后绑定<br>唯一<br>\
需要等级 70<br>需要骑术 (300)<br>\
需要 沙塔尔天空卫队 - 崇拜<br>\
<span class=\"myGreen\">使用：召唤或解散一头可供骑乘的虚空鳐坐骑。这是一种速度非常快的坐骑。只能在外域召唤这种坐骑。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fSilverRidingNetherRay; ++i;

var fRedRidingNetherRay = new RewardItem("alliance","红色骑乘虚空鳐","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/ability_hunter_pet_netherray.gif");
fRedRidingNetherRay.itemMoneyPrice = new Array();
fRedRidingNetherRay.itemMoneyPrice[3] = 2000000
fRedRidingNetherRay.itemStats = new Array();
fRedRidingNetherRay.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myPurple\">红色骑乘虚空鳐</span>\
<br>拾取后绑定<br>唯一<br>\
需要等级 70<br>需要骑术 (300)<br>\
需要 沙塔尔天空卫队 - 崇拜<br>\
<span class=\"myGreen\">使用：召唤或解散一头可供骑乘的虚空鳐坐骑。这是一种速度非常快的坐骑。只能在外域召唤这种坐骑。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fRedRidingNetherRay; ++i;

var fBlueRidingNetherRay = new RewardItem("alliance","蓝色骑乘虚空鳐","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/ability_hunter_pet_netherray.gif");
fBlueRidingNetherRay.itemMoneyPrice = new Array();
fBlueRidingNetherRay.itemMoneyPrice[3] = 2000000
fBlueRidingNetherRay.itemStats = new Array();
fBlueRidingNetherRay.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myPurple\">蓝色骑乘虚空鳐</span>\
<br>拾取后绑定<br>唯一<br>\
需要等级 70<br>需要骑术 (300)<br>\
需要 沙塔尔天空卫队 - 崇拜<br>\
<span class=\"myGreen\">使用：召唤或解散一头可供骑乘的虚空鳐坐骑。这是一种速度非常快的坐骑。只能在外域召唤这种坐骑。</span>\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fBlueRidingNetherRay; ++i;

var fSkyguardTabard = new RewardItem("alliance","天空卫队徽章","http://wowimg.the9.com/images_wow/gameinfo/factions/icons/stormpikebattletabard.gif");
fSkyguardTabard.itemMoneyPrice = new Array();
fSkyguardTabard.itemMoneyPrice[3] = 10000
fSkyguardTabard.itemStats = new Array();
fSkyguardTabard.itemStats[3] = "\
<table width=\"275\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\
<tr>\
<td>\
<div class=\"myTable\">\
<span class=\"myWhite\">天空卫队徽章</span>\
<br>拾取后绑定<br>唯一<br>\
公会徽章<br>\
需要等级 70<br>\
需要 沙塔尔天空卫队 - 崇拜\
</div>\
</td>\
</tr>\
</table>\
";
RewardItems[i] = fSkyguardTabard; ++i;


//-------------------------------------------------------------------

//------END REWARDS DEFINITION------



