var sporthierarchie= { children:[ { id:0, name:"Sporthierarchie", typ:1, children:[ {id:599,name:"Sportmix",typ:1,bgcolor:"#FFFFFF",children:[{id:605,name:"Klettern",typ:1,bgcolor:"#FFFFFF",children:[]},{id:606,name:"Schwimmen",typ:1,bgcolor:"#FFFFFF",children:[]},{id:594,name:"Sportschießen",typ:1,bgcolor:"#FFFFFF",children:[]}]},{id:600,name:"Fitbasics",typ:1,bgcolor:"#FFFFFF",children:[{id:624,name:"Relax und Präventiv",typ:1,bgcolor:"#FFFFFF",children:[]},{id:623,name:"Tanzen",typ:1,bgcolor:"#FFFFFF",children:[]}]},{id:601,name:"Ball- & Rückschlagspiele",typ:1,bgcolor:"#FFFFFF",children:[{id:609,name:"Beachvolleyball",typ:1,bgcolor:"#FFFFFF",children:[]},{id:604,name:"Hallenfußball",typ:1,bgcolor:"#FFFFFF",children:[]},{id:611,name:"Tennis",typ:1,bgcolor:"#FFFFFF",children:[]},{id:597,name:"Volleyball",typ:1,bgcolor:"#FFFFFF",children:[]}]},{id:603,name:"Outdoor, Camps & Specials",typ:1,bgcolor:"#FFFFFF",children:[{id:595,name:"Alpinkurse",typ:1,bgcolor:"#FFFFFF",children:[]},{id:617,name:"Fitness-Studio",typ:1,bgcolor:"#FFFFFF",children:[]},{id:629,name:"Golf",typ:1,bgcolor:"#FFFFFF",children:[]},{id:616,name:"Kitesurfen",typ:1,bgcolor:"#FFFFFF",children:[]},{id:621,name:"Mountainbike",typ:1,bgcolor:"#FFFFFF",children:[]},{id:622,name:"Segeln",typ:1,bgcolor:"#FFFFFF",children:[]},{id:593,name:"Sommerspecial",typ:1,bgcolor:"#FFFFFF",children:[]},{id:614,name:"Workshops",typ:1,bgcolor:"#FFFFFF",children:[]}]},{id:592,name:"Online",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(); } }