var sporthierarchie= { children:[ { id:0, name:"Sporthierarchie", typ:1, children:[ {id:314,name:"Semester-/Saisonkarten",typ:1,bgcolor:"#FFFFFF",children:[]},{id:313,name:"Online",typ:1,bgcolor:"#FFFFFF",children:[]},{id:329,name:"Hybrid ",typ:1,bgcolor:"#FFFFFF",children:[]},{id:317,name:"Fitness - Basics",typ:1,bgcolor:"#FFFFFF",children:[]},{id:318,name:"Vital / Move",typ:1,bgcolor:"#FFFFFF",children:[]},{id:319,name:"Ballspiele",typ:1,bgcolor:"#FFFFFF",children:[]},{id:320,name:"Junior Club",typ:1,bgcolor:"#FFFFFF",children:[]},{id:321,name:"Klettersport",typ:1,bgcolor:"#FFFFFF",children:[]},{id:324,name:"Outdoor",typ:1,bgcolor:"#FFFFFF",children:[]},{id:322,name:"Sonstige Kurse",typ:1,bgcolor:"#FFFFFF",children:[]},{id:315,name:"Workshop",typ:1,bgcolor:"#FFFFFF",children:[]},{id:312,name:"UF Bewegung und Sport: Vorbereitungsworkshop",typ:1,bgcolor:"#FFFFFF",children:[]},{id:323,name:"Camps",typ:1,bgcolor:"#FFFFFF",children:[]},{id:332,name:"TryUSI",typ:1,bgcolor:"#FFFFFF",children:[]},{id:333,name:"Semesterferienkurse",typ:1,bgcolor:"#FFFFFF",children:[]}]}]} function sphLevel(previousLevel,root) { this.previousLevel=previousLevel; this.root=root; var el=document.getElementById("uonSportarten"); var newEl=document.createElement("div"); el.appendChild(newEl); var select=document.createElement("select"); select.name="sp_id_in"; newEl.appendChild(select); for (var i=-1;i0) text=text+" >"; opt.text=text; opt.value=child.id; opt.style.backgroundColor=child.bgcolor; select.options.add(opt); } var that=this; var onchange=function() { that.expand(that.select.options[that.select.selectedIndex].value); } if (window.addEventListener) { select.addEventListener("change",onchange,false); } else { select.attachEvent("onchange",onchange); } this.select=select; this.newEl=newEl; } sphLevel.prototype={ expand:function(id) { if (this.nextLevel) this.collapse(); var next=null; for (var i=0;i0) { this.nextLevel=new sphLevel(this,next); } this.select.blur(); return this.nextLevel; }, collapse:function() { this.nextLevel.remove(); this.nextLevel=null; }, remove:function() { this.newEl.parentNode.removeChild(this.newEl); if (this.nextLevel) this.nextLevel.remove(); } }