window.addEvent('load',function(){
PNGFix();
});
window.addEvent('domready',function(){
if(Browser.Plugins.Flash.version>=9)
$('content-inner').setStyle('color','#fff');
var options ={
text : 'Wersja przeglądarki, której używasz jest przestarzała. Aby pobrać nową wersję przeglądarki kliknij tu: Firefox Internet Explorer',
url : '#',
img_folder : './img/'
};
if(Browser.Engine.gecko&&Browser.Engine.version<19){
// notifier.show();
new OldBrowserNotifier(options);
}
$$('.stats').each(function(el){
el.addEvent('click',function(){
var r=new Request({url:'http://www.buliba.pl/stat.php'});
r.send({
method:'post',
data:'id='+el.get('title')
})
});
});
$$('.blank').addEvent('click',function(e){
var e=new Event(e).stop();
window.open(this.href,'_blank');
return false;
});
$$('.wspolpraca').addEvent('click',function(e){
var e=new Event(e).stop();
pageTracker._trackPageview(this.get('rel'));
window.open(this.get('href'),'_blank');
return false;
});
$('content-games').getElement('div.info9 a').addEvent('click',function(e){
var ev=new Event(e).stop();
var el=$('content-games').getElement('div.info10');
if(el.getStyle('display')=='none')
el.setStyle('display','block');
else
el.setStyle('display','none');
});
//if((Browser.Plugins.Flash.version==10&&Browser.Plugins.Flash.build<=45)||Browser.Plugins.Flash.version==9){
if(Browser.Plugins.Flash.version>=9){
var bodysize=$(document.body).getSize();
$('tmp').setStyle('height',bodysize.y+40);
bodysize=$(document.body).getSize();
$('tmp').setStyles({'display':'none','height':20});
var maxwidth=bodysize.x;
var maxheight=bodysize.y-100;
var gh,gw,pad,navpad;
var fr=1000/520;
var ar=maxwidth/maxheight;
var reklama_gorna=new Swiff('http://www.buliba.pl/swf/reklamy/gorna_pl.swf',{id:'reklama_gorna_swf',width:'100%',height:'100%',container:$('reklama-gorna'),params:{'wMode':'transparent'},properties:{bgcolor:'#F9F8ED'}});
if(fr>ar){
maxwidth=bodysize.x;
ar=maxwidth/maxheight;
// $('reklamy').setStyle('margin-left',0);
}
else{
/* if(Browser.Engine.trident&&Browser.Engine.version==4)
$('reklamy').setStyle('margin-left',10);
else
$('reklamy').setStyle('margin-left',20);
*/
}
var sciezka='/swf/child_pl.swf';
if(fr<=ar){
gh=maxheight;
gw=maxheight*fr;
if(gw*1.14<=maxwidth){
gw*=1.14;
}
else
gw=maxwidth;
gw=Math.floor(gw)-1;
$('reklama-gorna').setStyle('width',gw-910);
$('content').setStyle('width',maxwidth);
var ml=Math.max(0,Math.floor((maxwidth-gw)/2));
$('content-inner').setStyles({'width':gw,'height':gh,'left':ml});
$('content-games').setStyles({'top':gh,'width':gw-22,'left':ml});
$('reklamy').setStyles({'width':gw,'left':ml});
if(Browser.Engine.trident&&Browser.Engine.version==4){
var gra=new Swiff(sciezka,{id:'gra',width:gw,height:gh,container:$('content-inner'),params:{'wMode':'window','salign':'T'},properties:{'salign':'T','scale':'exactfit',bgcolor:'#d4d4d4','FlashVars':'menu=&katalog=gry-zrecznosciowe&gra=zlap-mnie'},vars:{'katalog':'gry-zrecznosciowe','menu':'','gra':'zlap-mnie'}});
}
else{
var gra=new Swiff(sciezka,{id:'gra',width:'100%',height:'100%',container:$('content-inner'),params:{'wMode':'window','salign':'T'},properties:{'salign':'T','scale':'exactfit',bgcolor:'#d4d4d4','FlashVars':'menu=&katalog=gry-zrecznosciowe&gra=zlap-mnie'},vars:{'katalog':'gry-zrecznosciowe','menu':'','gra':'zlap-mnie'}});
}
$('content-games').setStyle('display','block');
}else{
gw=maxwidth;
gh=maxheight;
$('content').setStyle('width',maxwidth);
$('reklama-gorna').setStyle('width',gw-910);
if(Browser.Engine.trident&&Browser.Engine.version==4)
var gra=new Swiff(sciezka,{id:'gra',width:gw,height:gh,container:$('content-inner'),params:{'wMode':'window','salign':'T'},properties:{'salign':'T','scale':'exactfit',bgcolor:'#d4d4d4','FlashVars':'menu=&katalog=gry-zrecznosciowe&gra=zlap-mnie'},vars:{'katalog':'gry-zrecznosciowe','menu':'','gra':'zlap-mnie'}});
else
var gra=new Swiff(sciezka,{id:'gra',width:'100%',height:'100%',container:$('content-inner'),params:{'wMode':'window','salign':'T'},properties:{'salign':'T','scale':'exactfit',bgcolor:'#d4d4d4','FlashVars':'menu=&katalog=gry-zrecznosciowe&gra=zlap-mnie'},vars:{'katalog':'gry-zrecznosciowe','menu':'','gra':'zlap-mnie'}});
$('reklamy').setStyles({'width':gw,'left':ml});
$('content-inner').setStyles({'width':gw,'height':gh,'left':0});
$('content-games').setStyles({'top':gh,'width':'100%'});
$('content-games').setStyle('display','block');
}
}
/*
else{
$('content-flash').setStyle('display','block');
$('content-inner').setStyle('color','#fff');
if(Browser.Plugins.Flash.version>=10&&Browser.Plugins.Flash.build>45){
$('content-flash').getElement('.wrong').setStyle('display','block');
$('content-flash').getElement('.old').setStyle('display','none');
}
if(Browser.Plugins.Flash.version<9){
$('content-flash').getElement('.old').setStyle('display','block');
$('content-flash').getElement('.wrong').setStyle('display','none');
}
}
*/
var img=new Element('img');
var path="http://www.buliba.pl/img/lewa_logo_pl.gif";
var color="#ec961b";
var url="http://www.buliba.pl";
var title="Buliba.pl - serwis gier dla dzieci.";
$('fav').addEvent('click',function(){
if(!this.retrieve('favorites')){
window.location.href="http://www.buliba.pl";
}
else{
if(window.sidebar){
window.sidebar.addPanel(title,url,"");
}else if(window.external){
window.external.AddFavorite(url,title);
}
else if(window.opera&&window.print){
return true;
}
}
});
img.setProperties({'src':path,'width':160,'height':60,'alt':$('fav').getFirst().get('alt')});
$('fav').empty().setStyles({'background-color':color});
img.inject($('fav'),'inside');
if(Browser.Engine.trident||Browser.Engine.gecko){
$('fav').getElement('img').setStyle('cursor','pointer');
zmienUlubione.periodical(10000);
}
});
window.addEvent('resize',function(){
if($('gra')){
var bodysize=$(document.body).getSize();
$('tmp').setStyles({'display':'block','height':bodysize.y+20});
bodysize=$(document.body).getSize();
$('tmp').setStyles({'display':'none','height':20});
var maxwidth=bodysize.x;
var maxheight=bodysize.y-100;
var gh,gw,pad,navpad;
var fr=1000/520;
var ar=maxwidth/maxheight;
if(fr>ar){
maxwidth=bodysize.x;
ar=maxwidth/maxheight;
// $('reklamy').setStyle('margin-left',0);
}
else{
/* if(Browser.Engine.trident&&Browser.Engine.version==4)
$('reklamy').setStyle('margin-left',10);
else
$('reklamy').setStyle('margin-left',20);
*/ }
if(fr<=ar){
gh=maxheight;
gw=Math.floor(maxheight*fr);
if(gw*1.14<=maxwidth){
gw*=1.14;
}
else
gw=maxwidth;
gw=Math.floor(gw)-1;
$('reklama-gorna').setStyle('width',gw-910);
$('content').setStyle('width',maxwidth);
var ml=Math.max(0,Math.floor((maxwidth-gw)/2));
$('content-inner').setStyles({'width':gw,'height':gh,'left':ml});
$('content-games').setStyles({'top':gh,'width':gw-22,'left':ml});
$('reklamy').setStyles({'width':gw,'left':ml});
}else{
gw=maxwidth;
gh=maxheight;
$('reklama-gorna').setStyle('width',gw-910);
$('content').setStyle('width',maxwidth);
$('content-inner').setStyles({'width':gw,'height':gh,'left':0});
$('content-games').setStyles({'top':gh,'width':'100%'});
$('reklamy').setStyles({'width':gw,'left':ml});
}
}
});
function zmienUlubione(){
var path="http://www.buliba.pl/img/lewa_logo_pl.gif";
var color="#ec961b";
var r;
r=$time()%1;
if(r==0){
path="http://www.buliba.pl/img/lewa_ulubione_pl.gif";
color="#8d921d";
$('fav').store('favorites',true);
}
else{
$('fav').store('favorites',false);
}
$('fav').getElement('img').setProperties({'src':path,'alt':'Gry dla dzieci'});
$('fav').setStyle('background-color',color);
}