Countries = new Array();
Countries.push(new Array( '32', 'Belgi\u00EB/Belgique/Belgien', false, "\u20AC4"));
Countries.push(new Array( '45', 'Danmark', false, "\u20AC4"));
Countries.push(new Array( '49', 'Deutschland', true, "\u20AC4"));
Countries.push(new Array( '34', 'Espa\u00F1a', false, "\u20AC3"));
Countries.push(new Array( '33', 'France', true, "\u20AC5"));
Countries.push(new Array('298', 'F\u00F8royar', false, "\u20AC4"));
Countries.push(new Array('353', 'Ireland', false, "\u20AC4"));
Countries.push(new Array( '30', '\u0395\u03BB\u03BB\u03AC\u03B4', false, "\u20AC4"));
Countries.push(new Array( '39', 'Italia', false, "\u20AC4"));
Countries.push(new Array('354', '\u00CDsland', true, "499 kr"));
Countries.push(new Array('357', '\u039A\u03CD\u03C0\u03C1\u03BF\u03C2/K\u0131br\u0131s', false, "\u20AC4"));
Countries.push(new Array( '31', 'Nederland', false, "\u20AC5"));
Countries.push(new Array( '47', 'Norge', false, "\u20AC4"));
Countries.push(new Array( '43', '\u00D6sterreich', false, "\u20AC4"));
Countries.push(new Array( '41', 'Suisse/Schweiz/Svizzera', false, "\u20AC4"));
Countries.push(new Array('351', 'Portugal', false, "\u20AC4"));
Countries.push(new Array('358', 'Suomi', true, "\u20AC4"));
Countries.push(new Array( '46', 'Sverige', false, "\u20AC4"));
Countries.push(new Array( '44', 'United Kingdom', true, "\u00A35"));

Operators = new Array();
// Germany
Operators.push(new Array('49', 'DE-DEB',  'Debitel'));
Operators.push(new Array('49', 'DE-E',    'e-plus'));
Operators.push(new Array('49', 'DE-O2',   'O2'));
Operators.push(new Array('49', 'DE-TALK', 'Talkline'));
Operators.push(new Array('49', 'DE-VODA', 'Vodafone'));
// France
Operators.push(new Array('33', 'FR-BOU', 'Bouygues'));
Operators.push(new Array('33', 'FR-ORA', 'Orange'));
Operators.push(new Array('33', 'FR-SFR', 'SFR'));
// Iceland
Operators.push(new Array('354', 'IS-LI',  'Lands\u00EDminn'));
Operators.push(new Array('354', 'IS-OV',  'Og Vodafone'));
Operators.push(new Array('354', 'IS-SKO', 'SKO'));
// Finland
Operators.push(new Array('358', 'FI-ELISA', 'Elisa'));
Operators.push(new Array('358', 'FI-SON',   'Sonera'));
// UK
Operators.push(new Array('44', 'UK-O2',    'O2'));
Operators.push(new Array('44', 'UK-ORA',   'Orange'));
Operators.push(new Array('44', 'UK-THREE', 'Three'));
Operators.push(new Array('44', 'UK-TMOB',  'T-Mobile'));
Operators.push(new Array('44', 'UK-VIRG',  'Virgin'));
Operators.push(new Array('44', 'UK-VODA',  'Vodafone'));
// Italy
Operators.push(new Array('39', 'IT-HEX', 'Any operator'));
// Spain
Operators.push(new Array('34', 'ES-VODA', 'Vodafone'));
Operators.push(new Array('34', 'ES-RET', 'Retevision'));
Operators.push(new Array('34', 'ES-TFON', 'Telefonica'));
Operators.push(new Array('34', 'ES-XF', 'Xfera'));
// Holland
Operators.push(new Array('31', 'NL-KPN' ,'KPN'));
Operators.push(new Array('31', 'NL-VODA','Vodafone'));
Operators.push(new Array('31', 'NL-ORA' ,'Orange'));
Operators.push(new Array('31', 'NL-TFOR','Telfort'));
Operators.push(new Array('31', 'NL-TMOB','T-Mobile'));

// Others
Operators.push(new Array('298', 'FO-HEX', 'Any operator'));
Operators.push(new Array( '45', 'DK-HEX', 'Any operator'));
Operators.push(new Array( '47', 'NO-HEX', 'Any operator'));
Operators.push(new Array( '46', 'SE-HEX', 'Any operator'));
Operators.push(new Array( '30', 'GR-HEX', 'Any operator'));
Operators.push(new Array( '32', 'BE-HEX', 'Any operator'));
Operators.push(new Array('353', 'IE-HEX', 'Any operator'));
Operators.push(new Array('357', 'CY-HEX', 'Any operator'));
Operators.push(new Array( '43', 'AT-HEX', 'Any operator'));
Operators.push(new Array( '41', 'CH-HEX', 'Any operator'));
Operators.push(new Array('351', 'PT-HEX', 'Any operator'));



function populateCountries() {
	var listi = document.getElementById("countrySelect");
	for (x = listi.length; x >= 0; x--) {
		listi[x] = null;
	}
	listi.options[listi.options.length] = new Option('-- Select --', 'null');
	for (x = 0; x < Countries.length; x++) {
		listi.options[listi.options.length] = new Option(Countries[x][1], Countries[x][0]);
	}
}

function populateOperator() {
	var o = document.getElementById("countrySelect");
	var c = o.options[o.selectedIndex].value;
	var op = document.getElementById("operator");
	var pricespan = document.getElementById("price");
	if (c == null || c == 'null') {
		op.style.display = 'none';
		var p = document.getElementById("phone");
		p.style.display = 'none';
	} else {
		op.style.display = 'block';
	}
	var listi = document.getElementById("operatorSelect");
	for (x = listi.length; x >= 0; x--) {
		listi[x] = null;
	}

	var selection = false;
	var price = "";
	for (x = 0; x < Countries.length; x++) {
		if(Countries[x][0] == c) {
			selection = Countries[x][2];
			price = Countries[x][3];
		}
	}

	if (selection) {
		listi.options[listi.options.length] = new Option('-- Select --', 'null');
	}

	for (x = 0; x < Operators.length; x++) {
		if (Operators[x][0] == c) {
			listi.options[listi.options.length] = new Option(Operators[x][2], Operators[x][1]);
		}
	}
	if (!selection) {
		displayPhonenumber();
	}

	if (pricespan != null) {
		pricespan.innerHTML = price;
	}
}

function displayPhonenumber() {
	var o = document.getElementById("operatorSelect");
	var c = o.options[o.selectedIndex].value;
	var p = document.getElementById("phone");
	if (c == null || c == 'null') {
		p.style.display = 'none';
	} else {
		p.style.display = 'block';
	}
}

populateCountries();
