/******************************************
* 
* Language Selector
* By Carina
*
******************************************/

// this adds the language bar for pages which exist in all three languages
var docLocation = document.location.href;

if(docLocation.indexOf(".htm") == -1) {	// Assume that the URL ends with a slash and therefore refers to the index.
	docLocation += "index.html";
}

if(docLocation.indexOf("_en") != -1) { // It has _en on the end
	var docLocationGerman = docLocation.replace(new RegExp("_en"), "");
	var docLocationFrench = docLocation.replace(new RegExp("_en"), "_fr");

	document.write("<span><a href=\"" + docLocationGerman + "\">Deutsch</a></span>" +
			"<span><a href=\"" + docLocationFrench + "\">Fran&ccedil;ais</a></span>" +
			" <span class=\"lastlink\">English</span>");
} else if(docLocation.indexOf("_fr") != -1) { //It has _fr on the end
	var docLocationGerman = docLocation.replace(new RegExp("_fr"), "");
	var docLocationEnglish = docLocation.replace(new RegExp("_fr"), "_en");

	document.write("<span><a href=\"" + docLocationGerman + "\">Deutsch</a></span>" +
			" <span>Fran&ccedil;ais</span>" +
			"<span class=\"lastlink\"><a href=\"" + docLocationEnglish + "\">English</a></span>");
} else { //Its in german
	var docLocationFrench = docLocation.replace(new RegExp("\.htm"), "_fr\.htm");
	var docLocationEnglish = docLocation.replace(new RegExp("\.htm"), "_en\.htm");
	
	document.write("<span>Deutsch</span>" +
			"<span><a href=\"" + docLocationFrench + "\">Fran&ccedil;ais</a></span>" +
			"<span class=\"lastlink\"><a href=\"" + docLocationEnglish + "\">English</a></span>");
}


