

var gamePage = {
	  1 : {'gamePageId':1, 'gamePageName':'Age of Conan', 'gamePagePath':'age-of-conan/'},
		2 : {'gamePageId':2, 'gamePageName':'Atlantica Online', 'gamePagePath':'atlantica/'},
		3 : {'gamePageId':3, 'gamePageName':'EVE Online', 'gamePagePath':'eve/'},
		4 : {'gamePageId':4, 'gamePageName':'EverQuest 2', 'gamePagePath':'eq2/'},
		5 : {'gamePageId':5, 'gamePageName':'Final Fantasy XI', 'gamePagePath':'ffxi/'},
		6 : {'gamePageId':6, 'gamePageName':'Guild Wars', 'gamePagePath':'guild-wars/'},
		7 : {'gamePageId':7, 'gamePageName':'Lineage 2', 'gamePagePath':'lineage2/'},
		8 : {'gamePageId':8, 'gamePageName':'Lord of The Rings Online', 'gamePagePath':'lotro/'},
		9 : {'gamePageId':9, 'gamePageName':'Maple Story', 'gamePagePath':'maplestory/'},
		10 : {'gamePageId':10, 'gamePageName':'Runescape', 'gamePagePath':'runescape/'},
		11 : {'gamePageId':11, 'gamePageName':'Warhammer Online', 'gamePagePath':'warhammer/'},
		12 : {'gamePageId':12, 'gamePageName':'World of Warcraft', 'gamePagePath':'wow/'},
		13 : {'gamePageId':13, 'gamePageName':'Aion', 'gamePagePath':'aion/'},
		14 : {'gamePageId':14, 'gamePageName':'DDO Online', 'gamePagePath':'ddo/'},
		15 : {'gamePageId':15, 'gamePageName':'Runes of Magic', 'gamePagePath':'runes-of-magic/'},
		16 : {'gamePageId':16, 'gamePageName':'Darkfall', 'gamePagePath':'darkfall-online/'},
		17 : {'gamePageId':17, 'gamePageName':'Aika Online', 'gamePagePath':'aika-online/'},
		18 : {'gamePageId':18, 'gamePageName':'Fallen Earth', 'gamePagePath':'fallen-earth/'},
		19 : {'gamePageId':19, 'gamePageName':'Dark Age of Camelot', 'gamePagePath':'daoc/'},
		20 : {'gamePageId':20, 'gamePageName':'Rappelz Online', 'gamePagePath':'rappelz-online/'},
		21 : {'gamePageId':21, 'gamePageName':'Star Wars Galaxies', 'gamePagePath':'swg/'},
		22 : {'gamePageId':22, 'gamePageName':'Star Trek Online', 'gamePagePath':'star-trek-online/'},
		23 : {'gamePageId':23, 'gamePageName':'Cabal Online', 'gamePagePath':'cabal-online/'},
		24 : {'gamePageId':24, 'gamePageName':'Champions Online', 'gamePagePath':'champions-online/'},
		25 : {'gamePageId':25, 'gamePageName':'Allods online', 'gamePagePath':'allods-online/'},
		26 : {'gamePageId':26, 'gamePageName':'Alganon', 'gamePagePath':'alganon/'},
		27 : {'gamePageId':27, 'gamePageName':'Mabinogi', 'gamePagePath':'mabinogi/'},
		28 : {'gamePageId':28, 'gamePageName':'Mabinogi', 'gamePagePath':'ffxiv/'}
		
};
var productPage = {
    1 : {'gamePageId':1, 'productPageId':1, 'productPageName':'Basic Powerleveling', 'productPagePath':'power-leveling.html'},
		2 : {'gamePageId':1, 'productPageId':2, 'productPageName':'Part Time Powerleveling', 'productPagePath':'hours.html'},
		
		3 : {'gamePageId':2, 'productPageId':3, 'productPageName':'Basic Powerleveling', 'productPagePath':'power-leveling.html'},
		4 : {'gamePageId':2, 'productPageId':4, 'productPageName':'Part Time Powerleveling', 'productPagePath':'hours.html'},
		
		6 : {'gamePageId':3, 'productPageId':6, 'productPageName':'Amarr Empire Reputation Powerleveling', 'productPagePath':'amarr-empire-reputation.html'},
		8 : {'gamePageId':3, 'productPageId':8, 'productPageName':'Caldari State Reputation Powerleveling', 'productPagePath':'caldari-state-reputation.html'},
		9 : {'gamePageId':3, 'productPageId':9, 'productPageName':'Gallente Federation Reputation Powerleveling', 'productPagePath':'gallente-federation-reputation.html'},
		10 : {'gamePageId':3, 'productPageId':10, 'productPageName':'Minmatar Republic Reputation Powerleveling', 'productPagePath':'minmatar-republic-reputation.html'},
		11 : {'gamePageId':3, 'productPageId':11, 'productPageName':'Part Time Powerleveling', 'productPagePath':'time.html'},
		/*eq2*/
		12 : {'gamePageId':4, 'productPageId':12, 'productPageName':'Basic Powerleveling', 'productPagePath':'power-leveling.html'},
		13 : {'gamePageId':4, 'productPageId':13, 'productPageName':'Part Time Powerleveling', 'productPagePath':'hours.html'},
		13001 : {'gamePageId':4, 'productPageId':13001, 'productPageName':'tradeskill Powerleveling', 'productPagePath':'tradeskill.html'},
		13002 : {'gamePageId':4, 'productPageId':13002, 'productPageName':'AA Powerleveling', 'productPagePath':'aa.html'},
		13003 : {'gamePageId':4, 'productPageId':13003, 'productPageName':'T-O-battlefield', 'productPagePath':'tokens-of-battlefield.html'},
		13004 : {'gamePageId':4, 'productPageId':13004, 'productPageName':'Fabled-weapon', 'productPagePath':'fabled-weapon.html'},
	
		15 : {'gamePageId':5, 'productPageId':15, 'productPageName':'Ammos Powerleveling', 'productPagePath':'ammos-order.html'},
		16 : {'gamePageId':5, 'productPageId':16, 'productPageName':'Basic Powerleveling', 'productPagePath':'power-leveling.html'},
		17 : {'gamePageId':5, 'productPageId':17, 'productPageName':'Cop-Rank Powerleveling', 'productPagePath':'cop-ranks.html'},
		18 : {'gamePageId':5, 'productPageId':18, 'productPageName':'Equipment Powerleveling', 'productPagePath':'equipment.html'},
		19 : {'gamePageId':5, 'productPageId':19, 'productPageName':'Quest Powerleveling', 'productPagePath':'quest-order.html'},
		20 : {'gamePageId':5, 'productPageId':20, 'productPageName':'Part Time Powerleveling', 'productPagePath':'hours.html'},
		
		21 : {'gamePageId':6, 'productPageId':21, 'productPageName':'Basic Powerleveling', 'productPagePath':'power-leveling.html'},
		22 : {'gamePageId':6, 'productPageId':22, 'productPageName':'Item Powerleveling', 'productPagePath':'index.html'},
		23 : {'gamePageId':6, 'productPageId':23, 'productPageName':'Skill Powerleveling', 'productPagePath':'skill-order.html'},
		24 : {'gamePageId':6, 'productPageId':24, 'productPageName':'Part Time Powerleveling', 'productPagePath':'hours.html'},
		
		25 : {'gamePageId':7, 'productPageId':25, 'productPageName':'Basic Powerleveling', 'productPagePath':'power-leveling.html'},
		26 : {'gamePageId':7, 'productPageId':26, 'productPageName':'Part Time Powerleveling', 'productPagePath':'hours.html'},
		
		27 : {'gamePageId':8, 'productPageId':27, 'productPageName':'Basic Powerleveling', 'productPagePath':'power-leveling.html'},
		28 : {'gamePageId':8, 'productPageId':28, 'productPageName':'Desting Points Powerleveling', 'productPagePath':'destiny-points-order.html'},
		29 : {'gamePageId':8, 'productPageId':29, 'productPageName':'Part Time Powerleveling', 'productPagePath':'hours.html'},
		
		30 : {'gamePageId':9, 'productPageId':30, 'productPageName':'Basic Powerleveling', 'productPagePath':'power-leveling.html'},
		31 : {'gamePageId':9, 'productPageId':31, 'productPageName':'Part Time Powerleveling', 'productPagePath':'hours.html'},
		/*RuneScape*/
		32 : {'gamePageId':10, 'productPageId':32, 'productPageName':'Combat Powerleveling', 'productPagePath':'combat-power-leveling.html'},
		33 : {'gamePageId':10, 'productPageId':33, 'productPageName':'Quest Powerleveling', 'productPagePath':'quest-order.html'},
		34 : {'gamePageId':10, 'productPageId':34, 'productPageName':'Skill Powerleveling', 'productPagePath':'skills-power-leveling.html'},
		35 : {'gamePageId':10, 'productPageId':35, 'productPageName':'Part Time Powerleveling', 'productPagePath':'hours.html'},
		
		3501 : {'gamePageId':10, 'productPageId':3501, 'productPageName':'zeal-points Powerleveling', 'productPagePath':'zeal-points.html'},
		3502 : {'gamePageId':10, 'productPageId':3502, 'productPageName':'minigame Powerleveling', 'productPagePath':'minigame.html'},
		3503 : {'gamePageId':10, 'productPageId':3503, 'productPageName':'runescape-gold sale', 'productPagePath':'/runescape-gold/'},
		3504 : {'gamePageId':10, 'productPageId':3504, 'productPageName':'suite Powerleveling', 'productPagePath':'suite.html'},

		
		36 : {'gamePageId':11, 'productPageId':36, 'productPageName':'Basic Powerleveling', 'productPagePath':'player-rank.html'},
		37 : {'gamePageId':11, 'productPageId':37, 'productPageName':'Renowown Rank Powerleveling', 'productPagePath':'renowown-rank.html'},
		38 : {'gamePageId':11, 'productPageId':38, 'productPageName':'Tradeskill Powerleveling', 'productPagePath':'radeskills.html'},
		39 : {'gamePageId':11, 'productPageId':39, 'productPageName':'Part Time Powerleveling', 'productPagePath':'hours.html'},
		
		40 : {'gamePageId':12, 'productPageId':40, 'productPageName':'Achievement Powerleveling', 'productPagePath':'achievements-power-leveling.html'},
		41 : {'gamePageId':12, 'productPageId':41, 'productPageName':'Fast & Safe Power leveling ', 'productPagePath':'power-leveling.html'},
		42 : {'gamePageId':12, 'productPageId':42, 'productPageName':'Honor Powerleveling', 'productPagePath':'honor-leveling.html'},
		43 : {'gamePageId':12, 'productPageId':43, 'productPageName':'Profession Powerleveling', 'productPagePath':'professions-power-leveling.html'},
		44 : {'gamePageId':12, 'productPageId':44, 'productPageName':'Part Time Powerleveling', 'productPagePath':'hours.html'},
		100 : {'gamePageId':12, 'productPageId':100, 'productPageName':'Cheap Powerleveling', 'productPagePath':'cheap-level.html'},
		
		45 : {'gamePageId':13, 'productPageId':45, 'productPageName':'Aion main Power Leveling', 'productPagePath':'level.html'},
		46 : {'gamePageId':13, 'productPageId':46, 'productPageName':'Abyss Points Power Leveling', 'productPagePath':'abyss-points.html'},
		47 : {'gamePageId':13, 'productPageId':47, 'productPageName':'Aion Skill Power Leveling', 'productPagePath':'skills.html'},
		48 : {'gamePageId':13, 'productPageId':48, 'productPageName':'Aion Part Time Power Leveling', 'productPagePath':'part-time.html'},
		
		49 : {'gamePageId':14, 'productPageId':49, 'productPageName':'Basic Powerleveling', 'productPagePath':'level.html'},
		50 : {'gamePageId':14, 'productPageId':50, 'productPageName':'Part Time Powerleveling', 'productPagePath':'part-time.html'},
		
		51 : {'gamePageId':15, 'productPageId':51, 'productPageName':'Basic Powerleveling', 'productPagePath':'level.html'},
		52 : {'gamePageId':15, 'productPageId':52, 'productPageName':'Part Time Powerleveling', 'productPagePath':'part-time.html'},
		
		53 : {'gamePageId':16, 'productPageId':53, 'productPageName':'Darkfall Skills Power Leveling', 'productPagePath':'skills.html'},
		54 : {'gamePageId':16, 'productPageId':54, 'productPageName':'Darkfall Spells Power Leveling', 'productPagePath':'spells.html'},
		55 : {'gamePageId':16, 'productPageId':55, 'productPageName':'Darkfall Part Time Power Leveling', 'productPagePath':'part-time.html'},		
		
		56 : {'gamePageId':17, 'productPageId':56, 'productPageName':'Basic Powerleveling', 'productPagePath':'level.html'},		
		57 : {'gamePageId':17, 'productPageId':57, 'productPageName':'Part Time Powerleveling', 'productPagePath':'part-time.html'},
		
		58 : {'gamePageId':18, 'productPageId':58, 'productPageName':'Basic Powerleveling', 'productPagePath':'level.html'},
		59 : {'gamePageId':18, 'productPageId':59, 'productPageName':'Part Time Powerleveling', 'productPagePath':'part-time.html'},
		
		60 : {'gamePageId':19, 'productPageId':60, 'productPageName':'Basic Powerleveling', 'productPagePath':'level.html'},
		61 : {'gamePageId':19, 'productPageId':61, 'productPageName':'Realm Rank Powerleveling', 'productPagePath':'realm-rank.html'},
		62 : {'gamePageId':19, 'productPageId':62, 'productPageName':'Part Time Powerleveling', 'productPagePath':'part-time.html'},
		
		63 : {'gamePageId':20, 'productPageId':63, 'productPageName':'Basic Powerleveling', 'productPagePath':'level.html'},
		64 : {'gamePageId':20, 'productPageId':64, 'productPageName':'Part Time Powerleveling', 'productPagePath':'part-time.html'},
		
		
		65 : {'gamePageId':21, 'productPageId':65, 'productPageName':'Basic Powerleveling', 'productPagePath':'level.html'},
		66 : {'gamePageId':21, 'productPageId':66, 'productPageName':'Part Time Powerleveling', 'productPagePath':'part-time.html'},
		
		
		67 : {'gamePageId':22, 'productPageId':67, 'productPageName':'Basic Powerleveling', 'productPagePath':'level.html'},
		68 : {'gamePageId':22, 'productPageId':68, 'productPageName':'Part Time Powerleveling', 'productPagePath':'part-time.html'},
		
		69 : {'gamePageId':23, 'productPageId':69, 'productPageName':'Basic Powerleveling', 'productPagePath':'level.html'},
		70 : {'gamePageId':23, 'productPageId':70, 'productPageName':'Part Time Powerleveling', 'productPagePath':'part-time.html'},		
		
		71 : {'gamePageId':24, 'productPageId':71, 'productPageName':'Basic Powerleveling', 'productPagePath':'level.html'},
		72 : {'gamePageId':24, 'productPageId':72, 'productPageName':'Accliam Powerleveling', 'productPagePath':'accliam.html'},
		73 : {'gamePageId':24, 'productPageId':73, 'productPageName':'Part Time Powerleveling', 'productPagePath':'part-time.html'},
		
		74 : {'gamePageId':25, 'productPageId':74, 'productPageName':'Basic Powerleveling', 'productPagePath':'level.html'},
		75 : {'gamePageId':25, 'productPageId':75, 'productPageName':'Part Time Powerleveling', 'productPagePath':'part-time.html'},		
		
		76 : {'gamePageId':26, 'productPageId':76, 'productPageName':'Basic Powerleveling', 'productPagePath':'level.html'},
		77 : {'gamePageId':26, 'productPageId':77, 'productPageName':'Part Time Powerleveling', 'productPagePath':'part-time.html'},
		
		78 : {'gamePageId':27, 'productPageId':78, 'productPageName':'Basic Powerleveling', 'productPagePath':'level.html'},
		79 : {'gamePageId':27, 'productPageId':79, 'productPageName':'Part Time Powerleveling', 'productPagePath':'part-time.html'},
		
		80 : {'gamePageId':28, 'productPageId':80, 'productPageName':'Basic Powerleveling', 'productPagePath':'level.html'}

};



var goldAction = {
		1 : {'gameAction':1, 'gameName':'World of Warcraft US'},		
		2 : {'gameAction':2, 'gameName':'World of Warcraft EU'},
		37: {'gameAction':103, 'gameName':'SWTOR US'},		
		38 : {'gameAction':104, 'gameName':'SWTOR EU'},	
		3 : {'gameAction':3, 'gameName':'Runescape'},
		4 : {'gameAction':33, 'gameName':'Rift US'},
		5 : {'gameAction':34, 'gameName':'Rift EU'},
		6 : {'gameAction':11, 'gameName':'Lotro US'},
		7 : {'gameAction':12, 'gameName':'Lotro EU'},
		8 : {'gameAction':14, 'gameName':'Everquest II'},
		9 : {'gameAction':23, 'gameName':'Aion US'},
		10 : {'gameAction':24, 'gameName':'Aion EU'},
		11 : {'gameAction':17, 'gameName':'EVE Online'},
		12 : {'gameAction':20, 'gameName':'Runes of Magic'},
		13 : {'gameAction':46, 'gameName':'FFXIV'},
		14: {'gameAction':4, 'gameName':'Final Fantasy XI'},
		15: {'gameAction':5, 'gameName':'Warhammer Online US'},
		16 : {'gameAction':6, 'gameName':'Warhammer Online EU'},
		17 : {'gameAction':7, 'gameName':'Age of Conan US'},
		18 : {'gameAction':8, 'gameName':'Age of Conan EU'},
		19: {'gameAction':9, 'gameName':'MapleStory US'},
		20 : {'gameAction':10, 'gameName':'MapleStory EU'},
		21 : {'gameAction':19, 'gameName':'DDO'},
		22 : {'gameAction':13, 'gameName':'Guild Wars'},
		23 : {'gameAction':21, 'gameName':'Darkfall Online US'},
		24 : {'gameAction':22, 'gameName':'Darkfall Online EU'},
		25 : {'gameAction':34, 'gameName':'Dark Age of Camelot'},
		26 : {'gameAction':37, 'gameName':'Star Wars Galaxies'},
		27 : {'gameAction':15, 'gameName':'Atlantica Online'},	
		28 : {'gameAction':16, 'gameName':'Lineage II'},
		29 : {'gameAction':35, 'gameName':'Rappelz Online US'},
		30 : {'gameAction':36, 'gameName':'Rappelz Online EU'},	
		31 : {'gameAction':38, 'gameName':'Star Trek Online US'},
		32 : {'gameAction':39, 'gameName':'Star Trek Online EU'},
		33 : {'gameAction':40, 'gameName':'Cabal Online US'},
		34 : {'gameAction':41, 'gameName':'Cabal Online EU'},
		35 : {'gameAction':42, 'gameName':'Champions Online'},
		36 : {'gameAction':43, 'gameName':'Allods online'}

		
};


function GetGamePageList (gamePageId) {
	  var htmlOption = '<option value="0">--- Please choose the game ---</option>\n';
		gamePageId = isNaN(parseInt(gamePageId)) ? 0 : parseInt(gamePageId);
		for (gp in gamePage) {
			  if (gamePageId == gamePage[gp]['gamePageId']) {
				    htmlOption += '<option value="' + gamePage[gp]['gamePageId'] + '" selected="selected">' + gamePage[gp]['gamePageName'] + '</option>\n';
				} else {
				    htmlOption += '<option value="' + gamePage[gp]['gamePageId'] + '">' + gamePage[gp]['gamePageName'] + '</option>\n';
				}
		}
		return htmlOption;
}



function GetProductPageList (gamePageId, productPageId) {
	  var htmlOption = '<option value="0">--- Please choose the product ---</option>\n';
		gamePageId = isNaN(parseInt(gamePageId)) ? 0 : parseInt(gamePageId);
		productPageId =  isNaN(parseInt(productPageId)) ? 0 : parseInt(productPageId);
		for (var pp in productPage) {
		    if (gamePageId == productPage[pp]['gamePageId']) {
						if (productPageId == productPage[pp]['productPageId']) {
								htmlOption += '<option value="' + productPage[pp]['productPageId'] + '" selected="selected">' + productPage[pp]['productPageName'] + '</option>\n';
						} else {
								htmlOption += '<option value="' + productPage[pp]['productPageId'] + '">' + productPage[pp]['productPageName'] + '</option>\n';
						}
				}
		}
		return htmlOption;
}



function GetPagePath (flag, gamePageId, productPageId) {
	  flag = isNaN(parseInt(flag)) ? 0 : parseInt(flag);
		var pagePath = '';
		switch (flag) {
		    case 1 : 
				    pagePath = GetGamePagePath(gamePageId);
						break;
				case 2 : 
				    pagePath = GetProductPagePath(productPageId);
				    break;
				case 3 : 
				    pagePath = GetJoinPagePath(gamePageId, productPageId);
				    break;
				default : 
				    pagePath = document.location.href;
						break;
		}
		return pagePath;
}



function GetJoinPagePath (gamePageId, productPageId) {
		gamePageId = isNaN(parseInt(gamePageId)) ? 0 : parseInt(gamePageId);
		productPageId = isNaN(parseInt(productPageId)) ? 0 : parseInt(productPageId);
		var pagePath = '';
		
		
		if (gamePageId != 0) {
				for (var gp in gamePage) {
						if (gamePageId == gamePage[gp]['gamePageId']) {
								pagePath += gamePage[gp]['gamePagePath'];
								break;
						}
				}
		}
		
		
		if (productPageId != 0) {
				for (var pp in productPage) {
						if (productPageId == productPage[pp]['productPageId']) {
								pagePath += productPage[pp]['productPagePath'];
								break;
						}
				}
		}
		
		
		
		return pagePath;
}



function GetGamePagePath (gamePageId) {
		gamePageId = isNaN(parseInt(gamePageId)) ? 0 : parseInt(gamePageId);
		if (gamePageId == 0) return '';
		var pagePath = '';
		for (var gp in gamePage) {
		    if (gamePageId == gamePage[gp]['gamePageId']) {
				    pagePath = gamePage[gp]['gamePagePath'];
						break;
				}
		}
		return pagePath;
}



function GetProductPagePath (productPageId) {
		productPageId = isNaN(parseInt(productPageId)) ? 0 : parseInt(productPageId);
		if (productPageId == 0) return '';
		var pagePath = '';
		for (var pp in productPage) {
		    if (productPageId == productPage[pp]['productPageId']) {
				    pagePath = productPage[pp]['productPagePath'];
						break;
				}
		}
		return pagePath;
}


function GetGameList() {

	var htmlOption = '<option value="0">---Please select the game---</option>\n';
		for (li in goldAction) {
			    htmlOption += '<option value="' + goldAction[li]['gameAction'] + '">' + goldAction[li]['gameName'] + '</option>\n';
		}

		return htmlOption;

}

function GoldAction (gameTypeIdGold){	
	
	for (xp in goldAction) {
		
		if(goldAction[xp]['gameAction'] == gameTypeIdGold)
		
		 Action = goldAction[xp]['gameActionPath']
		
	}
	return Action;
	
}

