// javascript by posttoast, 2009 (http://www.posttoast.nl)

function initSlideshow(){
  if ($('slideshow')){
    var slideshow = new slideShow({
      slideshow_id: 'slideshow',
      duration: 4000,
      slidePrefix: 'slide_'
    });
  }
}

function initBanner(){
  if ($('flashbanner-container') && $('flashbanner')){
    var banner = $('flashbanner').getProperty('href');
    new Swiff(banner, {
      width:  120,
      height: 450,
      container: $('flashbanner-container')
    });
  }
}

var initCountdown = function(){
  if ($('countdown')){
    new Swiff('_swf/countdown.swf', {
      width:  '142',
      height: '72',
      container: $('countdown'),
      params: {
        wmode: 'transparent'
      }
    });
  }
};

var setupYouTubeMovies = function(){
  $$('div.youtube-container').each(function(el){
    youtubeUrl = el.getFirst('a').getAttribute('href');

    new Swiff(youtubeUrl, {
      width: 425,
      height: 276,
      container: el,
      params: {
        wmode: 'transparent',
        allowFullScreen: true
      }
    });
  });
};

function initAudioPlayerPopup(){
  if (Cookie.read('audioplayer') != '1') {
    
    var myPopup = new Browser.Popup('audioplayer.html',{
      width: 320,
      height: 205,
      resizeable: 0
    });
  }
}

function initAudioPlayerPopupButton(){
  $('audioplayer-button').getFirst('a').addEvent('click', function(el){
    if (Cookie.read('isplaying') != '1') {
      var myPopup = new Browser.Popup('audioplayer.html',{
        width: 320,
        height: 205,
        resizeable: 0
      });
    }
    el.stop();
  });
}

// Load ShadowBox
Shadowbox.init({
  language: "nl",
  players: ["img"]
});

window.addEvent('domready', function(){
	initSlideshow();
  initBanner();
  initCountdown();
  //initAudioPlayerPopup();
  //initAudioPlayerPopupButton();
  setupYouTubeMovies();
});