// JavaScript Document
// **********************************************************************************
// *** ar_yezh ermittelt, wie der akutelle Dateiname ist und hängt eine Länderkennung
// *** daran, je nachdem, welches Land in der Sprachenauswahl angeklickt wurde.
// *** Dann wird die entsprechende Datei geöffnet.
// *** (C) 2010 by Tobias Berndt
// *** getestet mit OPERA 11.10 (Linux)
// ***				IE 8
// ***              Firefox 5 (Linux / Windows)
// **********************************************************************************

  function ar_yezh (yezh) {
// *** Deklarationen ****************************************************************
	  var a = 0;
	  var punktpos = 0;
	  var r_a = new Array ();
	  var r_b = new Array ();
	  var r_c = new Array ();
	  
	  r_a = document.URL;
// *** Wo ist der Punkt vor dem 'html' im Dateinamen? *******************************
      for (a = 0; a < r_a.length; a++) {
                if (r_a.slice (a, a + 5) == ".html")
		  punktpos = a;
        }
      if (!punktpos) {
        r_a = r_a.concat ("index.html");
        for (a = 0; a < r_a.length; a++) {
                if (r_a.slice (a, a + 5) == ".html")
		  punktpos = a;
        }
      }
// *** Heißt die Datei 'index' ? ****************************************************	  
// *** NEIN! - Dateinamen für Sprachversion erzeugen ********************************		  
      if (r_a.slice (punktpos - 5, punktpos) != "index") {
		r_b = r_a.slice (0, punktpos - 3);
		if (yezh == "de")
		  r_c = r_b.concat ("_de.html");
		if (yezh == "fr")
		  r_c = r_b.concat ("_fr.html");
		if (yezh == "br")
		  r_c = r_b.concat ("_br.html");
		if (yezh == "en")
		  r_c = r_b.concat ("_en.html");
		if (yezh == "pl")
		  r_c = r_b.concat ("_pl.html");  
		window.open (r_c, 'Sprachversion', '');  
     }
// *** JA! - Dateinamen für Sprachversion erzeugen **********************************
     if (r_a.slice (punktpos - 5, punktpos) == "index") {
		r_b = r_a.slice (0, punktpos);
		if (yezh == "de")
		  r_c = r_b.concat (".html");
		if (yezh == "fr")
		  r_c = r_b.concat ("_fr.html");
		if (yezh == "br")
		  r_c = r_b.concat ("_br.html");
		if (yezh == "en")
		  r_c = r_b.concat ("_en.html");
		if (yezh == "pl")
		  r_c = r_b.concat ("_pl.html");    
		window.open (r_c, 'Sprachversion', '');  
     }
  }
 

