﻿///////////////////////////////////////////////
// Copyright 2007 RiMedia. All rights reserved
///////////////////////////////////////////////
var NS = (document.layers) ? 1 : 0;

var IE = (document.all)    ? 1 : 0;

var submitted=0;

function CheckKey(e) {

	if (NS) {

		thekey = e.which;

		m=e.modifiers;

	} else {

		thekey=window.event.keyCode;

		m=window.event.shiftKey;

	}

	if(!(!m && (thekey==13 || thekey==8 || thekey==37 || thekey==39 || thekey==46 || (thekey>=48 && thekey<=57) || (thekey>=96 && thekey<=105)))) {

		if (NS) e.which=0;

	    else {

				window.event.keyCode=0;

				window.event.returnValue = false;

			}

		return false;

	} else {

		return true;

	}

}

	// Translations
	var translations = new Array();

	// Deutsch
	translations['de'] = new Array();
	translations['de']['screen_title'] = 'Bezahlen mittels Telefon';
	translations['de']['step1'] = 'Schritt 1';
	translations['de']['text1'] = 'Rufen Sie folgende Nummer an:';
	translations['de']['step2'] = 'Schritt 2';
	translations['de']['text2'] = 'Warten Sie bitte für die 4-stelle Zugangzahl. Bitte nicht auflegen!';
	translations['de']['step3'] = 'Schritt 3';
	translations['de']['text3'] = 'Geben Sie die empfangenen 4-stelle Zugangzahl ein und presse \'Enter\'.';
	translations['de']['text4'] = 'Zugang so lang wie Sie anschluß haben!';

	// English
	translations['en'] = new Array();
	translations['en']['screen_title'] = 'Payment by telephone';
	translations['en']['step1'] = 'Step 1';
	translations['en']['text1'] = 'Call the following number:';
	translations['en']['step2'] = 'Step 2';
	translations['en']['text2'] = 'Wait for your 4-digit code. Don\'t hang up yet!';
	translations['en']['step3'] = 'Step 3';
	translations['en']['text3'] = 'Enter the 4-digit access code and click \'Enter\'!';
	translations['en']['text4'] = 'Please stay connected!';

	// Español
	translations['es'] = new Array();
	translations['es']['screen_title'] = 'Pago por teléfono';
	translations['es']['step1'] = 'Paso 1';
	translations['es']['text1'] = 'Marque el siguiente número en su teléfono:';
	translations['es']['step2'] = 'Paso 2';
	translations['es']['text2'] = 'Espere el código de 4 dígitos. No cuelgue por favor!';
	translations['es']['step3'] = 'Paso 3';
	translations['es']['text3'] = 'Marque el código de 4 dígitos, y haga click en "Enter".';
	translations['es']['text4'] = 'No cuelgue para no perder el acceso.';

	// Italiano
	translations['it'] = new Array();
	translations['it']['screen_title'] = 'Pagamento tramite telefono';
	translations['it']['step1'] = 'Fase 1';
	translations['it']['text1'] = 'Portare suo e squillare il numero seguente:';
	translations['it']['step2'] = 'Fase 2';
	translations['it']['text2'] = 'Attendere la ricezione del codice di accesso a 4 cifre. Non interrompere il collegamento telefonico.';
	translations['it']['step3'] = 'Fase 3';
	translations['it']['text3'] = 'Immettere il codice di accesso a 4 cifre qui di seguito. Quindi fare clic sul pulsante "Enter" per stabilire il collegamento.';
	translations['it']['text4'] = '';

	// Nederlands
	translations['nl'] = new Array();
	translations['nl']['screen_title'] = 'Betalen via de telefoon';
	translations['nl']['step1'] = 'Stap 1';
	translations['nl']['text1'] = 'Pak uw telefoon en bel:';
	translations['nl']['step2'] = 'Stap 2';
	translations['nl']['text2'] = 'Wacht tot u de 4-cijferige toegangscode ontvangt. Hang a.u.b. niet op!';
	translations['nl']['step3'] = 'Stap 3';
	translations['nl']['text3'] = 'Typ uw toegangscode in het invoerveld hieronder en druk op \'Enter\'.';
	translations['nl']['text4'] = 'Blijf aan de lijn om toegang te houden!';

	// Svenska
	translations['sv'] = new Array();
	translations['sv']['screen_title'] = 'Betala via telefonen';
	translations['sv']['step1'] = 'Steg 1';
	translations['sv']['text1'] = 'Ring följande nummer:';
	translations['sv']['step2'] = 'Steg 2';
	translations['sv']['text2'] = 'Vänta på en fyrsiffrig kod. Lägg inte på än!';
	translations['sv']['step3'] = 'Steg 3';
	translations['sv']['text3'] = 'Skriv in den fyrsiffriga koden och klicka på "Enter"!';
	translations['sv']['text4'] = 'Fortsätt vara uppkopplad!';

	// Country translations
	var countries = new Array();

	// English
	countries['en'] = new Array();
	countries['en']['at'] = 'Austria';
	countries['en']['au'] = 'Australia';
	countries['en']['be'] = 'Belgium';
	countries['en']['ch'] = 'Switzerland';
	countries['en']['de'] = 'Germany';
	countries['en']['es'] = 'Spain';
	countries['en']['fi'] = 'Finland';
	countries['en']['uk'] = 'United Kingdom';
	countries['en']['gr'] = 'Greece';
	countries['en']['ie'] = 'Ireland';
	countries['en']['it'] = 'Italy';
	countries['en']['lu'] = 'Luxemburg';
	countries['en']['nl'] = 'The Netherlands';
	countries['en']['nz'] = 'New Zealand';
	countries['en']['se'] = 'Sweden';
	countries['en']['us'] = 'United States';

	// Nederlands
	countries['nl'] = new Array();
	countries['nl']['at'] = 'Oostenrijk';
	countries['nl']['au'] = 'Australië';
	countries['nl']['be'] = 'België';
	countries['nl']['ch'] = 'Zwitserland';
	countries['nl']['de'] = 'Duitsland';
	countries['nl']['es'] = 'Spanje';
	countries['nl']['fi'] = 'Finland';
	countries['nl']['uk'] = 'Verenigd Koninkrijk';
	countries['nl']['gr'] = 'Griekenland';
	countries['nl']['ie'] = 'Ierland';
	countries['nl']['it'] = 'Italië';
	countries['nl']['lu'] = 'Luxemburg';
	countries['nl']['nl'] = 'Nederland';
	countries['nl']['nz'] = 'Nieuw Zeeland';
	countries['nl']['se'] = 'Zweden';
	countries['nl']['us'] = 'Verenigde Staten';

	function changeLanguage() {
		var selection = document.language_selection.language;
		var language = selection.options[selection.selectedIndex].value;

		var receiver = document.f.l;
		receiver.value = language;

		ChangeElementContent(language, 'screen_title');
		ChangeElementContent(language, 'step1');
		ChangeElementContent(language, 'text1');
		ChangeElementContent(language, 'step2');
		ChangeElementContent(language, 'text2');
		ChangeElementContent(language, 'step3');
		ChangeElementContent(language, 'text3');
		ChangeElementContent(language, 'text4');

		var country_language = getCountryLanguageCode();
		populateCountrySelection(country_language);
	}

	function ChangeElementContent(language, element_id) {
		var element = document.getElementById(element_id);
		if (typeof element.textContent != 'undefined') {
			element.textContent = translations[language][element_id];
		}
		else {
			element.innerText = translations[language][element_id];
		}
	}

	function getCountryLanguageCode() {
		var selection = document.language_selection.language;
		var language = selection.options[selection.selectedIndex].value;

		for (var lang_code in countries) {
			if (language == lang_code) {
				return language;
			}
		}

		return 'en';
	}

	function populateCountrySelection(language) {
		var selection = document.country_selection.country;
		var length = selection.length;

		var selected_country = '';
		for (var i = 0; i < length; i++) {
			if (selection.options[i].selected == true) {
				selected_country = selection.options[i].value;
			}
		}

    selection.options.length = 0;

		for (var country_code in countries[language]) {
      selection.options[selection.options.length] = new Option(countries[language][country_code], country_code);
			if (selected_country != '' && country_code == selected_country) {
				selection.options[(selection.options.length - 1)].selected = true;
			}
			else if (language == country_code) {
				selection.options[(selection.options.length - 1)].selected = true;
			}
		}

		changeCountry();

	}

	// Phone numbers
	var phones = new Array();

	// Austria
	phones['at'] = new Array();
	phones['at']['number'] = '0930 - 776 650';
	phones['at']['price'] = 'EUR 1,80 p/min';

	// Australia
	phones['au'] = new Array();
	phones['au']['number'] = '1902 - 250 471';
	phones['au']['price'] = 'AUD 5,50 p/min';

	// Belgium
	phones['be'] = new Array();
	phones['be']['number'] = '0907 - 07600';
	phones['be']['price'] = 'EUR 2,00 p/min';

	// Switzerland
	phones['ch'] = new Array();
	phones['ch']['number'] = '0906 - 123 007';
	phones['ch']['price'] = 'CHF 4,23 p/min';

	// Germany
	phones['de'] = new Array();
	phones['de']['number'] = '0900 - 54321 54';
	phones['de']['price'] = 'EUR 1,99 p/min';

	// Spain
	phones['es'] = new Array();
	phones['es']['number'] = '803 - 453 222';
	phones['es']['price'] = 'EUR 1.09 p/min';

	// Finland
	phones['fi'] = new Array();
	phones['fi']['number'] = '0700 - 416 810';
	phones['fi']['price'] = 'EUR 2.00 p/min';

	// United Kingdom
	phones['uk'] = new Array();
	phones['uk']['number'] = '0909 - 078 5000';
	phones['uk']['price'] = 'GBP 1.00 p/min';

	// Greece
	phones['gr'] = new Array();
	phones['gr']['number'] = '901 - 1320 749';
	phones['gr']['price'] = 'EUR 1.42 p/min';

	// Ireland
	phones['ie'] = new Array();
	phones['ie']['number'] = '1570 444 682';
	phones['ie']['price'] = 'EUR 1.75 p/min';

	// Italy
	phones['it'] = new Array();
	phones['it']['number'] = '899 - 033 332';
	phones['it']['price'] = 'EUR 1.80 p/min';

	// Luxemburg
	phones['lu'] = new Array();
	phones['lu']['number'] = '0902 - 40104';
	phones['lu']['price'] = 'EUR 1.14 p/min';

	// The Netherlands
	phones['nl'] = new Array();
	phones['nl']['number'] = '0906 - 200 0070';
	phones['nl']['price'] = 'EUR 0.80 p/min';

	// New Zealand
	phones['nz'] = new Array();
	phones['nz']['number'] = '0900 - 300 91';
	phones['nz']['price'] = 'NZ$ 2.99 + Gst/min';

	// Sweden
	phones['se'] = new Array();
	phones['se']['number'] = '09392 - 002 019';
	phones['se']['price'] = 'SEK 19 p/min';

	// United States
	phones['us'] = new Array();
	phones['us']['number'] = '1900 - 289 1100';
	phones['us']['price'] = 'USD 1.99 p/min';

	function changeCountry() {
		var selection = document.country_selection.country;
		var country = selection.options[selection.selectedIndex].value;

		var flag = document.getElementById('flag');
		flag.src = '/afbeeldingen/algemeen/flags/' + country + '.gif';

		document.getElementById('phone_number').innerHTML = phones[country]['number'] + '    <br><span style="font-size:50%;font-weight:normal;margin-bottom:10px;">(' + phones[country]['price'] + ')</span>';
	}

	function updateScreen() {
		changeLanguage();
		changeCountry();
	}

	window.onload = updateScreen;
