function noAd_banner_top(ad_number) {
    $('ad-banner_top').style.display = 'none';
}

function noAd_banner(ad_number) {
  topad_restack();
}

function noAd_netboard_frontpage(ad_number) {
    netboard_restack();
}

function noAd_superboard(ad_number) {
  $('superboard-container').style.display = 'none';
}

function noAd_netboard_article(ad_number) {
  $('netboard_placeholder').hide();
}

// Banner restack - pos 4-6
function topad_restack() {

  var newWidth = 313;
  var newHeight = newWidth/16*9
  var startpos = 4;

  $('topad').hide();

  for (i=startpos; i<=startpos+2; i++) {

    el = $('posisjon'+i);
    el.setStyle({'width':newWidth+'px', 'marginLeft':'0px'})

    $('topad_restack_fp').appendChild($('posisjon'+i));

    src = el.getElementsByTagName('img')[0].src;
    newsrc = src + '&w=' + newWidth + '&h=' + newHeight;
    //console.log(newsrc)
    el.getElementsByTagName('img')[0].src = newsrc;
    el.getElementsByTagName('img')[0].width = newWidth;
    el.getElementsByTagName('img')[0].height = newHeight;
  }
  $('posisjon5').setStyle({'marginLeft':'10px'})
}

// Netboard restack - pos 8-11
function netboard_restack() {

  var newWidth = 475;
  var newHeight = newWidth/16*9
  var startpos = 8;

  $('netboard_580x400_fp').hide();

  for (i=startpos; i<=startpos+3; i++) {
    el = $('posisjon'+i);
    el.style.width = newWidth + 'px';
    el.style.marginLeft = '0px';

    if (i==(startpos+2)) $('netboard_restack_fp').innerHTML += '<div style="clear:both"></div>'; // Could be done with a clear both on the 3rd element.
    $('netboard_restack_fp').appendChild($('posisjon'+i));
    tmp = (i==startpos || i==(startpos+2)) ? 'left' : 'right';
    el.setStyle({'float': tmp});

    //src = el.getElementsByTagName('img')[0].src;
    //newsrc = src + '&w=' + newWidth + '&h=' + newHeight;
    newsrc = netboard_replacement_images[i];
    el.getElementsByTagName('img')[0].src = newsrc;
    el.getElementsByTagName('img')[0].width = newWidth;
    el.getElementsByTagName('img')[0].height = newHeight;
  }
  $('posisjon9').style.marginTop = '0px';
  $('posisjon10').removeClassName('biggerFont');

}

Event.observe(document, "dom:loaded", function() {

  if ($("area-overlay")) {
    var hasCreative = ($("area-overlay").getHeight() >= 100);
    if (!hasCreative) {
      // Do a doublecheck to make sure there is no creative
      hasCreative = $("area-overlay").down('object') && true || false;
    }
    if (!hasCreative) {
      $("area-overlay").remove();
    } else {
      setTimeout(function() {
        Lightbox.init();
        Lightbox.showBoxByID($("area-overlay"), 840, 650);
        setTimeout(function () { Lightbox.hideBox(); }, 3000);
      }, 1500);
    }
  }

if ($('eniroAdsTop').getHeight() > 10) {
  newPlaceholderHeight = 
    $('ad-netboard_article-1').cumulativeOffset()[1] - 
    $('netboard_placeholder').cumulativeOffset()[1] + 430; 
  $('netboard_placeholder').setStyle({height: newPlaceholderHeight +'px'});            
  console.log(newPlaceholderHeight);
}  
  
});

