﻿///////////////////////////////////////////////
// Copyright 2007 RiMedia. All rights reserved
///////////////////////////////////////////////

	// Translations
	var translations = new Array();

	// Nederlands
	translations['nl'] = new Array();
	translations['nl']['screen_title'] = 'Betaling per telefoon';
	translations['nl']['step1'] = 'Stap 1';
	translations['nl']['text1'] = 'Je belt onderstaande nummer op je inbelscherm.';
	translations['nl']['step2'] = 'Stap 2';
	translations['nl']['text2'] = 'Wacht tot je verbinding krijgt en de code hoort';
	translations['nl']['step3'] = 'Stap 3';
	translations['nl']['text3'] = 'Vul deze 4 cijferige code in en druk op enter!';
	translations['nl']['text4'] = '<span style="font-weight: bold; text-decoration: underline;">Hang de telefoon niet op.</span> Zolang je belt kun je alle films bekijken. Twee seconden nadat je hebt opgehangen stoppen de beelden!';

	// English
	translations['en'] = new Array();
	translations['en']['screen_title'] = 'Payment by phone';
	translations['en']['step1'] = 'Step 1';
	translations['en']['text1'] = 'For unlimited access to this site, call the following telephone number with your fixed or mobile telephone.';
	translations['en']['step2'] = 'Step 2';
	translations['en']['text2'] = 'Wait until you receive the four digit code.<br><span style="font-weight: bold;">Do not hang up the phone!</span>';
	translations['en']['step3'] = 'Step 3';
	translations['en']['text3'] = 'Enter your four digit access code below. Then click "Enter" to start.';
	translations['en']['text4'] = 'Remember, you only have access to this site as long as you keep the telephone line open.';

	// Country translations
	var countries = new Array();

	// 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']['it'] = 'Italië';
	countries['nl']['es'] = 'Spanje';
	countries['nl']['fi'] = 'Finland';
	countries['nl']['gb'] = 'Verenigd Koninkrijk';
	countries['nl']['gr'] = 'Griekenland';
	countries['nl']['ie'] = 'Ierland';
	countries['nl']['lu'] = 'Luxemburg';
	countries['nl']['nl'] = 'Nederland';
	countries['nl']['nz'] = 'Nieuw Zeeland';
	countries['nl']['se'] = 'Zweden';
	countries['nl']['us'] = 'Verenigde Staten';

	//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']['it'] = 'Italy';
	countries['en']['es'] = 'Spain';
	countries['en']['fi'] = 'Finland';
	countries['en']['gb'] = 'United Kingdom';
	countries['en']['gr'] = 'Greece';
	countries['en']['ie'] = 'Ireland';
	countries['en']['lu'] = 'Luxembourg';
	countries['en']['nl'] = 'The Netherlands';
	countries['en']['nz'] = 'New Zealand';
	countries['en']['se'] = 'Sweden';
	countries['en']['us'] = 'United States';

	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);

		element.innerHTML = translations[language][element_id];
	}

	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();

	}

	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 'nl';
	}

	// Phone numbers
	var phones = new Array();

	// Austria
	phones['at'] = new Array();
	phones['at']['number'] = '0930-776650';
	phones['at']['price'] = 'EUR 1,80 p/min';

	// Australia
	phones['au'] = new Array();
	phones['au']['number'] = '1902-250471';
	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-123007';
	phones['ch']['price'] = 'CHF 4,23 p/min';

	// Germany
	phones['de'] = new Array();
	phones['de']['number'] = '0900-5432150';
	phones['de']['price'] = 'EUR 1,99 p/min';

	// Italy
	phones['it'] = new Array();
	phones['it']['number'] = '899-033332';
	phones['it']['price'] = 'EUR 1,80 p/min';

	// Spain
	phones['es'] = new Array();
	phones['es']['number'] = '803-453222';
	phones['es']['price'] = 'EUR 1,09 p/min';

	// Finland
	phones['fi'] = new Array();
	phones['fi']['number'] = '0700-416810';
	phones['fi']['price'] = 'EUR 2,00 p/min';

	// United Kingdom
	phones['gb'] = new Array();
	phones['gb']['number'] = '0909-0785000';
	phones['gb']['price'] = 'GBP 1,00 p/min';

	// Greece
	phones['gr'] = new Array();
	phones['gr']['number'] = '901-1320749';
	phones['gr']['price'] = 'EUR 1,428 p/min';

	// Ireland
	phones['ie'] = new Array();
	phones['ie']['number'] = '1570-444682';
	phones['ie']['price'] = 'EUR 1,75 p/min';

	// Luxemburg
	phones['lu'] = new Array();
	phones['lu']['number'] = '0905-47247';
	phones['lu']['price'] = 'EUR 1,14 p/min';

	// The Netherlands
	phones['nl'] = new Array();
	phones['nl']['number'] = '0906-200 0045';
	phones['nl']['price'] = 'EUR 0,80 p/min';

	// New Zealand
	phones['nz'] = new Array();
	phones['nz']['number'] = '0900-30091';
	phones['nz']['price'] = 'NZD 3,36 p/min';

	// Sweden
	phones['se'] = new Array();
	phones['se']['number'] = '0939-2002019';
	phones['se']['price'] = 'SEK 19,00 p/min';

	// United States
	phones['us'] = new Array();
	phones['us']['number'] = '1900-2891100';
	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'] + '    <span style="font-size:50%;font-weight:normal;">(' + phones[country]['price'] + ')</span>';
	}

	function updateScreen() {
		changeLanguage();
		changeCountry();
	}

	window.onload = updateScreen;

