function showPopup(){
  document.getElementById('popup').style.display='block';
  document.getElementById('popup').style.left='0px';
  document.getElementById('popup').style.top='0px';
  document.getElementById('box').style.left='320px';
  document.getElementById('box').style.top='310px';
  }
function hidePopup(){
  document.getElementById('popup').style.display='none';}
function addEvent(){
  var hide=document.getElementById('hide');
  if(window.addEventListener){
    hide.addEventListener('click',hidePopup,false);
    return true;}
  else{
    hide.attachEvent('onclick',hidePopup);
    return true;}}

function dodajDoUlubionych() {
  var tytul = 'PUPIL-ID - Identyfikatory dla zwierząt';
  var adres = 'http://www.pupil-id.pl';

  //FireFox
  if (window.sidebar) { 
      window.sidebar.addPanel(tytul, adres, ""); 

  //IE
  } else if (window.external) {
      window.external.AddFavorite(adres, tytul); 

  //Opera
  } else if (window.opera && window.print) {
      var a = document.createElement('a');
      a.setAttribute('href', adres);
      a.setAttribute('title', tytul);
      a.setAttribute('rel','sidebar');
      a.click();
  }
  hidePopup();
}

function onLoadPage()
{
  if (window.external || window.sidebar || 
      (window.opera  && window.print) )
  {
    //Dodaj do ulubionych:
    addEvent();
    showPopup();
  }
}

