//BENOETIGT NEXTURL
	var iLink=0;
	var constPrivatTree = 3;
	var constBueroTree = 2;
	var constIndustrieTree = 1;
	var fromWarenkorb = 3;
	var fromSchnellbestellung = 1;
	var fromProduktauflistung = 9;
	var constloeschen = 1;
	var constaendern = 2;
	var constanlegen = 3;
	var iMasterId=1;
	var indId=1;
	var eleId=1;
	var burId=1;
	var _indId=1;
	var _eleId=1;
	var _burId=1;
	var _kundenId=1;
	var _kundenIndId=1;
	var _kundenBurId=1;
	var _kundenEleId=1;
	var aHersteller = new Array(); // Name des Herstellers ueber den Bestand
	var aBereich = new Array ();   // Name des Bereichs ueber den Bestand
	var aBestand = new Array(); // Name des Bestandes aus der Datenbank
	var table = new Array(); // PrdId-Mapping-table
	var show=new Array(15);
	for (i=0;i<20;i++){show[i]=0;};
	var lastSohn = new Object();
	var NId = new Object();
	var NodeGeneration = new Object();
	var sReturnName="";
	var sHersteller="x";
	for (i=0;i<=10;i++) { aAusgewaehlt[i]=''};
	/* NodeMap kdk 27.8*/
	var m_aNodeMap = new Array ();
	var m_iNodeMapFree = 0; 
	var m_iNodeMapMaxNid = -1; // groesste eingetragene Nid
	for (x=1;x<4;x++){
		table[x] = new Array(); // wird für 1-3, also alle 3 Trees initialisiert
	}
	
	function NodeMapToUid (iNid) {
		var oNode = 0;
		if (iNid > m_iNodeMapMaxNid) return -1;
		for (var i = 0 ; i < m_iNodeMapFree; ++i) {
			oNode = m_aNodeMap [i];
			if (oNode && oNode.Nid == iNid) return i;
		}
		return -1;
	}
	function NodeMapRefIdToUid (iRefId) {
		var oNode = 0;

		for (var i = 0 ; i < m_iNodeMapFree; ++i) {
			oNode = m_aNodeMap [i];
			if (oNode && oNode.RefId == iRefId) return i;
		}
		return -1;
	}

	function NodeMapToNid (iUid) {
		var oNode = 0;
		if (iUid >= 0 && iUid < m_iNodeMapFree) {
			oNode =  m_aNodeMap [iUid];
			if (oNode) return oNode.Nid;
		}
		return -1;
	}
	function NodeMapNidToNode (iNid) {
		if (iNid > m_iNodeMapMaxNid) return 0;
		for (var i = 0 ; i < m_iNodeMapFree; ++i) {
			oNode = m_aNodeMap [i];
			if (oNode && oNode.Nid == iNid) return oNode;
		}
		return 0;
	}
	
	function NodeMapUidToNode (iUid) {
		if (iUid >= 0 && iUid < m_iNodeMapFree) {
			return m_aNodeMap [iUid];
		}
		return 0;
	}

	function NodeMapNew (oNode) {
		var iUid = m_iNodeMapFree;
		// es wird nicht geprueft, ob der Knoten bereits gemapped wurde.
		m_aNodeMap [iUid] = oNode;
		m_iNodeMapFree++;
		if (oNode.Nid > m_iNodeMapMaxNid) {
			m_iNodeMapMaxNid = oNode.Nid;
		}
		return iUid;
	}

/* end NodeMap kdk 27.8*/
	var AttributListe = new Array ("Hersteller", "Preis");
	
	// Object KnotenAttribute	
	function KnotenAttribut (sName, vWert) {
		// properties
		this.Next = 0;
		this.Name = sName;
		this.Wert = vWert;
		// methods
	}
	
	//end  Object KnotenAttribute

	// Object KnotenLink	
	function KnotenLink (Name) {
		// properties
		this.NextLink = 0;
		this.Name = Name;
		this.Vater = 0;
		this.Bruder = 0;
		this.Schwester = 0;
		this.Sohn = 0;
		this.Generation = 0;
		// methods
		this.ErsterBruder = KnotenLinkErsterBruder;	

	}
	function KnotenLinkErsterBruder () {
		if (!this.Sippen) return 0;
		if (!this.Sippen.Vater) return 0;
		return this.Sippen.Vater.Sippen.Sohn;
	}

	// end Object KnotenLink
	// Object Knoten
	
	function Knoten (Nid, sUniId, id) {
		var Args = Knoten.arguments;
		var Arg = 3; // wozu kdk ?
		// Properties
		this.Name = "leer";
		this.uniId = sUniId;
		this.Nid = Nid; // muss unbedingt vor dem Mappen gesetzt werden.
		// es sollte zuvor geprueft worde sein, dass ein Knoten mit dieser Nid noch nicht
		// angelegt worden ist.
		this.Id = NodeMapNew (this);
		this.RefId = 0;
		
		this.Hersteller=id;
		this.Baum = 0; // fuer welchen Tree wurde der Knoten angelegt
		this.Sippen = 0;
		this.Attribute = 0;
		// Methods
		this.NeuerSohn = KnotenAddSohn;

		this.finde = finde;
		this.action = "";
		this.SuchSippe = KnotenSuchSippe;
		this.SetAttribut = KnotenSetAttribut;
		this.GetAttribut = KnotenGetAttribut;
		this.Level = 0;
	}

	var GelinkterKnoten = 0;
	var AktuelleLinkId = 0;

	function KnotenLinken (sUniId,Hersteller, Nid,iLinkId,iRefId) {
		var oKnoten = 0;
		GelinkterKnoten = 0;
		AktuelleLinkId = iLinkId;

		oKnoten = NodeMapNidToNode (Nid);
		if (!oKnoten) {			
			// den Knoten gibt es noch nicht
    		oKnoten =  new Knoten (Nid, sUniId, Hersteller);
			oKnoten.Baum = iLinkId;
			
		} else {
			// den Knoten gibt es schon
		}
		oKnoten.RefId = iRefId;
		return oKnoten;
	}
	
	function KnotenGetAttribut (sName) {
		var oAttr = this.Attribute;
		
		while (oAttr && oAttr.Name != sName) {
			oAttr = oAttr.Next;
		}
		if (oAttr) return oAttr.Wert;		
		return 0;
	}

	function KnotenSetAttribut (sName, vWert) {
		var oAttr = this.Attribute;
		var iBestand = 0;

		if(sName=='More'){
			sName = 'More' + AktuelleLinkId;
		}

		if (GelinkterKnoten == this && sName=='Id') {
			return;
		}
		while (oAttr && oAttr.Name != sName){
			oAttr = oAttr.Next;
		}
			
		if (oAttr) {
			oAttr.Wert = vWert;
		} else {
			oAttr = new KnotenAttribut (sName, vWert);
			oAttr.Next = this.Attribute;
			this.Attribute = oAttr;			
		}
		if (GelinkterKnoten == this) {
		} else {
			if(sName=='Id'){
				this.NId=Number(vWert);
			} else if(sName=='More1' ||sName=='More2'){
				if (AktuelleLinkId == 2) this.uniId=vWert;
			} else if(sName=='Name'){
				this.Name=vWert;
				if(vWert=="Industrie"){
					//kdk alert ('1 AktuelleLinkId ' + AktuelleLinkId + ' = ' + this.Id); //--> 1
					if (AktuelleLinkId == 2) indId=this.Id;
					if (AktuelleLinkId == 1) _indId=this.Id;
					if (AktuelleLinkId == 3) _kundenIndId=this.Id;
				} else if(vWert=="uk-Industrie"){
					//kdk alert ('2 AktuelleLinkId ' + AktuelleLinkId+ ' = ' + this.Id); // --> 2
					if (AktuelleLinkId == 3) _kundenBurId=this.Id;
					if (AktuelleLinkId == 2) burId=this.Id;
					if (AktuelleLinkId == 1) _burId=this.Id;
				} else if(vWert=="Elektro"){
					if (AktuelleLinkId == 2) eleId=this.Id;
					if (AktuelleLinkId == 1) _eleId=this.Id;
					if (AktuelleLinkId == 3) _kundenEleId=this.Id;
				} else if(vWert=="Privat" || vWert=="Kunden"){ // Kundenspezifischer Baum
					if (AktuelleLinkId == 3) _kundenId=this.Id;
				}
			} else if(sName=='Hersteller'){
				if (AktuelleLinkId == 2) {
					iBestand = this.GetAttribut("Bestand");
					aHersteller[iBestand]=vWert;
					aBestand[iBestand]=iBestand;
				} else {
					//alert ('hersteller wird nicht ausgewertet');
				}
				// der Vater des Kapitels gibt den Bereich
			}
		}
	}
	
	function KnotenSuchSippe (sSippe) {
		var oSippe = this.Sippen;
		while (oSippe && oSippe.Name != sSippe) {
			oSippe = oSippe.NextLink;
		}
		if (!oSippe) {
			oSippe = new KnotenLink (sSippe);
			oSippe.NextLink = this.Sippen;
			this.Sippen = oSippe;
		}			
		return oSippe;
	}
	
	function KnotenAddSohn (oVater, sSippe) {
		var oVaterSippe = 0;
		var othisSippe = 0;
		table[sSippe][this.NId] = this.Id;
		othisSippe = this.SuchSippe (sSippe);	
		othisSippe.Vater = oVater;
		oVaterSippe = oVater.SuchSippe(sSippe);
		oVaterSippe.Schwester = this;
		othisSippe.Bruder = oVaterSippe.Sohn;		
		oVaterSippe.Sohn = this;
		othisSippe.Generation = oVaterSippe.Generation + 1;
		if (GelinkterKnoten == this) {
			return;
		}
		var iBestand = 0;
		iBestand = this.GetAttribut("Bestand");
		if (iBestand > 0) {
			if (aBereich [iBestand]) {
				//alert ('Bestand ist schon gsetzt: ' + iBestand + ' = ' + aBereich [iBestand]);
			} else {
				aBereich [iBestand] = oVater.Name;
			}
		}
	}

	function SohnAuswahlErzeugen (oNode, sSip) {
		var oSip = 0;
		var oSohn = 0;
		var sOption;
		var sAusgabe;
		var aktgen;
		var oldgen;
		sListe='';		
		oSip = GetSippe (oNode.Sippen, sSip);
		oSohn = oSip.Sohn;
		if (!oSohn) {
			if (sSip == 2) {
				sSip = 3;
			} else if (sSip == 1) {
				sSip = 2;
			}
			oSip = GetSippe (oNode.Sippen, sSip);
			oSohn = oSip.Sohn;
		}		
		while (oSohn) {
			sAusgabe = oSohn.Name;
			sOption = '';			
			if (sAusgabe.length > iLength) {
				sAusgabe=sAusgabe.slice(0,iLength-3);
				sAusgabe=sAusgabe+"...";
			}
			for (i=0;i<aAusgewaehlt.length;i++) {
				if (oSohn == aAusgewaehlt[i]){
					sOption='selected';
				}
			}
			if (oSohn.Hersteller==sHersteller || oSohn.Hersteller=='-1' || sHersteller=='x'){
				if (sOption=='selected'){
					lasthead=oSohn.Name;
					lastid=oSohn.NId;
					lastgen=oSohn.Sippen.Generation;
				}
				if (oNode.Level < 2) {
					//xxx					
					//sUrl = sAusgabe.replace(/ /g, "_") + ".jpg";
					sUrl = oSohn.Name.replace(/ /g, "_") + ".jpg";
					sUrl = sUrl.replace(/ä/g, "ae");
					sUrl = sUrl.replace(/ö/g, "oe");
					sUrl = sUrl.replace(/ü/g, "ue");
					sUrl = sUrl.replace(/Ä/g, "Ae");
					sUrl = sUrl.replace(/Ö/g, "Oe");
					sUrl = sUrl.replace(/Ü/g, "Ue");
					
					ProgrammErzeugen ("<tr>");
					ProgrammErzeugen ("<td ");
					if (sOption=='selected'){
						// Farbe des ausgewaehlten
						ProgrammErzeugen ("bgcolor='#CC0099'");
						ProgrammErzeugen (" style='color: #ffffff;'");
					} else {
						ProgrammErzeugen ("bgcolor='#ffffff'"); // Farbe wenn nichts gewaehlt
					}
					ProgrammErzeugen ("	onmouseover=\"");
					ProgrammErzeugen ("doComment(this, '" + sUrl + "');");
					if (sOption=='selected'){
						ProgrammErzeugen ("this.style.background='#CC0099';");
						ProgrammErzeugen ("this.style.color='#ffffff';");
					} else {
						//ProgrammErzeugen 
						// Farbe vom Mousover
						ProgrammErzeugen ("this.style.background='#FFCC66';"); //gelb
						ProgrammErzeugen ("this.style.color='#000000';");
					}
					lastpage = top.Inhalt.location.href;
					//ProgrammErzeugen ("top.Inhalt.location.href='produktkapitel/" + sUrl + "';");
					ProgrammErzeugen ("\"");
					ProgrammErzeugen (" onmouseout=");
					ProgrammErzeugen ("\"undoComment();");
					//ProgrammErzeugen ("top.Inhalt.location.href='" + lastpage + "';");
					if (sOption=='selected'){
						ProgrammErzeugen ("this.style.background='#CC0099';"); //violett
						ProgrammErzeugen ("this.style.color='#ffffff';\"");
					} else {
						ProgrammErzeugen ("this.style.background='#ffffff';");//hellgeb
						ProgrammErzeugen ("this.style.color='#000000';\"");
					}
					ProgrammErzeugen (" onclick=");
					ProgrammErzeugen ("\"parent.Programm.oRoot.finde("+oSohn.Id+");\"");
					ProgrammErzeugen ("	style=\"cursor:pointer\">&nbsp;");
					ProgrammErzeugen (sAusgabe);
					ProgrammErzeugen ("</td>");
					
				} else {
					ProgrammErzeugen ("<option "+sOption+" value=" + oSohn.Id +">"+ sAusgabe +"</option>\n");
				}
			}
			oSip = GetSippe (oSohn.Sippen, sSip);			
			oSohn = oSip.Bruder;
		}
	}

	function finde(idfind) {
		var oNode = 0;
		var oSip = 0;
		var oSohn = 0;
		var sSip = 0;
		var oNode = NodeMapUidToNode (idfind);
		if (!oNode) {
			return;
		}
		oSip = GetSippe (oNode.Sippen, iLink);
		if (!oSip.Sohn) {
			aAusgewaehlt[oSip.Generation] = oNode;
			sSip = iLink;
			oSip = GetSippe (oNode.Sippen, sSip );			
			if (!oSip.Sohn) {
				if (!TeilbaumNachladen (oNode)) {
					AuswahlAufbauen (iLink);
					AuswahlAusfuehren(oNode, iLink);
					//Nachladen
					return;
				}
				return; // erst auf nachladen warten
			}
		}
		aAusgewaehlt[oSip.Generation] = oNode;
		for (var i= oSip.Generation +1; i < aAusgewaehlt.length; ++i) {
			aAusgewaehlt[i] = 0;
		}
		AuswahlAufbauen (iLink);
		AuswahlAusfuehren(oNode, iLink);
	}

	function AuswahlAufbauen (Link) {
		var oNode = 0;
		var HeadLine = "PRODUKT-SORTIMENT";
		
		if (parent.g_oAccount.Language == "E") {
			HeadLine = "Products";
		}
		out = '';
		for (var i= 1; i < aAusgewaehlt.length; ++i) {
			oNode = aAusgewaehlt[i];
			oNode.Level = i;
			if (oNode.Sippen) {
				if (oNode.Sippen.Sohn) {
					ProgrammErzeugen ("<form name='"+oNode.Name+"'>\n");
					if (i<2) {
						
						ProgrammErzeugen ("<style>");
						ProgrammErzeugen ("td { ");
						ProgrammErzeugen ("font-family: Verdana, Arial, Helvetica, sans-serif; ");
						ProgrammErzeugen ("font-size: 8pt; font-style normal; ");
						ProgrammErzeugen ("font-weight: normal; color: #000000;} ");
						ProgrammErzeugen ("</style>");
						ProgrammErzeugen ("<table width=170 cellspacing=0 cellpadding=1 ");
						ProgrammErzeugen ("border=1 bordercolor=#f8bc07  bordercolorlight=#FFFFFF> ");
//					ProgrammErzeugen ("border=1 bordercolor=#fff8df  bordercolorlight=#FFFFFF> ");
						ProgrammErzeugen ("<tr>");
						ProgrammErzeugen ("<td width=170 align=left bgcolor=#ffcc66>");
						ProgrammErzeugen ("<b><font color=#59003f>&nbsp;"+HeadLine+"</b></font>");
						ProgrammErzeugen ("</td>");

						SohnAuswahlErzeugen (oNode, Link);
						
						ProgrammErzeugen ("</table>");
					} else {

						// Size = 1 einzeiliges DropDown
						
						ProgrammErzeugen ("<select name='xyz' onChange = 'parent.Programm.oRoot.finde (this.form.xyz.options[this.form.xyz.selectedIndex].value)' style = '"+sStyle[i]+"' size=1  >\n");	

						
						if (parent.g_oAccount.Language == "E") {
							ProgrammErzeugen ("<option value=-1>Please select:</option>\n");
						} else {
												
						ProgrammErzeugen ("<option value=-1>Bitte wählen Sie:</option>\n");
						}
						SohnAuswahlErzeugen (oNode, Link);
						ProgrammErzeugen ("</select>\n");
					}
					ProgrammErzeugen ("</form>\n");
				}
			}
		}
		Flush();
	}

	function strcmp (sStr1, sStr2) {
		var i = 0;
		while (i < sStr1.length && i < sStr2.length && sStr1.charCodeAt (i) == sStr2.charCodeAt (i)) {
			++i;
		}
		return i < sStr1.length && i < sStr2.length ? (sStr1.charCodeAt (i) - sStr2.charCodeAt (i)) : sStr1.length - sStr2.length
	}
	
	sortorder = new Array();
	
	function HerstellerSortieren(){
		sTemp1="";
		sTemp2="";
		iTemp1=0;
		len=aHersteller.length;
		for (i=0;i<=len;i++){
			for (j=0;j<i;j++){
				if (aHersteller[i]+"x"!="undefinedx"&&aHersteller[j]+"x"!="undefinedx"){
					if (strcmp(aHersteller[i],aHersteller[j])>0){
						sTemp1=aHersteller[i];
						aHersteller[i]=aHersteller[j];
						aHersteller[j]=sTemp1;
						sTemp2=aBereich[i];
						aBereich[i]=aBereich[j];
						aBereich[j]=sTemp2;
						iTemp1=aBestand[i];
						aBestand[i]=aBestand[j];
						aBestand[j]=iTemp1;
					}
				}
			}
		}
	}
	
	function HerstellerAnhaengen (oHersteller) {
		this.Next = oHersteller;	
	}

	function Hersteller (sHerstellerName) {
		this.HerstellerName= sHerstellerName;
		this.Anhaengen=HerstellerAnhaengen;
	}
	
	function HerstellerAuswahlAufbauen (Bereich) {
		var test=0;
		var sBereich = "";
		HerstellerSortieren();
		if (Bereich == 1) { // Buero
			sBereich = "Büro";
		} else if (Bereich == 2) { // Industrie
			sBereich = "Industrie";
		}
		out='';
		ProgrammErzeugen ("<form name='Hersteller'>\n");
		ProgrammErzeugen ("<select onChange='parent.Programm.findeHst(this.form.xyz.options[this.form.xyz.selectedIndex].value)' name='xyz' style='"+sStyle[1]+"'>\n");
		if (sHersteller == 'x') 
			ProgrammErzeugen ("<option selected value=''>Bitte ausw&auml;hlen</option>\n");
			
		for (var i=aHersteller.length;i>0;i--){
			if (aHersteller[i]+"x"!="undefinedx" && aBereich[i]==sBereich){
				++test;
				 if (aBestand[i] == sHersteller) {
				 	ProgrammErzeugen ("<option selected value='"+aBestand[i]+"'>"+aHersteller[i]+"</option>\n");	
				} else {
					ProgrammErzeugen ("<option value='"+aBestand[i]+"'>"+aHersteller[i]+"</option>\n");	
				}
			} else {
				//kein Bestand
			}
		}
		if (!test){
			ProgrammErzeugen ("<option value='0'>Hersteller z.Zt.\nnicht verfügbar</option>\n");
		}
		ProgrammErzeugen ("</select>\n");
		ProgrammErzeugen ("</form>\n");
	}
		
	function TeilbaumNachladen (oNode) {
		var DbName = ""
		var sMore = "";
		var sUrl = "";
		sMore = oNode.GetAttribut("More" + iLink);
		DbName = "Db=" + parent.g_oSession.ShopDatenbank;
		lvlGen = oNode.Sippen.Generation + 1;
		if (sMore && sMore != "") {
			if (iLink == constIndustrieTree) {
				sUrl = nxtURL("_tree_treegen.asp", DbName, "lvl=" + lvlGen, "tree=1", "lnk=1", "sub=" + sMore);
			} else if (iLink == constBueroTree) {
				sUrl = nxtURL("_tree_treegen.asp", DbName, "lvl=" + lvlGen, "tree=2", "lnk=2", "sub=" + sMore);
			} else if (iLink == constPrivatTree) {			
				if (parent.g_oAccount.PrivateTree + "x" != "undefinedx" 
						&& parent.g_oAccount.PrivateTree
						&& parent.g_oAccount.PrivateTree != "") {					
					kdview = "tree=" + parent.g_oAccount.PrivateTree;
					sUrl = nxtURL("_treegen_treegen.asp", DbName, "lvl=" + lvlGen, kdview, "lnk=3", "sub=" + sMore);
				} else {

					return 0;
				}
			}
			//alert ('Lade: ' + sUrl);
			parent.frames.lade.location.href = sUrl;
			//alert ('Lade: ' + parent.frames.lade.location.href);
			return 1;
		}
		return 0;
	}
	
	function AuswahlAusfuehren(oNode, Link) {		
		BackLink = "";
		// Darstellungseite aus Konten uebernemen
		var Darstellung = oNode.GetAttribut ("Darstellung");
		
		if (Darstellung && Darstellung != "") {
			var Id = oNode.NId;
			if (oNode.Baum != ""){
				if (Darstellung.indexOf("Gruppe")>0){
					//alert("Liste:" + Darstellung);
					parent.frames.contentsrc.location.href = nextURL(Darstellung,"Gid=" + Id, "tree=" + oNode.Baum);
					parent.frames.contentsrc.document.bgColor = "green";
				} else if (Darstellung.indexOf("InhaltProdukt")>0){
					//alert("detail:" + Darstellung);
					var aDarstellung = Darstellung.split(";");
					parent.frames.contentsrc.location.href = nextURL(aDarstellung[0], aDarstellung[1], aDarstellung[2]);
					parent.frames.contentsrc.document.bgColor="green";
				} else {
					//parent.frames.contentsrc.document.write("??" + Darstellung);
					parent.frames.contentsrc.location.href = nextURL(Darstellung);					
					
				}
			}
		} else {
			// alert('Keine Ausgabe für\ndie Ebene ' + lastgen + ' vorhanden.');
		}
	}

	var kStack = new Array ();
	var kStackTop = 0;
	var kDebug = 0;
	
	function KnotenSuchen (iNid, sSippe, Mapit) {
		var iUid=iNid;
		var oKnoten = 0;
		var oNext = 0;
		var oSippe = 0;
		if (kDebug) alert ('Suche ' + iNid + '-- ' + iUid);	
		if (Mapit) iUid=table[sSippe][iNid];
		kStackTop = 0;
		kStack[kStackTop++] = oRoot;
		if (kDebug) alert ('push Root');
		while (--kStackTop >= 0) {			
			oKnoten = kStack[kStackTop];
			if (kDebug) alert ('poped ' + oKnoten.Name + ' ' + oKnoten.Id);
			if (oKnoten.Id == iUid) {
				if (kDebug) alert ('Juhuu ' + oKnoten.Name  + ' ' + oKnoten.Id);
				return (oKnoten);				
			}
			oSippe = GetSippe(oKnoten.Sippen, sSippe);
			oNext = oSippe.Sohn;
			if (oNext)	{
				kStack[kStackTop++] = oNext;
				if (kDebug) alert ('push Sohn: ' + oNext.Name + ' ' + oKnoten.Id);
			}
			oNext = oSippe.Bruder;
			if (oNext)	{
				kStack[kStackTop++] = oNext;
				if (kDebug) alert ('push Bruder: ' + oNext.Name + ' ' + oKnoten.Id);
			}
		}
		if (kDebug) alert ('Fertig');
		return 0;
	}
	
	function GetNextTreeSippe (oNode, iLink) {
		var oSip = GetSippe (oNode.Sippen, iLink);	
		if (!oSip.Sohn) { // keine weitere auswahl moeglich
			var oSip = GetSippe (oNode.Sippen, iLink);	
		}
		return oSip;
	}
	
	function GetSippe (oSippe, sSippe) {
		while (oSippe && oSippe.Name != sSippe)
			oSippe = oSippe.NextLink;
		return oSippe;
	}

	function anknuepfen() {
		var args = anknuepfen.arguments;
		var sNodeId = args [args.length-1];
		sNodeId = sNodeId.slice(sNodeId.indexOf(":")+1);
		oSohn=0;
		oSohn = KnotenSuchen (sNodeId, iLink, 1);
		lastSohn = oSohn;
		return oSohn;
	}
	
	function findeHst(Hid) {
		lastgen = 0;
		iLink = constBueroTree;
		sHersteller = Hid;
		sHack = "x";
		sHack = aBereich[Hid];
		if (sHack=="Industrie"){
			oRoot.finde(indId);
		} else if (sHack=="Büro"){
			oRoot.finde(burId);
		} else {
			// sollte nicht passieren	
			alert ('aBereich [' + Hid + '] = ' + sHack);
		}
	}
	
	function auswahl(x){
		//alert("treeladen");
		tree (0);
		sHersteller="x";
		iAuswahlEinstellung = x;	
		for (var i = 0; i < aAusgewaehlt.length; ++i)	
			aAusgewaehlt[i] = 0; // Auswahl zuruecksetzen		
			if (parent.g_oAccount.Language == 'E') {
				iLink=2;				
				oRoot.finde(burId);
				iAuswahlEinstellung = 2;
			} else {
				iLink=1;
				oRoot.finde(_indId);
				iAuswahlEinstellung = 2;
			}
			
	}
	
	function tree (x){
		var DbName = "";
		DbName = "Db=" + parent.g_oSession.ShopDatenbank;		
		if (!x)	 { // naechsten ungeladenen Baum laden
			sStr=parent.frames.lade.location.href;
			sStr=sStr.slice(sStr.length-5,sStr.length)
			if (sStr=="lnk=1") {
				x = 2;
			 } else if (sStr=="lnk=2") {
				x = 3;				
			} else {
				return 0;
				//alle Trees geladen...
			}
		}

		parent.frames.lade.location.href = "about:blank";		
		if (x == 1) {
			parent.frames.lade.location.href = nxtURL("_treegen_treegen.asp", DbName, "lvl=2", "tree=1", "lnk=1");
		} else if (x==2) {
			//kdk alert ('Englischen Baum laden');
			parent.frames.lade.location.href = nxtURL("_treegen_treegen.asp", DbName, "lvl=2", "tree=2", "lnk=2");
		} else if (x==3) {
			if (parent.g_oAccount.PrivateTree!=""){
				kdview = "tree=" + parent.g_oAccount.PrivateTree;				
				parent.frames.lade.location.href = nxtURL("_treegen_treegen.asp", DbName, "lvl=2", kdview,"lnk=3");
			}
		}

	}

	//Erzeuge den Aufhänger des Trees - die Root...
	var oRoot = new Knoten (0, "Root","1","1");