var BrandBox=Class.create({initialize:function(startBig,options){if($("brandbox")&&swfloader){$("brandbox").observe("swfloader:loaded-getflashplayer",this.handleNoFlash.bind(this));this._createElements();var startBig=this._readCookie(startBig);this["_show"+(startBig?"Big":"Small")]();this._loadFlash(options);this._observeButtons();}},_readCookie:function(startBig){this._wjcookie=new WJCookie();return startBig;if(typeof(this._wjcookie.get("brandboxclosed"))!="undefined"){startBig=(this._wjcookie.get("brandboxclosed")?false:true);}
return startBig;},_loadFlash:function(options){swfloader.load(this._bigbox,"bigbrandboxObject","/var/flash/headercontainer.swf","100%","100%","transparent",options);swfloader.load(this._smallbox,"smallbrandboxObject","/var/flash/headersmall.swf","100%","100%","transparent",options);},_createElements:function(){var container=$("brandbox");var filterchoice=container.down("div.filterchoice");if(typeof(filterchoice)=="undefined"){filterchoice=null;}
this._bigbox=new Element("div",{"class":"bigbrandbox"});container.insertBefore(this._bigbox,filterchoice);this._smallbox=new Element("div",{"class":"smallbrandbox"});container.insertBefore(this._smallbox,filterchoice);this._openbutton=new Element("a",{"class":"openbrandbox",href:"#"}).update("Uitklappen");container.insertBefore(this._openbutton,filterchoice);this._closebutton=new Element("a",{"class":"closebrandbox",href:"#"}).update("Inklappen");container.insertBefore(this._closebutton,filterchoice);},_showSmall:function(){$("brandbox").removeClassName("bigbrandboxvisible").addClassName("smallbrandboxvisible");this._bigbox.hide();this._closebutton.hide();},_showBig:function(){$("brandbox").removeClassName("smallbrandboxvisible").addClassName("bigbrandboxvisible");this._smallbox.hide();this._openbutton.hide();},_observeButtons:function(){this._openbutton.observe("click",this.toBig.bindAsEventListener(this));this._closebutton.observe("click",this.toSmall.bindAsEventListener(this));},toSmall:function(){Effect.BlindUp(this._bigbox,{duration:1,afterFinishInternal:function(effect){effect.element.hide();}});Effect.Appear.bind(Effect,this._smallbox).delay(1);Effect.Fade($("brandbox").down(".showgameslist"),{duration:0.75});Effect.Fade(this._closebutton,{duration:1});Effect.Appear.bind(Effect,this._openbutton).delay(1);this._wjcookie.set("brandboxclosed",true);},toBig:function(){Effect.Fade(this._smallbox,{duration:1});Effect.BlindDown.bind(Effect,this._bigbox,{afterSetup:function(effect){effect.element.show();},afterFinishInternal:Prototype.emptyFunction}).delay(1);Effect.Fade(this._openbutton,{duration:1});Effect.Appear.bind(Effect,$("brandbox").down(".showgameslist")).delay(1.5);Effect.Appear.bind(Effect,this._closebutton).delay(1);},handleNoFlash:function(){this._hideButtons();var top={top:"1em"};$("brandbox").setStyle(top);$("brandbox").setStyle({minHeight:"7em"});this._bigbox.setStyle(top);this._smallbox.setStyle(top);},_hideButtons:function(){this._openbutton.hide();this._closebutton.hide();}});
