var sporthierarchie= { children:[ { id:0, name:"Sporthierarchie", typ:1, children:[ {id:337,name:"Semester-/Saisonkarten",typ:1,bgcolor:"#FFFFFF",children:[]},{id:336,name:"Online",typ:1,bgcolor:"#FFFFFF",children:[]},{id:352,name:"Hybrid ",typ:1,bgcolor:"#FFFFFF",children:[]},{id:340,name:"Fitness - Basics",typ:1,bgcolor:"#FFFFFF",children:[]},{id:341,name:"Vital / Move",typ:1,bgcolor:"#FFFFFF",children:[]},{id:342,name:"Ballspiele",typ:1,bgcolor:"#FFFFFF",children:[]},{id:343,name:"Junior Club",typ:1,bgcolor:"#FFFFFF",children:[]},{id:344,name:"Klettersport",typ:1,bgcolor:"#FFFFFF",children:[]},{id:347,name:"Outdoor",typ:1,bgcolor:"#FFFFFF",children:[]},{id:345,name:"Sonstige Kurse",typ:1,bgcolor:"#FFFFFF",children:[]},{id:338,name:"Workshop",typ:1,bgcolor:"#FFFFFF",children:[]},{id:346,name:"Camps",typ:1,bgcolor:"#FFFFFF",children:[]},{id:334,name:"TryUSI",typ:1,bgcolor:"#FFFFFF",children:[]},{id:354,name:"Semesterferienkurse",typ:1,bgcolor:"#FFFFFF",children:[]},{id:350,name:"Sommerkurse",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(); } }