
function changeArea(serverarea)
{
    var thefrom;
    theform = document.sellgold;
	theform.servername.length = 0;
	theform.servername.options[0] = new Option("Choose your Realm (Server)", "");
    for (i=0; i<areaArray[serverarea].length; i++)
    {
		theform.servername.options[theform.servername.length] = new Option(areaArray[serverarea][i][1],areaArray[serverarea][i][0]);
    }
}

function changeprice()
{
	var theform = document.sellgold;
	var server = theform.servername.options[theform.servername.selectedIndex].value;
	var gold=theform.goldnum.options[theform.goldnum.selectedIndex].value;
	theform.server_text.value=theform.servername.options[theform.servername.selectedIndex].text;

	setgoldprice(server,gold);
}

function setgoldprice(server,gold)
{
	var theform = document.sellgold;
	if(theform.servername.selectedIndex!=0){
		price1_1=getPrice(server,gold);
		price2_2=(price1_1/gold).toFixed(4);
		theform.txt_goldprice.value = "$ "+price2_2+" USD/gold";
		theform.txt_allgoldprice.value="$ "+price1_1+" USD";
		if (typeof(theform.currency_amount)!="undefined"){
			var eur_amount = "€ "+ (price1_1*rate['eur'][1]).toFixed(2) + " EUR";
			var gbp_amount = "£ "+ (price1_1*rate['gbp'][1]).toFixed(2) + " GBP";
			theform.currency_amount.value = "( "+eur_amount+"; "+gbp_amount+" )";
		}
	
		try{
			theform.txt_goldprice5000.value=getPrice(server,5000);
			theform.txt_goldprice3000.value=getPrice(server,3000);
			theform.txt_goldprice2000.value=getPrice(server,2000);
			theform.txt_goldprice1500.value=getPrice(server,1500);
			theform.txt_goldprice1000.value=getPrice(server,1000);
			theform.txt_goldprice500.value=getPrice(server,500);
		}catch(e){}

	}else{
		theform.txt_goldprice.value = "Choose your realm and faction";
		theform.txt_allgoldprice.value="Choose your realm and faction";
	
		try{
			theform.txt_goldprice5000.value="0.0000";
			theform.txt_goldprice3000.value="0.0000";
			theform.txt_goldprice2000.value="0.0000";
			theform.txt_goldprice1500.value="0.0000";
			theform.txt_goldprice1000.value="0.0000";
			theform.txt_goldprice500.value="0.0000";
		}catch(e){}
	
	}
}

