var Servers	=	22;

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; Het aantal games
// Prices[0][1]		=	"Call of Duty"; De gamenaam
// Prices[0][2][1]	=	0.00; De setupkosten voor private gameservers
// Prices[0][2][2]	=	0.50; De slotprijs voor private gameservers
// Prices[0][3][1]	=	0.00; De setupkosten voor public gameservers
// Prices[0][3][2]	=	1.00; De slotprijs voor public gameservers

///////////////////////////////
Prices[0][1]	=	"Call of Duty";
//////////////////////////////////////
Prices[0][2][1]	=	0.00;			//
Prices[0][2][2]	=	0.65;			//
//////////////////////////////////////
Prices[0][3][1]	=	0.00;			//
Prices[0][3][2]	=	1.00;			//
///////////////////////////////

///////////////////////////////
Prices[1][1]	=	"Call of Duty: United Offensive";
//////////////////////////////////////
Prices[1][2][1]	=	0.00;			//
Prices[1][2][2]	=	0.65;			//
//////////////////////////////////////
Prices[1][3][1]	=	0.00;			//
Prices[1][3][2]	=	1.00;			//
///////////////////////////////

///////////////////////////////
Prices[2][1]	=	"Call of Duty 2";
//////////////////////////////////////
Prices[2][2][1]	=	0.00;			//
Prices[2][2][2]	=	0.65;			//
//////////////////////////////////////
Prices[2][3][1]	=	0.00;			//
Prices[2][3][2]	=	1.00;			//
///////////////////////////////

///////////////////////////////
Prices[3][1]	=	"Call of Duty 4: Modern Warfare";
//////////////////////////////////////
Prices[3][2][1]	=	0.00;			//
Prices[3][2][2]	=	0.65;			//
//////////////////////////////////////
Prices[3][3][1]	=	0.00;			//
Prices[3][3][2]	=	1.00;			//
///////////////////////////////

///////////////////////////////
Prices[4][1]	=	"Call Of Duty: World at War";
//////////////////////////////////////
Prices[4][2][1]	=	0.00;			//
Prices[4][2][2]	=	0.90;			//
//////////////////////////////////////
Prices[4][3][1]	=	0.00;			//
Prices[4][3][2]	=	1.25;			//
///////////////////////////////

///////////////////////////////
Prices[5][1]	=	"Counter-Strike: 1.6 (300 FPS)";
//////////////////////////////////////
Prices[5][2][1]	=	0.00;			//
Prices[5][2][2]	=	0.65;			//
//////////////////////////////////////
Prices[5][3][1]	=	0.00;			//
Prices[5][3][2]	=	1.00;			//
///////////////////////////////

///////////////////////////////
Prices[6][1]	=	"Counter-Strike: 1.6 (1000 FPS)";
//////////////////////////////////////
Prices[6][2][1]	=	0.00;			//
Prices[6][2][2]	=	0.90;			//
//////////////////////////////////////
Prices[6][3][1]	=	0.00;			//
Prices[6][3][2]	=	1.25;			//
///////////////////////////////

///////////////////////////////
Prices[7][1]	=	"Counter-Strike: Condition Zero (300 FPS)";
//////////////////////////////////////
Prices[7][2][1]	=	0.00;			//
Prices[7][2][2]	=	0.65;			//
//////////////////////////////////////
Prices[7][3][1]	=	0.00;			//
Prices[7][3][2]	=	1.00;			//
///////////////////////////////

///////////////////////////////
Prices[8][1]	=	"Counter-Strike: Condition Zero (1000 FPS)";
//////////////////////////////////////
Prices[8][2][1]	=	0.00;			//
Prices[8][2][2]	=	0.90;			//
//////////////////////////////////////
Prices[8][3][1]	=	0.00;			//
Prices[8][3][2]	=	1.25;			//
///////////////////////////////

///////////////////////////////
Prices[9][1]	=	"Counter-Strike: Source (Tickrate 33)";
//////////////////////////////////////
Prices[9][2][1]	=	0.00;			//
Prices[9][2][2]	=	0.65;			//
//////////////////////////////////////
Prices[9][3][1]	=	0.00;			//
Prices[9][3][2]	=	1.00;			//
///////////////////////////////

///////////////////////////////
Prices[10][1]	=	"Counter-Strike: Source (Tickrate 66)";
//////////////////////////////////////
Prices[10][2][1]	=	0.00;		//
Prices[10][2][2]	=	0.90;		//
//////////////////////////////////////
Prices[10][3][1]	=	0.00;		//
Prices[10][3][2]	=	1.25;		//
///////////////////////////////

///////////////////////////////
Prices[11][1]	=	"Counter-Strike: Source (Tickrate 100)";
//////////////////////////////////////
Prices[11][2][1]	=	0.00;		//
Prices[11][2][2]	=	1.15;		//
//////////////////////////////////////
Prices[11][3][1]	=	0.00;		//
Prices[11][3][2]	=	1.50;		//
///////////////////////////////

///////////////////////////////
Prices[12][1]	=	"Crysis";
//////////////////////////////////////
Prices[12][2][1]	=	0.00;		//
Prices[12][2][2]	=	2.05;		//
//////////////////////////////////////
Prices[12][3][1]	=	0.00;		//
Prices[12][3][2]	=	2.40;		//
///////////////////////////////

///////////////////////////////
Prices[13][1]	=	"Crysis: Wars";
//////////////////////////////////////
Prices[13][2][1]	=	0.00;		//
Prices[13][2][2]	=	2.05;		//
//////////////////////////////////////
Prices[13][3][1]	=	0.00;		//
Prices[13][3][2]	=	2.40;		//
///////////////////////////////

///////////////////////////////
Prices[14][1]	=	"Day Of Defeat";
//////////////////////////////////////
Prices[14][2][1]	=	0.00;		//
Prices[14][2][2]	=	0.65;		//
//////////////////////////////////////
Prices[14][3][1]	=	0.00;		//
Prices[14][3][2]	=	1.00;		//
///////////////////////////////

///////////////////////////////
Prices[15][1]	=	"Day Of Defeat: Source";
//////////////////////////////////////
Prices[15][2][1]	=	0.00;		//
Prices[15][2][2]	=	0.65;		//
//////////////////////////////////////
Prices[15][3][1]	=	0.00;		//
Prices[15][3][2]	=	1.00;		//
///////////////////////////////

///////////////////////////////
Prices[16][1]	=	"Enemy Territory";
//////////////////////////////////////
Prices[16][2][1]	=	0.00;		//
Prices[16][2][2]	=	1.15;		//
//////////////////////////////////////
Prices[16][3][1]	=	0.00;		//
Prices[16][3][2]	=	1.50;		//
///////////////////////////////

///////////////////////////////
Prices[17][1]	=	"Killing Floor";
//////////////////////////////////////
Prices[17][2][1]	=	0.00;		//
Prices[17][2][2]	=	1.15;		//
//////////////////////////////////////
Prices[17][3][1]	=	0.00;		//
Prices[17][3][2]	=	1.50;		//
///////////////////////////////

///////////////////////////////
Prices[18][1]	=	"Medal Of Honor: Allied Assault";
//////////////////////////////////////
Prices[18][2][1]	=	0.00;		//
Prices[18][2][2]	=	0.90;		//
//////////////////////////////////////
Prices[18][3][1]	=	0.00;		//
Prices[18][3][2]	=	1.25;		//
///////////////////////////////

///////////////////////////////
Prices[19][1]	=	"Medal Of Honor: Spearhead";
//////////////////////////////////////
Prices[19][2][1]	=	0.00;		//
Prices[19][2][2]	=	0.90;		//
//////////////////////////////////////
Prices[19][3][1]	=	0.00;		//
Prices[19][3][2]	=	1.25;		//
///////////////////////////////

///////////////////////////////
Prices[20][1]	=	"Quake Wars";
//////////////////////////////////////
Prices[20][2][1]	=	0.00;		//
Prices[20][2][2]	=	2.05;		//
//////////////////////////////////////
Prices[20][3][1]	=	0.00;		//
Prices[20][3][2]	=	2.40;		//
///////////////////////////////

///////////////////////////////
Prices[21][1]	=	"Tactical Ops";
//////////////////////////////////////
Prices[21][2][1]	=	0.00;		//
Prices[21][2][2]	=	0.65;		//
//////////////////////////////////////
Prices[21][3][1]	=	0.00;		//
Prices[21][3][2]	=	1.00;		//
///////////////////////////////

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';
				}
			}
		}
	}
}
