var SuperClassZoekenController=Class.create({initialize:function(id){this.previousActive=0;this.id=1;this.checkUrl();this.start();this.buildSearchMenu();this.initSearch(this.id);},start:function(){var func=this.populate.bind(this);var obj={};obj.newType='ZoekenController';obj.newMethod='loadZoek';if(this.ledenCheck){obj.backLeden=1;}if(this.groepenCheck){obj.backGroepen=1;}ARRM.jsonRequest(obj,func);},populate:function(obj){if(obj.backLedenHop==1){$('voornaam').value=obj.backLedenVoornaam;$('achternaam').value=obj.backLedenAchternaam;$('woonplaats').value=obj.backLedenWoonplaats;}if(obj.backGroepenHop==1){$('groepsnaam').value=obj.backGroepenNaam;}this.buildNieuweGroepen(obj.groepen);this.buildNieuweLeden(obj.gebruiker);},buildNieuweGroepen:function(obj){$('wrapGroepen').update();for(var i=0,len=obj.groepen.length;i<len;++i){var FI=new FotoItem(obj.groepen[i],true,false);$('wrapGroepen').insert(FI.div);}var spacer=new Element("div").addClassName("spacer");$('wrapGroepen').insert(spacer);var a=new Element("a",{href:"/zoeken/groepen/",title:"zoeken naar nieuwe groepen"}).update("zoek groepen");$('wrapGroepen').insert(a);},buildNieuweLeden:function(obj){$('wrapLeden').update();for(var i=0,len=obj.gebruiker.length;i<len;++i){var FI=new FotoItem(obj.gebruiker[i],true,false);$('wrapLeden').insert(FI.div);}var spacer=new Element("div").addClassName("spacer");$('wrapLeden').insert(spacer);var a=new Element("a",{href:"/zoeken/leden/",title:"zoeken naar nieuwe leden"}).update("zoek leden");$('wrapLeden').insert(a);},checkUrl:function(){this.matchLedenUrl=/leden/.test(window.location);this.matchGroepenUrL=/groepen/.test(window.location);this.matchLeden=/#Leden/.test(window.location);this.matchGroepen=/#Groepen/.test(window.location);this.matchBericht=/#zoek/.test(window.location);if(this.matchBericht){}else{if(this.matchLeden||this.matchLedenUrl){if(this.matchLeden){this.ledenCheck=true;this.groepenCheck=false;}this.lastDiv="zoekArea";this.id=2;}if(this.matchGroepen||this.matchGroepenUrL){if(this.matchGroepen){this.groepenCheck=true;this.ledenCheck=false;}this.lastDiv="zoekArea";this.id=3;}}},buildSearchMenu:function(){this.searchMenu=$('searchMenu');var func=this.initSearch.bind(this,1);var a=new Element("a",{href:"javascript:void(0);",title:"Zoek op Items"}).update("items").observe('click',func,false);this.searchMenu_1=new Element("li").update("&gt; ").insert(a);func=this.initSearch.bind(this,2);a=new Element("a",{href:"javascript:void(0);",title:"Zoek op Leden"}).update("leden").observe('click',func,false);this.searchMenu_2=new Element("li").update("&gt; ").insert(a);func=this.initSearch.bind(this,3);a=new Element("a",{href:"javascript:void(0);",title:"Zoek op Groepen"}).update("groepen").observe('click',func,false);this.searchMenu_3=new Element("li").update("&gt; ").insert(a);this.searchMenu.update(this.searchMenu_1);this.searchMenu.insert(this.searchMenu_2);this.searchMenu.insert(this.searchMenu_3);},initSearch:function(id){this.changeStyle(id);this.setSearch(id);},changeStyle:function(id){switch(id){case 1:this.searchMenu_1.addClassName("active");break;case 2:this.searchMenu_2.addClassName("active");break;case 3:this.searchMenu_3.addClassName("active");break;}if(this.previousActive==id){}else{if(this.previousActive!==0){switch(this.previousActive){case 1:this.searchMenu_1.removeClassName("active");break;case 2:this.searchMenu_2.removeClassName("active");break;case 3:this.searchMenu_3.removeClassName("active");break;}}}this.previousActive=id;},setSearch:function(id){switch(id){case 1:ZC=new ZoekenController();this.showHideTagCloud(2);this.showHideContent(1,'zoekArea');$('trefwoord').focus();break;case 2:if(this.ledenCheck){ZL=new ZoekenLedenController(1);this.ledenCheck=false;}else{ZL=new ZoekenLedenController();}this.showHideTagCloud(1);this.showHideContent(2,"zoekAreaLeden");$('voornaam').focus();break;case 3:if(this.groepenCheck){ZL=new ZoekenGroepenController(1);this.groepenCheck=false;}else{ZL=new ZoekenGroepenController();}this.showHideTagCloud(1);this.showHideContent(3,"zoekAreaGroepen");$('groepsnaam').focus();break;}},showHideTagCloud:function(action){switch(action){case 1:if(this.status!=1){$('PopTag').hide();}this.status=1;break;case 2:if(this.status==1){$('PopTag').show();}this.status=2;break;}},showHideContent:function(id,el){if($(el)){$(el).show();}if(this.lastDiv){if(this.lastDiv!=el){$(this.lastDiv).hide();}}this.lastDiv=el;}});
