var ObjPopupId = '';
function obj(Id) { if(Id!='' && document.getElementById(Id)) return document.getElementById(Id); else return false; }
function objStyle(Id) { if(Id!='' && document.getElementById(Id)) return document.getElementById(Id).style; else return false; }
function objHide(Id) { if(Id!='' && document.getElementById(Id)) document.getElementById(Id).style.display='none'; }
function objShow(Id) { if(Id!='' && document.getElementById(Id)) document.getElementById(Id).style.display='block'; }
function isObj(Id) { if(Id!='' && document.getElementById(Id)) return true; else return false; }
function isClass(Class) { if(Class!='' && document.getElementsByClassName(Class).length>0) return true; else return false; }
function bgChange(Id, ImgSrc) { objStyle(Id).backgroundImage = "url("+ImgSrc+")"; }
function objPopup(Id){
  objHide(ObjPopupId);
  if( objStyle(Id).display=='block' ) objStyle(Id).display='none';
  else  objStyle(Id).display='block';
  ObjPopupId = Id;
}

/*********************/
var currentElement = 0; var nextElement = 1;
var bannerWidth = 0; var bannerHeight = 0;
var aElements = new Array();

function img_fade()
{
  if(currentElement>=aElements.length) currentElement=0;
  if(nextElement>=aElements.length) nextElement=0;
  var fx1 = new Fx.Morph(aElements[currentElement], { fps:25, duration: 1500, transition: Fx.Transitions.Sine.easeOut});
  var fx2 = new Fx.Morph(aElements[nextElement], { fps:25, duration: 1500, transition: Fx.Transitions.Sine.easeIn});
  fx1.start({
    'opacity': [1, 0],
    'left': [ (bannerWidth-aElements[currentElement].getSize().x)/2, 300 ]
  });
  fx2.start({
    'opacity': [0, 1],
    'left': [ -200, (bannerWidth-aElements[nextElement].getSize().x)/2 ]
  });
  currentElement++;  nextElement++;
  setTimeout("img_fade()", 4000);
}



window.addEvent('domready', function(){
  $$('.btn').each(function(el){
    var fxBtn = new Fx.Morph(el, { wait:false, duration: 1000, transition: Fx.Transitions.Back.easeOut });
    el.addEvents({
      'mouseenter': function(){ fxBtn.start({ 'opacity':[1,0.75] }); },
      'mouseleave': function(){ fxBtn.start({ 'opacity':[0.75,1] }); }
    });
  });
  if( isObj('mod_dol_przewoz') )
  {
    bannerWidth = $('mod_dol_przewoz').getSize().x; bannerHeight = $('mod_dol_przewoz').getSize().y;
    $$('#mod_dol_przewoz img').each(function(el,i){
      el.setStyles({ 'opacity':0, 'display': 'block', 'height':'auto'  });
      el.setStyle('top', 5);
      aElements[i] = el;
    });
    img_fade();
  }
});

