//document.write(document.cookie);

// deaktiviert, cookie wird wieder neu gesetzt, wenn man die Seite aufruft  09.11.2004
//if (document.cookie.search(/vthk-sprache/) != "-1") {
//   spr = document.cookie.substr(document.cookie.search(/vthk-sprache/)+13,2);
//   //alert(spr);
//   }
//else
//   { 

   if (document.URL.search(/\Wen\W/) == "-1") {
      spr_cook("de");
      spr = "de"
      }
   else {
      spr_cook("en");
      spr = "en"
      }

//   }

// Kein Automatischer Refresh auf die englische Seite, wenn bei vorhandenem Cookie "en"
// die deutsche Seite aufgerufen wird     08.11.2004
//if (spr == "en" && document.URL.search(/\Wen\W/) == "-1") {
//   url1  = window.location.href.substr(0,window.location.href.lastIndexOf("/"));
//   url2  = window.location.href.substr(window.location.href.lastIndexOf("/"),window.location.href.length);
//   window.location.href = url1 + "/en" + url2;
//}

//if (spr == "de" && document.URL.search(/_en\./) != "-1") {
//   window.location.href = "index_de.htm";
//}

function sprache(spr) {

spr_cook(spr);

if (spr == "de") {
   url1  = window.location.href.substr(0,window.location.href.lastIndexOf("/")-3);
   url2  = window.location.href.substr(window.location.href.lastIndexOf("/"),window.location.href.length);
   window.location.href = url1 + url2
   } 

if (spr == "en") {
   url1  = window.location.href.substr(0,window.location.href.lastIndexOf("/"));
   url2  = window.location.href.substr(window.location.href.lastIndexOf("/"),window.location.href.length);
   window.location.href = url1 + "/en" + url2
   }

}

function spr_cook(spr) {
	var expires = new Date()
	// Ein Jahr
	expires.setTime(expires.getTime() + 31536000000)
	var cookie = "vthk-sprache" + "="
	cookie += spr
	cookie += "; expires=" + expires.toGMTString() + ";path=/"
	document.cookie = cookie
}