startList = function()
{
  if(document.all && document.getElementById)
  {
    navRoot = document.getElementById("nav");
    for(i = 0; i < navRoot.childNodes.length; i++)
    {
      node = navRoot.childNodes[i];
      if(node.nodeName == "LI")
      {
        node.onmouseover = function()
        {
          this.className += " over";
        }

        node.onmouseout = function()
        {
          this.className = this.className.replace(" over", "");
        }
      }
    }
  }
}
window.onload=startList;

function nPolterPopUp(strona,image,width,height)
 {
  if (height>650) 
   {
	  height=650;
	  width=parseInt(width)+20;
	  scrollbar='yes';
   } else scrollbar='no';
  
  var left=(screen.width-parseInt(width))/2;
  left=parseInt(left);
  if (navigator.appName!='Opera')
  	  var top=(screen.height-parseInt(height))/2;
  else
	  var top=(document.body.clientHeight-parseInt(height))/2;

  top=parseInt(top);
  

  window.open(strona+image+",gfx.html", "nPolterBigPic", "toolbar=no,menubar=no,personalbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scrollbar+",resizable=no,fullscreen=no,channelmode=no,width="+width+",height="+height+",top="+top+",left="+left);
 }
 
function karta_mtg(nazwakarty) {

  window.open("http://gatherer.wizards.com/Pages/Search/Default.aspx?name="+nazwakarty.replace('_', '%5D+%5B'), "Podglad_karty", "toolbar=0,location=0,status=0,menubar=0,scrollbars=1,width=800,height=500,left=100,top=100");

}

function IncludeJavaScript(jsFile)
 {
  document.write('<script type="text/javascript" src="'
    + jsFile + '"></script>'); 
 }
 
IncludeJavaScript('http://polter.pl/scripts/prototype.js');
IncludeJavaScript('http://polter.pl/scripts/scriptaculous/scriptaculous.js');
IncludeJavaScript('http://polter.pl/scripts/scriptaculous/effects.js');

function nPlink (id)
 {
  window.location=$(id).href;
 }
 
var Cookie = {
  set: function(name, value, daysToExpire) {
    var path= ';  path=/';
    var expire = '';
    if (daysToExpire != undefined) {
      var d = new Date();
      d.setTime(d.getTime() + (86400000 * parseFloat(daysToExpire)));
      expire = '; expires=' + d.toGMTString();
    }
    return (document.cookie = escape(name) + '=' + escape(value || '') + expire + path);
  },
  get: function(name) {
    var cookie = document.cookie.match(new RegExp('(^|;)\\s*' + escape(name) + '=([^;\\s]*)'));
    return (cookie ? unescape(cookie[2]) : null);
  },
  erase: function(name) {
    var cookie = Cookie.get(name) || true;
    Cookie.set(name, '', -1);
    return cookie;
  },
  accept: function() {
    if (typeof navigator.cookieEnabled == 'boolean') {
      return navigator.cookieEnabled;
    }
    Cookie.set('_test', '1');
    return (Cookie.erase('_test') === '1');
  }
};

function sortujNoty(typ,sortnew)
 {
  sortCookie=Cookie.get('sortNoty');
  if(sortCookie && sortCookie==typ+'_'+sortnew) 
   {
    Cookie.set('sortNoty',typ+'_'+sortnew+'_2');
    location.reload(true);
   } 
  else
   {
    Cookie.set('sortNoty',typ+'_'+sortnew);
    location.reload(true);
   }
 }

function sortujNotyLimit(opcja)
 {
  if(opcja=='NIE') 
   {
    Cookie.set('sortNotyLimit','NIE');
    location.reload(true);
   } 
  else
   {
    Cookie.erase('sortNotyLimit');
    location.reload(true);
   }
 }

function dodajLista(lista,nota_id,g2)
 {
  if (g2=='reload') {g2='&reload';} else {g2='';}
  new Ajax.Request('lista,noty.html?'+nota_id+'&'+lista+g2,
   {
    method: 'post',
    asynchronous: true,
    evalScripts: true
   });
  return false;
 }  

function dodajListaMenu(nota_id)
 {
  new Ajax.Updater('lista_dodaj_'+nota_id,'lista_menu,noty.html?'+nota_id,
   {
    method: 'post',
    asynchronous: true,
    evalScripts: true
   });
  return false;
 }
 
function polecRecenzja(rec_id)
 {
  new Ajax.Request('recenzja_polec,artykuly.html?'+rec_id,
   {
    method: 'post',
    asynchronous: true,
    evalScripts: true
   });
 }