


function encode(arg){
if(encodeURIComponent)
return encodeURIComponent(arg);
return escape(arg)

}

function ajax(met,url,func,params)
  {
  //alert("METHOD="+met+"\nURL="+url+"\nCALLBACK="+func+"\nPARAMS="+params);
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
	
        func(xmlHttp.responseText);
        }
      }
	if(met=="get"||met=="GET"){
	
	xmlHttp.open(met,url,true);
	xmlHttp.send(null);
    
	}
    	if(met=="post"||met=="POST"){
	//alert("METHOD="+met+"\nURL="+url+"\nCALLBACK="+func+"\nPARAMS="+params);
	xmlHttp.open(met,url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(params);
	}
	return xmlHttp;
  }

function getStyle(el,styleProp)
{
	
	var stylIE = styleProp.replace(/-(.){1,1}/g ,function(s){return s.charAt(1).toUpperCase()})

	var x = el;
	if (x.currentStyle)
		var y = x.currentStyle[stylIE];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}



var animki=[];
function Anim(i) {
this.index=i;
this.speed = null;
this.begin = null;
this.cur=null;
this.end = null;
this.prop=null;
this.obj=null;
this.timer=null;
this.onDone=null;
this.onActive=null;
this.ofWhat="px"
this.animate = function () {
	if(Math.round(this.cur)!=this.end){
		this.cur+=(this.end-this.cur)/this.speed;
		this.cur=this.cur
		
		if(this.prop)
		this.obj[this.prop] =this.cur + this.ofWhat
		
		if(this.onActive)
			this.onActive(this.cur)
			
		this.timer=setTimeout('animki["'+this.index+'"].animate()',1);
	}else{
	
		this.obj[this.prop] =this.end + this.ofWhat
		if(this.onDone)
		this.onDone();
	}

}
this.stop=function(){
clearTimeout(this.timer)
}

this.actual=function (){
var r=parseInt(this.obj[this.prop]);
return isNaN(r)?this.begin:r;
}

return this;
}


function rollover(obj,ind,on){

	animki['link'+ind].speed=6;
	if(on){
		animki['link'+ind].stop()
		animki['link'+ind].cur= animki['link'+ind].cur || ind*24;
		animki['link'+ind].end=ind*24+12;
	} else{
		animki['link'+ind].stop()
		animki['link'+ind].cur= animki['link'+ind].cur ||  ind*24+12;
		animki['link'+ind].end=ind*24;
	}
	animki['link'+ind].obj=obj;

	animki['link'+ind].onActive = function(arg){
		animki['link'+ind].obj.style.backgroundPosition ="0px "+(-arg)+"px";
	}

	animki['link'+ind].animate();

	animki['link'+ind].onDone=function(){
		
		animki['link'+ind].cur= null
		animki['link'+ind].end=null
		
		
	}
}



var loops=0;
var _ind;
function loading_1(obj,ind){

	_ind=ind
	animki['uno'].cur=ind*24+12;
	animki['uno'].end=167;
	animki['uno'].obj=obj;

	animki['uno'].onActive = function(arg){
		animki['uno'].obj.style.backgroundPosition ="0px "+(-arg)+"px";
	}

	animki['uno'].animate();

	animki['uno'].onDone=function(){
		
		animki['uno'].cur=-12;
		animki['uno'].end=167;
		
		
		animki['uno'].animate();
		//animki['uno'].onDone=null;
		
		
	}
}


var ban_pos=-1;
function banner(){
	if(ban_pos>2)
	ban_pos=-1;

	animki['banner'].cur=(ban_pos)*37;
	animki['banner'].end=(ban_pos+1)*37;
	animki['banner'].obj=o('banner');

	animki['banner'].onActive = function(arg){
		animki['banner'].obj.style.backgroundPosition="0px "+(-arg)+"px";
	}
	animki['banner'].onDone=function(){
		ban_pos++;
		if(ban_pos==3)
		setTimeout('banner()',4)
		else
		setTimeout('banner()',2500)
	}
	
	animki['banner'].animate();
}

function setOpacity(obj,value) {
	obj.style.opacity = value/10;
	obj.style.filter = 'alpha(opacity=' + value*10 + ')';
}


function o(a){return document.getElementById(a);}


onload=function(){

animki['banner'] = new Anim('banner');
animki['banner'].speed=15;
banner()

var menu = o('menu').childNodes
var j=0;
for(var i=0;i<menu.length;i++){
var cl=menu[i].className+"";
	if(cl.indexOf('menulink')!=-1){
	
		if(cl.indexOf('sel')==-1){
			//menu[i].onmouseover=new Function('this.style.backgroundPosition ="0px -'+(j*24+12)+'px";')
			//menu[i].onmouseout=new Function('this.style.backgroundPosition ="0px -'+(j*24)+'px";')
			animki['link'+j] = new Anim('link'+j);
			menu[i].onmouseover=new Function('rollover(this,'+j+',1);')
			menu[i].onmouseout= new Function('rollover(this,'+j+',0);')
		}
		
		j++;
		
	}
}
if(o('low1') && o('low2')){
	o('low1').onmouseover=new Function('this.style.backgroundPosition ="0px -46px";')
	o('low1').onmouseout=new Function('this.style.backgroundPosition ="0px 0px";')
	o('low2').onmouseover=new Function('this.style.backgroundPosition ="-260px -46px";')
	o('low2').onmouseout=new Function('this.style.backgroundPosition ="-260px 0px";')
}




animki['uno'] = new Anim('uno');
animki['uno'].speed=12;



}
function open_year(y){
	if(!o("year"+y).style.display){
	o("year"+y).style.display="block";
	return false;
	}
	if(o("year"+y).style.display=="none"){
	o("year"+y).style.display="block";
	return false;
	}
	if(o("year"+y).style.display=="block"){
	o("year"+y).style.display="none";
	return false;
	}

}

function over(obj){

 obj.style.backgroundColor="#f3f0ab";
}

 function out(obj){

 obj.style.backgroundColor="";
 }
 
function dodajzakladke(tytul,adres) {
if (window.sidebar) //  dla firefoksa
   window.sidebar.addPanel(tytul, adres, "");
else if(window.opera && window.print) { // dla opery
   var elem = document.createElement('a');
   elem.setAttribute('href',adres);
   elem.setAttribute('title',tytul);
   elem.setAttribute('rel','sidebar');
   elem.click();
} 
else if(document.all)// dla internet explorera
   window.external.AddFavorite(adres, tytul);
}
