function o(a){return document.getElementById(a)}
if (!Array.prototype.forEach)Array.prototype.forEach = function(fun /*, thisp*/){var len = this.length >>> 0,thisp = arguments[1]; for (var i = 0; i < len; i++)if (i in this)fun.call(thisp, this[i], i, this);};
function byClass(c,tag){var ls=(this!=window?this:document).getElementsByTagName((tag?tag:'*')),r=[];for(var i=0,l=ls.length;i<l;i++)if(hasClass(ls[i],c))r.push(ls[i]);return r;}
function addClass(obj,c){if(!hasClass(obj,c))obj.className+=' '+c;}
function remClass(obj,c){var a= (obj.className+'').split(/\s+/);for(l=a.length,i=0,s=[];i<l;i++)if(a[i]!=c)s[s.length]=a[i];obj.className=s.join(' ');}
function hasClass(obj,c){return (obj.className+'').indexOf(c)==0||(obj.className+'').indexOf(' '+c)>0}
function togClass(obj,c){if(hasClass(obj,c))remClass(obj,c);else addClass(obj,c);}
function target(e) {var targ;if (!e) var e = window.event;if (e.target) targ = e.target;else if (e.srcElement) targ = e.srcElement;if (targ.nodeType == 3)targ = targ.parentNode;return targ;	}
function index(obj){var ls=obj.parentNode.childNodes;for(var i=0,l=ls.length;i<l;i++)if(ls[i]==obj)return i;return -1;}
function scrollTop(){return document.body.scrollTop+ document.documentElement.scrollTop;}
Function.prototype.bind = function(object) {
  var __method = this;
  return function() {
	return __method.apply(object, arguments);
  }
}

var navi_alt=[['SZUKAJ','DODAJ DO ULUBIONYCH','DRUKUJ','NAPISZ'],['SEARCH','BOOKMARK','PRINT','CONTACT']];




function domore(l){
var w=l.parentNode.offsetWidth-l.offsetLeft-28;
l.firstChild.style.width=(w>0?w:0)+'px';

if(!l.offsetLeft){
//l.style.display='block'
l.style.width=(w+25)+'px'
}


}

function doacc(a){
if(a){
o('hidden').style.position='relative'
o('hidden').style.top='0'
o('visible').style.display='none'
}else{
history.go(-1)
}


}



function anim(params){
  for(var i in params)this[i]=params[i];
  
  
  this.go=function (){
    this.now=(new Date()).getTime();
    var cond=this.step((this.now-this.start)/this.duration)
    if(cond)this.timer=setTimeout(this.go.bind(this),10)
    else clearTimeout(this.timer);
    return this;
  }
  this.reset=function(){
  clearTimeout(this.timer);
    this.start=(new Date()).getTime();
    return this;
  }
  
}
var cur_menu;
var navi_anim;
function rngo(){navi_anim.reset().go()}

onloac.push(function(){
  
  /*menu*/
  var rem = o('menu').childNodes[5].getElementsByTagName('ul')[0];
  
  rem.parentNode.removeChild(rem);
  
  
  
  var lst=o('menu').getElementsByTagName('li');
  for(var i=0,l=lst.length;i<l;i++){
    if(!index(lst[i]))addClass(lst[i],'first');
    if(lst[i].getElementsByTagName('ul').length){
    lst[i].onmouseover=function(){addClass(this,'open');}
    lst[i].onmouseout= function(){remClass(this,'open');}
    }
  }
 
  
  
  var pth=window.location.pathname.split('/')[2];

  lst=o('menu').childNodes;
  for(var i=0,l=lst.length;i<l;i++){
    var cp= lst[i].firstChild.href.split('/')[4];
   
    if(cp==pth)addClass(lst[i].firstChild,'rd');
    lst[i].firstChild.innerHTML+='<b class="a mc spr"><!-- --></b>';
    
  }
  lst=o('menu').getElementsByTagName('ul');
 
  for(var i=0,l=lst.length;i<l;i++){
  var d; 
   if(lst[i].parentNode.parentNode!=o('menu')&& 0<(d=lst[i].childNodes.length-lst[i].parentNode.parentNode.childNodes.length+ index(lst[i].parentNode))  ){
    lst[i].style.top=-d*17+'px';
    
     remClass( lst[i].childNodes[0],'first');
    //remClass(byClass.call( lst[i],'first','li')[0],'first');
    addClass(lst[i].childNodes[d],'first');
   }
  }
  
  /*---*/
  
  /*more*/
  var mors=byClass('more','a');
  for(var i=0,l=mors.length;i<l;i++)domore(mors[i])
  /*---*/
  
  
  
   navi_anim=new anim({
   'duration':300,
   'step':function(p){
    var st=scrollTop()+123-o('navi').offsetTop;
    o('navi').style.top=( (o('navi').offsetTop+st*p)>o('content').offsetHeight-180?o('content').offsetHeight-180:(o('navi').offsetTop+st*p) )+'px';
    if(o('year-pick'))o('year-pick').style.top=((o('year-pick').offsetTop+(scrollTop()-o('year-pick').offsetTop)*p)<o('content').offsetHeight-180?(o('year-pick').offsetTop+(scrollTop()-o('year-pick').offsetTop)*p):o('content').offsetHeight-180)+'px';
    return p<1;
   }});
  
  window.onscroll=function(){
   setTimeout("rngo()",1);
   
  }
  
  o('navi').onmouseover=function(e){
    var t=target(e);
	if(hasClass(t,'itm')){
	var msg = (navi_alt[lang()][t.rel]);
	o('alt').innerHTML=msg;
	o('alt').style.display='block'
	o('alt').style.top=(t.offsetTop-10)+'px'
	o('alt').style.left=(t.offsetLeft-o('alt').offsetWidth-10)+'px'
	}
  }
  o('navi').onmouseout=function(){
  o('alt').style.display='none'
  }
  
  
  o('botmenu').childNodes[2].firstChild.innerHTML='CRM'

  
  
  
  
})



function bookmarksite(title,url){

if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

/*FLASH*/

	function itemOver(_type)
	{
		var m=thisMovie("wola_box")
		if(m)
		m.setCubePosition(_type);
	}
	
	function itemOut()
	{
		var m=thisMovie("wola_box")
		if(m)
		m.setCubePosition('top');
	}
	
	function thisMovie(movieName) 
	{
        if (navigator.appName.indexOf("Microsoft") != -1) 
		{
            return window[movieName];
        } 
		else 
		{
            return document[movieName];
        }
    }
/*FLASH*/

 function lang(){
	var l=window.location.pathname.split('/')
	return (l[1]=='pl'||!l[1]?0:1);
 }
 function printPage(){
 window.print()
 }
 
 
 
 
function cube_more(){
var l=window.location.pathname.split('/')

window.location.pathname='/'+(l[1]?l[1]:'pl')+'/wola-info/';
}
