function addLoadEvent(func) { 
  var oldonload = window.onload; 
  if (typeof window.onload != 'function') { 
    window.onload = func; 
  } else { 
    window.onload = function() { 
      if (oldonload) { 
        oldonload(); 
      } 
      func(); 
    } 
  } 
} 


function blackout4hungary() {
  var fileref=document.createElement("link");
  fileref.setAttribute("rel", "stylesheet");
  fileref.setAttribute("type", "text/css");
  fileref.setAttribute("href", "http://blackout4hungary.net/blackout.css");
  document.getElementsByTagName("head")[0].appendChild(fileref);

  var div1 = document.createElement("div");
  div1.setAttribute("id", "blackoutforhungary");
  var h1 = document.createElement('h1');
  h1.innerHTML = "Blackout for Hungary";
  div1.appendChild(h1);
  var div2 = document.createElement('div');
  div1.appendChild(div2);
  var p = document.createElement('p');
  p.style.textAlign = "justify";
  p.innerHTML = "On the 21st of December the party holding the majority of the Hungarian parliament voted in favor of a new media law that is a collection of some of the most oppressive and undemocratic laws from all over Europe and with some worrying changes.";
  div2.appendChild(p);
  var p = document.createElement('p');
  p.style.textAlign = "justify";
  p.innerHTML = "To show  our concern for fundamental rights and free speech we black out our online presence on the 5th January 2011 for at least 24 hours.";
  div2.appendChild(p);
  var p = document.createElement('p');
  p.style.textAlign = "center";
  var a = document.createElement('a');
  a.setAttribute("href", "http://blackout4hungary.net");
  a.setAttribute("target", "_blank");
  a.innerHTML = "blackout4hungary.net";
  p.appendChild(a);
  div2.appendChild(p);
  var a = document.createElement('a');
  a.setAttribute("href", "javascript:void(0)");
  a.innerHTML = "continue to the site &raquo;";
  if( a.attachEvent ){
    a.attachEvent('onclick', removeBlackout4hungary);
  } else {
    a.setAttribute('onclick', 'removeBlackout4hungary();');
  };
  div1.appendChild(a);
  
  document.getElementsByTagName("body")[0].appendChild(div1);
}

function removeBlackout4hungary() {
  var bh = document.getElementById('blackoutforhungary');
  bh.parentNode.removeChild(bh);
};

//addLoadEvent(blackout4hungary);
