var Servers	=	1;

var Prices	=	new Array(Servers);
for (a=0; a<Servers; a++)
  {
   Prices[a]	=	new Array(3);
   Prices[a][2]	=	new Array(2);
   Prices[a][3]	=	new Array(2);
  }

// VOORBEELD
// var Servers		=	23; Aantal programma's
// Prices[0][1]		=	"TeamSpeak"; De software
// Prices[0][2][1]	=	0.00; De setupkosten voor private voiceservers
// Prices[0][2][2]	=	0.75; De slotprijs voor private voiceservers
// Prices[0][3][1]	=	0.00; De setupkosten voor public voiceservers
// Prices[0][3][2]	=	1.25; De slotprijs voor public voiceservers

///////////////////////////////
Prices[0][1]	=	"TeamSpeak 2";
//////////////////////////////////////
Prices[0][2][1]	=	0.00;			//
Prices[0][2][2]	=	0.45;			//
//////////////////////////////////////
Prices[0][3][1]	=	0.00;			//
Prices[0][3][2]	=	0.45;			//
///////////////////////////////

function round(x,y) {
	if (!y) y = 2;
	var z = Math.pow(10, y);
	var fixedNum = (Math.round(parseFloat(x) * z) / z);
	var sFixedNum = new String(fixedNum);
	var aFixedNum = sFixedNum.split(".");

	var i = (aFixedNum[1]) ? aFixedNum[1].length: 0;
	if (i == 0) sFixedNum += ".";
	while (i < y) {
		sFixedNum += "0";
		i++;
	}
	return sFixedNum;
}


function refreshPrice() {
	var d = document;
	var f = d.forms.calculator;
	var t_subtotaal = 0;
	var t_slot = 0;
	var t_month = 0;
	var t_periode = 0;
	var t_game = '';
	var t_servertype = '';
	var t_slots = '';
	if (f.game.selectedIndex == '') {
		f.subtotaal.value = '';
	} else {
		t_game = f.game[f.game.selectedIndex].value;
		t_slots = f.slots[f.slots.selectedIndex].value;
		t_periode = f.periode[f.periode.selectedIndex].value;
		t_servertype = f.servertype[f.servertype.selectedIndex].value;
		if ((t_game == '') || (t_slots == '') || (t_periode == '') || (t_servertype == '')) {
			f.subtotaal.value = '';
		} else {
			if (t_servertype == 'Private') {
				if (Prices[t_game][2]) {
					t_month = Prices[t_game][2][1];
					t_slot = Prices[t_game][2][2];
					t_month = t_month + (t_slots * t_slot);
					f.subtotaal.value = round(t_month*t_periode);
				} else {
					f.subtotaal.value = 'N/A';
				}
			} else if (t_servertype == 'Public') {
				if (Prices[t_game][3]) {
					t_month = Prices[t_game][3][1];
					t_slot = Prices[t_game][3][2]
					t_month = t_month + (t_slots * t_slot);
					f.subtotaal.value = round(t_month*t_periode);
				} else {
					f.subtotaal.value = 'N/A';
				}
			}
		}
	}
}
