window.addEvent('domready', function() {
  // CSS3 hack for IE6 and IE7
  if (Browser.Engine.trident4) $$('div.AspNet-Menu-Horizontal li:first-child').setStyle('border-left','none');
  if (Browser.Engine.trident) $$('div.AspNet-Menu-Horizontal ul ul').setStyle('opacity',0.7);

  // replace all rel=external links with target=_blank
  $$('a[rel=external]').setProperty('target', '_blank');
  // replace all rel=mediaitem links (media related to page) with target=blank
  $$('a[rel=mediaitem]').setProperty('target', '_blank');
  
  if(location.href.test('delangevanderplas') || location.href.test('lp.online.local')) {
    var imgs = [
    '/animatie/foto.jpg',
    '/animatie/foto1.jpg',
    '/animatie/foto2.jpg',
    '/animatie/foto3.jpg',
    '/animatie/foto4.jpg',
    '/animatie/foto5.jpg',
    '/animatie/foto6.jpg',
    '/animatie/foto7.jpg',
    '/animatie/foto8.jpg',
    '/animatie/foto9.jpg',
    '/animatie/foto10.jpg',
    '/animatie/foto11.jpg',
    '/animatie/foto12.jpg',
    '/animatie/foto13.jpg',
    '/animatie/foto14.jpg'
    ];
    var allImages = new Asset.images(imgs,{onComplete:function() {
      allImages.each(function(el) {
        el.inject($('aside'));
      });
      var mySlideShow = new mooSimpleSlide(allImages,{period:3000});
      mySlideShow.displayImage();
    }});
  }
  
  // Images hack
  CheckForImages();
  
  if($('marquee')) var marquee = new mooquee($('marquee'), {direction:'left',marHeight:16});
});

function CheckForImages() {
  for(var i = 0; i < $$('.MediaImage').length; i++) {
    var currentBlock = $$('.MediaImage')[i];
    if(i == 0) {
      currentBlock.setProperty('src',currentBlock.getProperty('src').replace('w=120&h=120','w=250&h=250'));
    }
    
    if(i> 0 && i < 7) {
      currentBlock.setStyle('vertical-align','top');
    } else if(i > 0) {
      currentBlock.setStyle('display','none');
    }
  }
}
