// JavaScript Document
/*funkcja referenceToElement.addEventListener('nameOfEvent',referenceToFunction,phase)
gdzie (DOM2)'nameOfEvent' zapisuje się np:'mouseover' 'click' 'keyup' itd. RefrenceToFunction może być a direct function reference.
Phase=false oznacza bubbling (nie wiem czy tak jest w DOM2, w IE jeśli np. link był w div i miał eventhandler,event widział link i div, link najpierw)
Phase=true oznacza capturing, (Mozilla) orginalnie div widział event,link nie (chyba że kod nakazywał kontynuację)
W DOM2 capture powoduje,że event widzi tylko div (czyli event jest spożytkowany przez ancestors of target element) */
/* Z Wikipedii:http://en.wikipedia.org/wiki/Whitespace_(computer_science):Still, for most programming languages, abundant use of whitespace, especially trailing whitespace at the end of lines, is considered a nuisance. In interpreted languages, parsing of unnecessary whitespace may affect the speed of execution. In markup languages like HTML, unnecessary whitespace increases the file size, and may so affect the speed of transfer over a network. On the other hand, unnecessary whitespace can also inconspicuously mark code, similar to, but less obvious than comments in code. This can be desirable to prove an infringement of license or copyright that was committed by copying and pasting.*/
/* Regular expression usuwające whitespace w js, na stronie http://www.faqts.com/knowledge_base/view.phtml/aid/1678/fid/1 *
function f_trm(x){return x.replace(/^\s+|\s+$/g,'');} /*regular expression to remove spaces (whitespaces) */
function f_aev(obj, type, fn) { try { if (obj.addEventListener) { obj.addEventListener(type, fn, false); } else if (obj.attachEvent) { obj["e"+type+fn] = fn; obj[type+fn] = function() { obj["e"+type+fn](window.event); }; obj.attachEvent("on"+type, obj[type+fn]); }} catch (e) {}} /*attachEvent jest dla IE.Po catch muszą być klamry. Puste catch łapie i suppress error */
function f_gob(n) { return document.getElementById(n); }
function f_gBTC(obj, tag, clName) { var objs = obj.getElementsByTagName(tag); var robj = new Array(); var j = 0; for (var i = 0; i < objs.length; i++) { if (f_hCl(objs[i], clName)) robj[j++] = objs[i]; }; return robj; }
function f_hCl(obj, clName) { var clN = ' ' + obj.className + ' '; return (clN.match(' ' + clName + ' ') != null); }
function f_aCl(obj, clName) { if (!f_hCl(obj, clName)) obj.className = f_trm(obj.className + ' ' + clName); }
function f_rCl(obj, clName) { if (!f_hCl(obj, clName)) return; var clN = ' ' + obj.className + ' '; eval("obj.className = f_trm(clN.replace(/ " + clName + " /g,''));"); }

var __nav_listobj = null;

function __nav_init(){
 var _navObj = f_gob('navH');
 
 if(_navObj) {
  var _p0 = _navObj.getElementsByTagName('ul')[0];
  if(_p0) {
   var _p0LI = _p0.getElementsByTagName('li');
   if(_p0LI.length > 0) {
    for(var i = 0; i<_p0LI.length; i++) {
     var _p1 = null;
     var _p1 = _p0LI[i].getElementsByTagName('ul')[0];
     if(_p1) {
      _p0LI[i].index = 1;
      f_aev(_p0LI[i], 'mouseover', showSubNav);
      f_aev(_p0LI[i], 'mouseout',hideSubNav );
     }
    }
   }
  }
  var _navTxt = f_gBTC(document, 'div', 'navTxt')[0];
  
  if(_navTxt){
   __nav_listobj = f_gBTC(_navTxt, 'div', 'contener2')[0];
   var _listLink = f_gBTC(_navObj, 'a', 'lista')[0];
   if(_listLink && __nav_listobj){
    f_aev(_listLink, 'mouseover', __nav_showAllServices);
    f_aev(_listLink, 'mouseout', __nav_hideAllServices);
    f_aev(__nav_listobj, 'mouseover', __nav_showAllServices);
    f_aev(__nav_listobj, 'mouseout', __nav_hideAllServices);
   }
  }
 }
}
//Funkcja wywoływana przez mouseover,nie dotyczy 'listy'
function showSubNav(e){
 var el; if (window.event && window.event.srcElement) { el = window.event.srcElement; }; if (e && e.target) { el = e.target; }; if (!el) { return; }; (e.preventDefault) ? e.preventDefault() : (e.returnValue = false);
 while (el.index != 1) el = el.parentNode;
 var _subNav = el.getElementsByTagName('ul')[0];
 if(_subNav) _subNav.style.display = 'block';
}

function hideSubNav(e){
 var el; if (window.event && window.event.srcElement) { el = window.event.srcElement; }; if (e && e.target) { el = e.target; }; if (!el) { return; }; (e.preventDefault) ? e.preventDefault() : (e.returnValue = false);
 while (el.index != 1) el = el.parentNode;
 var _subNav = el.getElementsByTagName('ul')[0];
 if(_subNav) _subNav.style.display = 'none';
}
//Funkcja wwywoływana przez mouseover,dotyczy tylko 'listy'
function __nav_showAllServices(e) {
 if (!__nav_listobj) return;
 __nav_listobj.style.display = 'block';
}

function __nav_hideAllServices(e) {
 if (!__nav_listobj) return;
  __nav_listobj.style.display = 'none';
}


