// onerror = stopError;	// 	Javascript Fehler unterdruecken
function stopError()
{ return true; }

document.write("");// muss unbedingt sein, denn sonnst macht nn4 probleme mit setTimeout !!!

//eval('parent.menue_' + self.name + ' = \"nicht geladen\";'); // menue_seiten als nicht geladen markieren

var local = location.href.slice(0,(location.href.indexOf('english') - 1));

var url = location.pathname;
var size = url.length;

var host = location.host;

var parameter = location.search;
var anker = location.hash;
anker = anker.replace(/#/,"");

if (host.indexOf('beckhoff') != -1 || host.indexOf('twincat') != -1  || host.indexOf('busbox') != -1 || host.indexOf('twinsafe') != -1 || host.indexOf('be-home') != -1 || host.indexOf('lightbus') != -1 || host == "") {
	cache = false;
}
else {
	cache = true;
}

url = url.substring(url.indexOf('english')+8, size) + location.hash;

if  (anker != "") {
	url = url + "&anker=" + anker;
}

// frame_wrapper_teil +++ wenn meneu fehlt, nicht popup und keine index_datei
if ( top.frames.length == 0 && self.name != "popupwin" && location.href.indexOf('english') != -1 && cache == false)
{ location.replace("../../../english/default.htm?" + url + parameter); }


var ref = document.referrer; 
var sucheNL = ref.indexOf('beckhoff.nl'); //Gerändert SebastianGl
var sucheDutch = ref.indexOf('dutch/'); //Gerändert LeonZ

if( sucheNL < 0 && sucheDutch < 0 )
{
	// baum nachladen, nur wenn der Link nicht vom menu.php kommt
	if(parent.frame_left != undefined)
	{
	//baum nachladen, nur wenn der Link nicht vom menu.php kommt
	var ref2 = parent.frame_left.location.href;
	var ref3 = parent.frames[1].location.href;
	
	var suche = ref.indexOf('menu.php');
	//var sucheNL = ref3.indexOf('beckhoff.nl'); //Gerändert SebastianGl
	var sucheIT = ref2.indexOf('/it/'); //Gerändert LeonZ
	var sucheCN = ref2.indexOf('/cn/'); //Gerändert LeonZ
	//var sucheDutch = ref3.indexOf('dutch/'); //Gerändert LeonZ
	var sucheAU = ref2.indexOf('/au/'); //Gerändert SebastianGl
	var sucheFR = ref2.indexOf('/fr/'); //Gerändert SebastianGl
	var sucheBR = ref2.indexOf('/br/'); //Gerändert SebastianGl
	var sucheAE = ref2.indexOf('/ae/'); //Gerändert SebastianGl
	var sucheAEEN = ref2.indexOf('/aeen/'); //Gerändert SebastianGl
	var sucheDK = ref2.indexOf('/dk/'); //Gerändert SebastianGl
	var sucheES = ref2.indexOf('/es/'); //Gerändert SebastianGl
	var sucheFI = ref2.indexOf('/fi/'); //Gerändert SebastianGl
	var sucheIN = ref2.indexOf('/in/'); //Gerändert SebastianGl
	var sucheNO = ref2.indexOf('/no/'); //Gerändert SebastianGl
	var suchePL = ref2.indexOf('/pl/'); //Gerändert SebastianGl
	var sucheRU = ref2.indexOf('/ru/'); //Gerändert SebastianGl
	var sucheSE = ref2.indexOf('/se/'); //Gerändert SebastianGl
	var sucheSI = ref2.indexOf('/si/'); //Gerändert SebastianGl
	var sucheTR = ref2.indexOf('/tr/'); //Gerändert SebastianGl
	var sucheUSA = ref2.indexOf('/usa/'); //Gerändert SebastianGl
	var sucheZA = ref2.indexOf('/za/'); //Gerändert SebastianGl
	var sucheBE = ref2.indexOf('/be/'); //Gerändert SebastianGl
	var sucheBEFR = ref2.indexOf('/befr/'); //Gerändert SebastianGl
	
	// Abfrage über ref, da bei vollständigem Framesetwechsel ref2 keinen Wert enthält
	var sucheAE2 = ref.indexOf('ae.asp?'); // Geändert SebastianGl
	var sucheAEEN2 = ref.indexOf('aeen.asp?'); // Geändert SebastianGl
	
	// in speziellen Fällen Baum nachladen, wenn reload=1
	var reload_menu = location.search.indexOf('reload=1');
	
	//var suche2 = ref.indexOf('english/') //Gerändert LeonZ
	//var suche3 = ref.indexOf('english.asp?') //Gerändert LeonZ
	
	if ((suche < 0 && sucheIT < 0 && sucheCN < 0  && sucheNL < 0 && sucheDutch < 0)|| reload_menu > 0 )
	{ 	
		var liste = new Werteliste(location.search);
		var id = "";
		
		for(eigenschaft in liste) {
			if (eigenschaft == "id") {
			 id = liste[eigenschaft];
			}
		}
		
		if (sucheIT > 0) {  //Italia with own menu.php
			parent.frame_left.location.href = "../../../it/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheAU > 0) { //Australia with own menu.php
			parent.frame_left.location.href = "../../../au/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheBE > 0) { 
			parent.frame_left.location.href = "../../../be/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheBEFR > 0) { 
			parent.frame_left.location.href = "../../../befr/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheNO > 0) { 
			parent.frame_left.location.href = "../../../no/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (suchePL > 0) { 
			parent.frame_left.location.href = "../../../pl/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheRU > 0) { 
			parent.frame_left.location.href = "../../../ru/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheSE > 0) { 
			parent.frame_left.location.href = "../../../se/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheSI > 0) { 
			parent.frame_left.location.href = "../../../si/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheTR > 0) { 
			parent.frame_left.location.href = "../../../tr/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheUSA > 0) { 
			parent.frame_left.location.href = "../../../usa/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheZA > 0) { 
			parent.frame_left.location.href = "../../../za/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheIN > 0) { //India with own menu.php
			parent.frame_left.location.href = "../../../in/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheFI > 0) { //Finland with own menu.php
			parent.frame_left.location.href = "../../../fi/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheES > 0) { //Spain with own menu.php
			parent.frame_left.location.href = "../../../es/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheDK > 0) { //Denmark with own menu.php
			parent.frame_left.location.href = "../../../dk/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheBR > 0) { //Brazil with own menu.php
			parent.frame_left.location.href = "../../../br/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheFR > 0) { //France with own menu.php
			parent.frame_left.location.href = "../../../fr/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheAE > 0 || sucheAE2 > 0) { //Arabia with own menu.php
			parent.frame_left.location.href = "../../../ae/contents/menu.php?id=" + id + "&content=" + url;	
		}else if (sucheAEEN > 0 || sucheAEEN2 > 0) { //Arabia (en) with own menu.php
			parent.frame_left.location.href = "../../../aeen/contents/menu.php?id=" + id + "&content=" + url;	
		}else{ // Standard menu.php
			parent.frame_left.location.href = "../../contents/menu.php?id=" + id + "&content=" + url;
		}
		
	
	}
	
	}
}

function Werteliste(querystring) {
  if(querystring == '') return;
  var wertestring = unescape(querystring);
  wertestring = wertestring.slice(1);
  var paare = wertestring.split("&");
  for (var i=0; i < paare.length; i++) {
    var name = paare[i].substring(0, paare[i].indexOf("="));
    var wert = paare[i].substring(paare[i].indexOf("=")+1, paare[i].length);
    this[name] = wert;
  }
}
