// <![CDATA[ 
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
    if (oldonload) {
      oldonload();
    }
    func();
    }
  }
}
addLoadEvent( function () {
  // creo un div contenitore
  var cont = document.createElement('div');
  cont.id = "frameBanner";
  // Creo un iframe (ma potrebbe essere un immagine)
  var iframe = document.createElement('iframe');
  // La pagina da aprire nell'iframe, meglio se con path assoluto
  iframe.src = 'http://adv.joomlafree.it/spot1.html';
  // Il pulsante di chiusura dell'iframe
  var close = document.createElement('div');
  // Lo styling dell'iframe
  iframe.style.display = 'block';
  iframe.style.border = '0px';
  iframe.style.width = '468px';
  iframe.style.height = '60px';
  iframe.style.margin = '0px';
  iframe.style.padding = '0px';
  // Lo styling del container
  cont.style.background = '#0099ff';
  cont.style.width = '468px';
  cont.style.height = '60px';
  cont.style.position = 'fixed';
  cont.style.margin = '0px';
  cont.style.padding = '0px';
  cont.style.bottom = '15px';
  cont.style.right = '15px';
  // Lo style del closer
  close.onclick = function () {
    var obj = this.parentNode;
    obj.parentNode.removeChild(obj);
  }
  close.style.background = 'transparent url(http://adv.joomlafree.it/close.png) no-repeat center center';
  close.style.width = '14px';
  close.style.height = '14px';
  close.style.position = 'fixed';
  close.style.margin = '0px';
  close.style.padding = '0px';
  close.style.bottom = '80px';
  close.style.right = '14px';
  
  /* IE6 fix */
/*
  if (close.style.setExpression) {
    // Correggo l'errata interpretazione del box model
    close.style.width = '18px';
    close.style.height = '18px';
    close.style.bottom = '0px';
    close.style.right = '0px';
    // Correggo la posizione fixed
    close.style.position = 'absolute';
    close.style.setExpression('top', "(document.documentElement ¦¦ document.body).scrollTop +'px'");
    close.style.setExpression('left', "(document.documentElement ¦¦ document.body).scrollLeft +'px'");
    cont.style.position = 'absolute';
    cont.style.setExpression('top', "(document.documentElement ¦¦ document.body).scrollTop +'px'");
    cont.style.setExpression('left', "(document.documentElement ¦¦ document.body).scrollLeft +'px'");
  }
*/
  // Posiziono all'iterno del primo div l'iframe (o immagine)
  cont.appendChild(iframe);
  // Metto il pulsante di chiusura
  cont.appendChild(close);
  
  if(this.parent == this) {
    var banner = document.getElementById('joomla-adv');
    if(banner == null) {
      document.body.appendChild(cont);
    } else {
      banner.style.display = 'block';
    }
  }
});
// ]]>
