var AmountContentArr = new Array(
								{Parent: 4996, Amounts: new Array( '100K Kinah to 500K Kinah', '501K Kinah to 1000K Kinah', '1001K Kinah to 5000K Kinah', '5001K Kinah to 10000K Kinah', '10000K Kinah and up')},
								{Parent: 4997, Amounts: new Array( '100K Kinah to 500K Kinah', '501K Kinah to 1000K Kinah', '1001K Kinah to 5000K Kinah', '5001K Kinah to 10000K Kinah', '10000K Kinah and up')},
								{Parent: 248, Amounts: new Array( '100 Platinum to 500 Platinum', '501 Platinum to 1000 Platinum', '1000 Platinum to 5000 Platinum', '5000 Platinum to 10000 Platinum', '10001 Platinum and up')},
								{Parent: 2, Amounts: new Array( '100K Gil to 500K Gil', '501K Gil to 1000K Gil', '1001K Gil to 5000KGil', '5001K Gil to 10000K Gil', '10000K Gil and up')},
								{Parent: 3, Amounts: new Array( '100M Adena to 500M Adena', '501M Adena to 1000M Adena', '1001M Adena to 5000M Adena', '5001M Adena to 10000M Adena', '10001 Adena and up')},
								{Parent: 247, Amounts: new Array( '100 gold to 500 gold', '501 gold to 1000 gold', '1001 gold to 5000 gold', '5001 gold to 10000 gold', '10001 gold and up')},
								{Parent: 853, Amounts: new Array( '100 gold to 500 gold', '501 gold to 1000 gold', '1001 gold to 5000 gold', '5001 gold to 10000 gold', '10001 gold and up')},
								{Parent: 5094, Amounts: new Array(  'Maximum of 100 thousand energy credits', 'Maximum of 200 thousand energy credits', 'Maximum of 300 thousand energy credits', 'Maximum of 500 thousand energy credits', 'Maximum of 1000 thousand energy credits', 'Above 1000 thousand energy credits')},
								{Parent: 4398, Amounts: new Array(  '100 - 200 Gold', '200 - 400 Gold', '400 - 800 Gold', 'Greater than 800 Gold')},
								{Parent: 5098, Amounts: new Array(  '5M - 10M Kamas', '10M - 20M Kamas', '20M - 40M Kamas', 'Greater than 40M Kamas')}
								);

function ChangeSelectedGame()
{
	var amountDropDown, l, option, i;
	var gameId = parseInt(document.getElementById('selectGame').value);
	var foundCount = 0;
	
	if (gameId == 0)
		return; 
				
	amountDropDown = document.getElementById('selectAmount');
	for (key in AmountContentArr)
	{
		if (AmountContentArr[key].Parent == gameId)
		{	
			l = AmountContentArr[key].Amounts.length;
		
			if (l > (amountDropDown.options.length - 1))
				for (i = (amountDropDown.options.length - 1); i < l; i++)
				{
					option = document.createElement("OPTION");
					amountDropDown.options.add(option);
				}
			else
				if (l < (amountDropDown.options.length - 1))
					for (i = (l + 1); i < amountDropDown.options.length; i++)
					{							
						amountDropDown.options[i] = null;								
					}
					
			for (i = 1; i < amountDropDown.options.length; i++)
			{
				amountDropDown.options[i].text = AmountContentArr[key].Amounts[i-1];
			}
			
			foundCount += 1;			
			break;
		}
	}
	
	if (foundCount == 0)
	{
		amountDropDown.selectedIndex = 0;
		amountDropDown.disabled = true;
	}
	else
	{
		amountDropDown.selectedIndex = 0;
		amountDropDown.disabled = false;
	}
	GetServers(gameId);
}

function SetEmailFocus()
{
	var emailObj = document.getElementById('email');			
	if (emailObj.value == ' -- Enter your E-mail -- ')
		emailObj.value = '';
}		

function LoseEmailFocus()
{
	var emailObj = document.getElementById('email');
	if (emailObj.value == '')
		emailObj.value = ' -- Enter your E-mail -- ';
}		

function GetServers(gameId)
{
	gameId = parseInt(gameId, 10);
	var serverSelect = document.getElementById('selectServer');
	for (var i = (serverSelect.options.length - 1); i > 0; i--)
	{				
		if (serverSelect.options[i].value != '0')
		{
			serverSelect.options[i] = null;
		}				
	}
				
	if (gameId > 0)
	{
		StoreFront.StoreFront.SellCurrency.GetServers(gameId, GetServers_CallBack);					
	}
}

function GetServers_CallBack(response)
{		
	var serverSelect = document.getElementById('selectServer'), optionObj;
	if ((response.error != null) && (response.error.Message != null))
	{				
		var msg = document.getElementById('RequestStatusFailedMessage');
		if (msg != null)
			alert(msg.value);
	}
	else
	{
		if (response.value.length > 0)
		{
			for (var i = 0; i < response.value.length; i++)
			{
				optionObj = new Option(response.value[i].Name, response.value[i].Id);
				serverSelect.options.add(optionObj);
			}
		}
	}
}
function ServerSelectionChanged()
{
	var serverSelectObj = document.getElementById('selectServer');	
	document.getElementById('selectedServerName').value = serverSelectObj.options[serverSelectObj.selectedIndex].text;	
}