
var commentsEN = new Array(
"What is the Gujji's tribe favorite jewelry?",
"Where can you get a gun in Ethiopia?",
"Why do Kenyan cops enjoy walking on the beach?",
"How do you fit 30 persons into a 12-seat minibus?",
"What is John Wayne's favorite store in Nairobi?",
"Where can you get a taste of a giraffe's tongue?",
"Why did Merritt end up in the principal's office?",
"How do you kill a chicken?",
"What does Merritt do with a pack of raw hot-dogs in Patagonia?",
"Have you already experienced the silence of the desert?",
"Why does the Virgin Mary look like a mountain in Bolivia?",
"Why should Pierre gargle with holy water?",
"What do the Argentinean border-guards do with a donkey?",
"What traits does Pierre share with a llama?",
"Why doesn't everybody follow the same road around the world on motorcycle as Ewan MacGregor?",
"How many people fell on their knees in front of us during this trip?",
"What did Darwin forget to document when he met the Indians in Tierra del Fuego?",
"How deep are the tombs of the Recoleta cemetary?",
"Where can you find a one-octave orchestra in Buenos Aires?",
"What were Merritt's first words in Spanish?",
"What should you do with your dirty clothes in Patagonia?",
"Why do programmers stop on Ruta Nacional 3?",
"Why should you teach Swahili to your kids?",
"What is the highest building in Zanzibar?",
"Do you know when not to resist a request to bribe?",
"How do you approach a dolphin?",
"Why can't you fill your basket with tomatoes immediately after buying it?",
"In how many languages can you say \"Thank you\"?",
"How did Merritt learn to speak Spanish in just one night?",
"Would you like to learn how to change a Michelin Desert tire in less than 3 hours?",
"Can you tell the difference between an intestinal worm and a bacterial infection?",
"Where can you find the best lemon tart in the whole world?",
"How long can you survive in the no-man's-land between Sudan and Ethiopia?"
);


var commentsFR = new Array(
"Quels sont les bijoux pr&eacute;f&eacute;r&eacute;s dans la tribu des Gujji?",
"O&ugrave; pouvez-vous trouver un flingue en Ethiopie?",
"Pourquoi les flics au Kenya aiment-ils marcher sur la plage?",
"Comment faites-vous rentrer 30 personnes dans un minibus 12-places?",
"Quel est le magasin pr&eacute;f&eacute;r&eacute; de John Wayne &agrave; Nairobi?",
"O&ugrave; pouvez-vous go&ucirc;ter la langue d'une girafe?",
"Pourquoi Merritt a-t'elle fini dans le bureau du proviseur?",
"Comment faites-vous pour tuer un poulet?",
"Que fait Merritt avec un paquet de saucisses crues en Patagonie?",
"Avez-vous d&eacute;j&agrave; go&ucirc;t&eacute; le silence du d&eacute;sert?",
"Pourquoi la Vierge Marie ressemble-t'elle &agrave; une montagne en Bolivie?",
"Pourquoi Pierre devrait-il se gargariser &agrave; l'eau b&eacute;nite?",
"Que font les gardes-fronti&egrave;res argentins avec un &acirc;ne?",
"Quel traits Pierre partage-t'il avec le lama?",
"Pourquoi tout le monde ne suit-il pas la route autour du monde en moto de Ewan MacGregor?",
"Combien de personnes sont-elles tomb&eacute;es &agrave; genoux devant nous durant le voyage?",
"Qu'est-ce que Darwin a oubli&eacute; de documenter quand il rencontra les Indiens en Terre de Feu?",
"Quelle est la profondeur des tombes du cimeti&egrave;re du Ricoleta?",
"O&ugrave; pouvez-vous trouver un orchestre &agrave; un octave &agrave; Buenos Aires?",
"Quels furent les premiers mots de Merritt en espagnol?",
"Que devez-vous faire avec votre linge sale en Patagonie?",
"Pourquoi les programmeurs s'arr&ecirc;tent-ils sur la Ruta Nacional 3?",
"Pourquoi devriez-vous enseigner le Swahili &agrave; vos gamins?",
"Quel est le plus haut immeuble de Zanzibar?",
"Savez-vous quand ne pas r&eacute;sister &agrave; une demande de backshish?",
"Comment faire pour appprocher un dauphin?",
"Pourquoi ne pouvez-vous pas remplir votre panier de tomates imm&eacute;diatement apr&egrave;s l'avoir achet&eacute;?",
"En combien de langues savez-vous dire \"Merci\"?",
"Comment Merritt a-t'elle appris &agrave; parler l'espagnol en une seule nuit?",
"Aimeriez-vous apprendre &agrave; changer un pneu Michelin D&eacute;sert en moins de 3 heures?",
"Connaissez-vous la diff&eacute;rence entre un vers intestinal et une infection bact&eacute;rienne?",
"O&ugrave; se trouve la meilleure tarte au citron au monde?",
"Combien de temps pouvez-vous survivre dans le no-man's-land entre le Soudan et l'Ethiopie?"
);

var comments = (langFr ? commentsFR : commentsEN);
var commentIndex = 0;
var eltIndex = 0;
var eltList = 0;

function DisplayComments(idList) {
	eltList = idList;
	for (var i = 0; i < eltList.length; i ++) {
		SetOpacity(document.getElementById(eltList[i]), 0);
	}
	commentIndex = Math.floor(Math.random()*comments.length); // start with a comment at random
	DisplayOneComment();
}

var STATUS_Start = 0;
var STATUS_IncreaseOpacity = 1;
var STATUS_DecreaseOpacity = 2;
var status = STATUS_Start;
var curOpacity = 0;

function SetOpacity(elt, value) {
	elt.style.opacity = String(value);
	elt.style.mozOpacity = String(value);
	elt.style.filter = "alpha(opacity=" + (value*100) + ")";

	// WinIE hack: for opacity to work correctly when font smoothing is enabled,
	// we need to set a background color (and we do that by reusing a class).
	if (value == 0 && screen.fontSmoothingEnabled) {
		if (elt.className.indexOf("archLinks") == -1) {
			elt.className += " archLinks";
		}
	}
}

function DisplayOneComment() {
		var interval = 5;
		var elt = document.getElementById(eltList[eltIndex]);
		if (!elt) return;

		switch (status) {
			case STATUS_Start:
				curOpacity = 0;
				SetOpacity(elt, 0);
				elt.innerHTML = comments[commentIndex];
				status = STATUS_IncreaseOpacity;
				break;

			case STATUS_IncreaseOpacity:
				curOpacity += 0.01;
				if (curOpacity < 1) {
					SetOpacity(elt, curOpacity);
				}
				else {
					interval = 3000;
					status = STATUS_DecreaseOpacity;
				}
				break;

			case STATUS_DecreaseOpacity:
				curOpacity -= 0.01;
				if (curOpacity > 0) {
					SetOpacity(elt, curOpacity);
				}
				else {
					status = STATUS_Start;

					eltIndex ++;
					if (eltIndex >= eltList.length)
						eltIndex = 0;

					commentIndex ++;
					if (commentIndex >= comments.length)
						commentIndex = 0;
				}
				break;
		}
		setTimeout('DisplayOneComment()', interval);
}
