function trim(x){return x.replace(/^\s+|\s+$/g,'');}
function _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) {}}
function _gOb(n) { return document.getElementById(n); }
function _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 (_hCl(objs[i], clName)) robj[j++] = objs[i]; }; return robj; }
function _hCl(obj, clName) { var clN = ' ' + obj.className + ' '; return (clN.match(' ' + clName + ' ') != null); }
function _aCl(obj, clName) { if (_hCl(obj, clName)) return; obj.className = trim(obj.className + ' ' + clName); }
function _rCl(obj, clName) { if (!_hCl(obj, clName)) return; var clN = ' ' + obj.className + ' '; eval("obj.className = trim(clN.replace(/ " + clName + " /g,' '));"); }

function __nav_init(){
 var _navMainList = _gBTC(_gOb('navH'), 'ul', 'p0')[0];
 var _currLoc = window.location + ' ';	
 var isRoot = -1;
 if(_currLoc.indexOf("0,90866.html") > -1 || _currLoc.indexOf("0,0.html") > -1 || _currLoc.indexOf("3481890,67525.html") > -1) isRoot = 1; 

 if(_navMainList){
  var _activeLink = _gBTC(_navMainList, 'li', 'active')[0];
  if(_activeLink){
   var _activeLinkId = _activeLink.getAttribute('id');
   if(_hCl(_activeLink.parentNode, 'p0') && !_hCl(_activeLink, 'pracodawca')){
    var _regExp = /\d{1,2}/;
    var _idNumber = _regExp.exec(_activeLinkId);
    _idNumber++;
    var _nextId = 'e'+ _idNumber;
    var _nextElem = _gOb(_nextId);
    if (_nextElem && !_hCl(_nextElem, 'pracodawca')) _nextElem.style.background = 'none';
   }
   if(_activeLinkId == 'e1' && isRoot > -1 ){
    _navMainList.style.marginBottom = '20px';
    document.write('<style type="text/css">#bg_blk {display: none !important;}</style>');
   }
   if(isRoot == -1){
	document.write('<style type="text/css">#pracaSearch {background: url(\'/i/obrazki/praca2008/topSearch_whiteNarrow.gif\') no-repeat 0 0 !important; margin-bottom: 15px; padding: 14px 25px 14px 23px !important;} #sL {background: #fff;}</style>');
   }
   var _hasChild = _gBTC(_activeLink, 'ul', 'p1')[0];
   if(_hasChild){
    _navMainList.style.height = 42 + _hasChild.offsetHeight + 'px';
   }
   var _show_more = _gBTC(_navMainList, 'li', 'show_more')[0];
   
   if(_show_more){
    _show_more.index = 1;
    _aEv(_show_more, 'click', show_more_links);
   }
   var _show_less = _gBTC(_navMainList, 'li', 'show_less')[0];
   
   if(_show_more){
    _show_less.index = 1;
    _aEv(_show_less, 'click', show_less_links);
   }
  }
 }
}

function show_more_links(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 is_msie = ((navigator.appVersion.indexOf("MSIE")!= -1)&&!window.opera)? true : false;
 var _navMainList = _gBTC(_gOb('navH'), 'ul', 'p0')[0];
 var _activeLink = _gBTC(_navMainList, 'li', 'active')[0];
 var _hasChild = _gBTC(_activeLink, 'ul', 'p1')[0];
 var _lines = _gBTC(_hasChild, 'li', 'newline'); 
 var _hiddenLines = _gBTC(_hasChild, 'li', 'hideme'); 
 var _newHeight = _navMainList.offsetHeight + _lines.length*14 + _lines.length*5;
 if(is_msie) _newHeight += _lines.length;
 _aCl(el, 'hideme');
 _navMainList.style.height = _newHeight + 'px';
 for( var i=0; i <_hiddenLines.length ; i++){_rCl(_hiddenLines[i], 'hideme'); _aCl(_hiddenLines[i], 'showme');}
}

function show_less_links(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 is_msie = ((navigator.appVersion.indexOf("MSIE")!= -1)&&!window.opera)? true : false;
 var _navMainList = _gBTC(_gOb('navH'), 'ul', 'p0')[0];
 var _activeLink = _gBTC(_navMainList, 'li', 'active')[0];
 var _hasChild = _gBTC(_activeLink, 'ul', 'p1')[0];
 var _lines = _gBTC(_hasChild, 'li', 'newline'); 
 var _hiddenLines = _gBTC(_hasChild, 'li', 'showme'); 
 var _show_more = _gBTC(_navMainList, 'li', 'show_more')[0];
 var _newHeight = _navMainList.offsetHeight - _lines.length*14 - _lines.length*5;
 if(is_msie) _newHeight -= _lines.length;
 _aCl(el, 'hideme');
 _rCl(_show_more, 'hideme');
 _navMainList.style.height = _newHeight + 'px';
 for( var i=0; i <_hiddenLines.length ; i++){_rCl(_hiddenLines[i], 'showme'); _aCl(_hiddenLines[i], 'hideme');}
}
