function ShowServerName()
{
	var str_option="<select name='server' id='server' onchange='UintAndTotalprice();'>";
	var str_option1="<select name='num' id='num' onchange='UintAndTotalprice();'>";
	if(!$i("RealmName")){
		for(key in ServerArray[11]){
			str_option+="<option value=";
			str_option+=key;
			str_option+=">";
			str_option+=ServerArray[11][key];
			str_option+="</option>";
		}
		for(NumKey in NumberArray[11]){
		str_option1+="<option value=";
		str_option1+=NumberArray[11][NumKey];
		str_option1+=">";
		str_option1+=NumberArray[11][NumKey];
		str_option1+="</option>";
		}
	}else{
	var realm_num=parseInt($i("RealmName").value);
		for(key in ServerArray[realm_num]){
			str_option+="<option value=";
			str_option+=key;
			str_option+=">";
			str_option+=ServerArray[realm_num][key];
			str_option+="</option>";
		}
		for(NumKey in NumberArray[realm_num]){
		str_option1+="<option value=";
		str_option1+=NumKey;
		str_option1+=">";
		str_option1+=NumberArray[realm_num][NumKey];
		str_option1+="</option>";
		}
	}
	str_option+="</select>";
	str_option1+="</select>";
	document.getElementById("ServerList").innerHTML=str_option;
	document.getElementById("NumberList").innerHTML=str_option1;
	UintAndTotalprice();
}
ShowServerName();

function UintAndTotalprice()
{
	var serverUintprice,RatePrice,TotaPrice;
	var str_unitprice = "<input name='Currency1'  type='text' readonly='readonly' id='Currency1' size='1' value=";
	var str_totalunitprice = "<input name='Currency2'  type='text' readonly='readonly' id='Currency2' size='1' value="; 
	var quantity_num = parseInt($i("num").value);
	var realm_num=parseInt($i("RealmName").value); 
	var server_num=parseInt($i("server").value); 
	var prictype = GetValueByList();




	if (realm_num ==""  ||  server_num ==  "")
	{
		str_unitprice += "€";
		str_totalunitprice += "€";
		RatePrice = "0.00";
		TotaPrice = "0.00";
	}
	else
	{
		var m=0;
		for(var kk in NumberArray[realm_num])
		{
			if(m==0)
			{
				bb=kk;	
			}
			var aa=kk;
			m++;
		}
		serverUintprice = GoldPrice[realm_num][server_num];
		if(prictype == "")
		{
			RatePrice =  serverUintprice;
			str_unitprice += "€";
			str_totalunitprice += "€";
		}
		else
		{  
			var Max=parseFloat(aa);
			var Min=parseFloat(bb);
			RatePrice =  (serverUintprice*PriceFitsArray[prictype][1]).toFixed(5);
			str_unitprice += PriceFitsArray[prictype][0];
			str_totalunitprice += PriceFitsArray[prictype][0];
			TotaPrice = (quantity_num*RatePrice).toFixed(2);
			TotaPrice=((1-(quantity_num/Min)*((1-beat_num)/(Max/Min)))*TotaPrice).toFixed(2);
		}
		
	}

	
	str_unitprice += "><input name='UnitPrice' type='text' id='UnitPrice'  size='6' readonly='readonly' value=";
	str_unitprice += RatePrice;
	str_unitprice += ">";
	str_totalunitprice += "><input name='TotalPrice' type='text' id='TotalPrice'  size='6' readonly='readonly' value=";
	str_totalunitprice += TotaPrice;
	str_totalunitprice += ">";

	document.getElementById("UnitpriceNum").innerHTML = str_unitprice;
	document.getElementById("TotalpriceNum").innerHTML = str_totalunitprice;
} 