function changeLanguage(formular)
{
   // get the current URL and split it into its part 
  var source = document.URL;
  var pathElements = source.split('/');
  var target = 'http:/';
  var anzahl = pathElements.length;

  // Testvariable and test output
  // var anzahl2 = 0;
  // alert("Anzahl: " + anzahl);
  
  // initialize language variables
  var oldLang = '';
  var newLang = '';
  // get the selected language
  var myindex=formular.langOpts.selectedIndex;
  newLang=formular.langOpts.options[myindex].value;
  // alert("newLang: " + newLang);

  // build the first part of new URL with www.
  target = target + '/' + pathElements[2];
  
  // test output
  // alert("Target: " + target);  

  // build that part of the new URL    
  for (var i=3; i < anzahl-1; i++)
 {
    if (pathElements[i] == 'de' || pathElements[i] == 'en' || pathElements[i] == 'ru')
    {
       oldLang = pathElements[i];
       target = target + '/' + newLang;
    }
    else
    {
       // test output       
       // alert("Path: " + pathElements[i]);

       target = target + '/' + get_lib_name(pathElements[i]);
       // test output
       // alert("Else-Target: " + target);
    }
  }
  target = target + '/' + pathElements[anzahl-1];

  // set the action param on the form to the new URL of target page
  // submit the current page to the server to cause the redirection to the new URL
  formular.langOpts.value = oldLang;
  formular.action = target;
  formular.submit();
}

function get_lib_name(libentry)
{
   var Ergebnis = "";
   // test output
   // alert("Libentry: " + libentry);

   for (var j=0;j<libname.length;j++)
   {
      if (libname[j]["lib_e"] == libentry)
      {
         // change library name
         Ergebnis = libname[j]["lib_d"];
         // test output
         // alert("Ergebnis: " + Ergebnis);

         break;
      }
   }
   return Ergebnis;
} 