function pgNav(start,krok,max,o,kom1,kom2,kom3,r) {
  wynik="";
  if(r==0) {
    atr="href";
  }
  else if(r==1) {
    atr="href=\"#\" onclick";
  }
  for(i=1;i<=max;) {
    if((start<=(3*o+2)&&i<(start-o))||(start>=(3*o+2)&&i<=(2*o+1))||(i>=(start-o)&&i<=(start+o))||(i>=(max-2*o))||(start==1&&i<=(o+2))) {
      wynik=wynik+"\n<a "+atr+"=\""+kom1+(i-1)+kom2+(i-1)+kom3+"\">"+i+"</a>";
      ++i;
    }
    else {
      if(i>(2*o+1)&&i<start) {
        wynik=wynik+"...";
        i=start-o;
      }
      else if(i>(start+o)) {
        wynik=wynik+"...";
        i=max-2*o;
      }
    }
  }
return wynik;
}

function podswietl(id) {
document.getElementById(id).style.backgroundColor="rgb(236,246,255)";
}

function uwagapuste() {
window.alert("Aby dokonać wpisu, musisz koniecznie wypełnić pola otoczone czerwoną ramką!");
}

function dmiesiaca(n) {
switch(n) {
case 0:
nm="stycznia";
break;
case 1:
nm="lutego";
break;
case 2:
nm="marca";
break;
case 3:
nm="kwietnia";
break;
case 4:
nm="maja";
break;
case 5:
nm="czerwca";
break;
case 6:
nm="lipca";
break;
case 7:
nm="sierpnia";
break;
case 8:
nm="września";
break;
case 9:
nm="października";
break;
case 10:
nm="listopada";
break;
case 11:
nm="grudnia";
break;
}
return nm;
}

function waliduj(form,pola) {
var tczyn=true;
for(i=0;i<pola.length;i++) {
  document.getElementsByName(pola[i])[0].style.borderColor="black";
}
for(i=0;i<pola.length;i++) {
  pole=document.getElementsByName(pola[i])[0];
  if(pole.value==="") {
    tczyn=false;
    pole.style.borderColor="red";
  }
}
if(tczyn==true) {
  return true;
}
else {
  return false;
}
}

var rgb = new Array(200,228,255);

var tytul = document.location.pathname;
var host = document.location.hostname;

if(/olidze/.test(tytul)) {
start="m1";
}
else if(/wyniki/.test(tytul)) {
start="m3";
}
else if(/stat/.test(tytul)) {
start="m4";
}
else if(/zasady/.test(tytul)||/regulamin/.test(host)) {
start="m5";
}
else if(/linki/.test(tytul)) {
start="m6";
}
else if(/index/.test(tytul)||/frisbee.waw/.test(host)) {
start="m2";
}
else {
start=null;
}

function koloruj() {
if(start!=null) {
kom=document.getElementById(start);
kom.style.backgroundColor="rgb("+rgb[0]+","+rgb[1]+","+rgb[2]+")";
podkresl(kom,rgb[0],rgb[1],rgb[2]);
skonczp(kom);
skonczl(kom);
}
}

function podkresl(a,r,g,b) {
if(a.getAttribute("id")===start) {
//a.style.borderTop="solid";
a.style.borderBottom="solid";
a.style.borderWidth="12px"; 
a.style.borderColor="rgb("+r+","+g+","+b+")";
}
}

function skonczl(a) {
r=rgb[0];
g=rgb[1];
while(a.parentNode.previousSibling.previousSibling!=null) {
a=a.parentNode.previousSibling.previousSibling.childNodes[0];
r=r+12;
g=g+6;
a.style.backgroundColor="rgb("+r+","+g+","+rgb[2]+")";
podkresl(a,r,g,rgb[2]);
}
}

function skonczp(a) {
r=rgb[0];
g=rgb[1];
while(a.parentNode.nextSibling.nextSibling!=null) {
r=r+12;
g=g+6;
a=a.parentNode.nextSibling.nextSibling.childNodes[0];
a.style.backgroundColor="rgb("+r+","+g+","+rgb[2]+")";
podkresl(a,r,g,rgb[2]);
}
}


function wezmnie(e) {
(e!=null) ? e=e : e=window.event;
(e.target!=null) ? akt=e.target : akt=e.srcElement;
if(akt.className=="menu") {
akt.style.backgroundColor="rgb("+rgb[0]+","+rgb[1]+","+rgb[2]+")";
podkresl(akt,rgb[0],rgb[1],rgb[2]);
skonczp(akt);
skonczl(akt);
}
}

document.onmouseover=wezmnie;
