  function light_white() {
    this.style.color = '#FFFFFF';       
  }
  function light_yellow() {
    this.style.color = '#FFCB05'; 
  }
  function light_red() {
    this.style.color = '#7F0000'; 
  }
  function unlight() {
    this.style.color = '#6C6D6F'; 
  }
  
  function menuInit() {

    // ************* LINKI *****************
    ul = document.getElementById('mainmenu');
    li = ul.getElementsByTagName('li');

    n = 1;
    for (i=0; i<li.length; i++) {     
      a = li[i].getElementsByTagName('a');
      
      //li[i].getElementsByTagName('a').onclick = function() {alert('ok')}
      
      if (n % 1 == 0) { a[0].onmouseover = light_white;  a[0].className = 'cwhite'  ; a[0].onclick = function() {createCookie('al', 'cwhite', 0);  eraseCookie('al2'); eraseCookie('al3')}}
      if (n % 2 == 0) { a[0].onmouseover = light_yellow; a[0].className = 'cyellow' ; a[0].onclick = function() {createCookie('al', 'cyellow', 0); eraseCookie('al2'); eraseCookie('al3')}}
      if (n % 3 == 0) { a[0].onmouseover = light_red;    a[0].className = 'cred'    ; a[0].onclick = function() {createCookie('al', 'cred', 0);    eraseCookie('al2'); eraseCookie('al3')}}
      
      a[0].onfocus = function() { this.blur() };
      a[0].onmouseout = unlight;

      n = n == 3 ? 1 : n + 1;
    }


    // srodkowe menu    
    document.getElementById('about').onclick     = function() {createCookie('al2', 'about', 0)}
    document.getElementById('about').onmouseover = function() {document.getElementById('ooo').src = '/s/p/moom/circles_3_a.jpg'}
    document.getElementById('about').onmouseout  = function() {document.getElementById('ooo').src = '/s/p/moom/circles_3.jpg'}
    
    document.getElementById('contact').onclick     = function() {createCookie('al2', 'contact', 0)}
    document.getElementById('contact').onmouseover = function() {document.getElementById('ooo').src = '/s/p/moom/circles_3_a.jpg'}
    document.getElementById('contact').onmouseout  = function() {document.getElementById('ooo').src = '/s/p/moom/circles_3.jpg'}
    
    
    //lista artykulow
    dl = document.getElementById('SubsectionList');//articlesList
    if (dl) {
      dt = dl.getElementsByTagName('dt');
     
      for (i=0; i<dt.length; i++) {     
        a = dt[i].getElementsByTagName('a');
        a[0].id = i;
        a[0].onclick = function() {createCookie('al3', this.id, 0)}
        
      }
    }

  }
  
  
  function activeLight() {
    al = readCookie('al');  //active Link (menu po prawej)
    
    // menu po prawej
    ul = document.getElementById('mainmenu');
    li = ul.getElementsByTagName('li');

    for (i=0; i<li.length; i++) {     
      if (li[i].className == 'current') {     
        a = li[i].getElementsByTagName('a');
        switch (al) {
          case 'cwhite':  a[0].style.color = '#FFFFFF'; a[0].onmouseout = function() {}; break;
          case 'cyellow': a[0].style.color = '#FFCB05'; a[0].onmouseout = function() {}; break;
          case 'cred':    a[0].style.color = '#7F0000'; a[0].onmouseout = function() {}; break;       
        }
      }
    }
    
    
    
    // lista artykulow 
    al3 = readCookie('al3');
    dl = document.getElementById('SubsectionList');//articlesList
    if (dl) {
      dt = dl.getElementsByTagName('dt');
     
      for (i=0; i<dt.length; i++) {     
        a = dt[i].getElementsByTagName('a');
          switch (al) {
            case 'cwhite':  a[0].onmouseover = light_white;  a[0].className = 'cwhite';  if (al3 == a[0].id) a[0].style.color = '#FFFFFF'; else a[0].onmouseout = unlight ; break;
            case 'cyellow': a[0].onmouseover = light_yellow; a[0].className = 'cyellow'; if (al3 == a[0].id) a[0].style.color = '#FFCB05'; else a[0].onmouseout = unlight ; break;
            case 'cred':    a[0].onmouseover = light_red;    a[0].className = 'cred';    if (al3 == a[0].id) a[0].style.color = '#7F0000'; else a[0].onmouseout = unlight ; break;       
          }      
       
        a[0].onfocus = function() { this.blur() };
      }
    }

    
    // srodkowe linki
    al2 = readCookie('al2');
    if (al2 == 'about') {
      document.getElementById('ooo').src = '/s/p/moom/circles_3_a.jpg'
      document.getElementById('about').style.color = '#FFFFFF'
      document.getElementById('about').onmouseout = function() {}
      document.getElementById('contact').onmouseout = function() {}
    }
    if (al2 == 'contact') {
      document.getElementById('ooo').src = '/s/p/moom/circles_3_a.jpg'
      document.getElementById('contact').style.color = '#FFFFFF'
      document.getElementById('contact').onmouseout = function() {}
      document.getElementById('about').onmouseout = function() {}
    }
  }
 


window.onload = function() {
  menuInit();
  activeLight();
}