function poz(j,k)
{
   var t = 'x'+j;
   var nodes = document.getElementById(t).childNodes;
   for (var i = 0; i < nodes.length; i++)
   {
     	var act=(i==k) ? 'block' : 'none';
     	nodes[i].style.display = act;
	}
}


function winopen(plik, w, h) {
	if(window.screen) {
	aw=screen.availwidth;
	ah=screen.availheight;
	}else{
	aw=700;
	ah=480;
	}
	ustawienia=
	"left="+(aw-w)/2+","
	+"top="+(ah-h)/2+","
	+"screenX="+(aw-w)/2+","
	+"screenY="+(ah-h)/2+","
	+"width="+w+","
	+"height="+h+","
	+"toolbar=no,"
	+"location=no,"
	+"directories=no,"
	+"status=no,"
	+"menubar=no,"
	+"scrollbars=yes,"
	+"resizable=no"
	noweokno=window.open(plik,'Karta',ustawienia);
	noweokno.focus();
}

function ntos(n){
    n=n.toString(16);
    if (n.length == 1) n="0"+n;
    n="%"+n;
    return unescape(n);
}

function codder(str){
    str = str.replace(new RegExp("s/[^0-9a-zA-Z]//g"));
    var result = "";
    var nextchar = "";
    for (var i=0; i<str.length; i++){
        nextchar += str.charAt(i);
        if (nextchar.length == 2){
            result += ntos(eval('0x'+nextchar));
            nextchar = "";
        }
    }
    location.href=result;

}

function newWindowCal(co) {
	mywindow=open('/kalendarz.php?pole='+co,'Kalendarz','resizable=no,width=250,height=170, left=100, top=100');
}


function showFlash(flash_plik,sub_plik,szer,wys) {

	var width = szer;
	var height = wys;
	var flash = flash_plik;
	var plik = sub_plik;
		
	if (!plik) {

		document.write('<object type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" data="'+flash+'">');
		document.write('<param name="movie" value="'+flash+'" />');
		document.write('<param name="wmode" value="transparent"/>');
		document.write('</object>');
	
	} else {
		document.write('<div><img src="'+plik+'" width="'+width+'" height="'+height+'" alt="obrazek"/></div>');
	
	}

}


var dofade=true;
var center=false;
var centertext=false;

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

var NS4=(navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)?true:false;
var IE4=(document.all && !document.getElementById)?true:false;
var IE5=(document.getElementById && document.all)?true:false;
var NS6=(document.getElementById && navigator.appName.indexOf("Netscape")>=0 )?true:false;
var W3C=(document.getElementById)?true:false;
var w_y,w_x,popuptxt,boxheight,boxwidth;
var ishover=false;
var isloaded=false;
var ieop=0;
var op_id=0;

function getwindowdims(){
	w_y=(NS4||NS6||window.opera)? window.innerHeight : (IE5||IE4)? document.body.clientHeight : 0;
	w_x=(NS4||NS6||window.opera)? window.innerWidth : (IE5||IE4)? document.body.clientWidth : 0;
}

function getboxwidth(){
	if(NS4)boxwidth=(popuptxt.document.width)? popuptxt.document.width : popuptxt.clip.width;
	if(IE5||IE4)boxwidth=(popuptxt.style.pixelWidth)? popuptxt.style.pixelWidth : popuptxt.offsetWidth;
	if(NS6)boxwidth=(popuptxt.style.width)? parseInt(popuptxt.style.width) : parseInt(popuptxt.offsetWidth);
}

function getboxheight(){
	if(NS4)boxheight=(popuptxt.document.height)? popuptxt.document.height : popuptxt.clip.height;
	if(IE4||IE5)boxheight=(popuptxt.style.pixelHeight)? popuptxt.style.pixelHeight : popuptxt.offsetHeight;
	if(NS6)boxheight=parseInt(popuptxt.offsetHeight);
}

function movepopuptxt(x,y){
	if(NS4)popuptxt.moveTo(x,y);
	if(W3C||IE4){
		popuptxt.style.left=x+'px';
		popuptxt.style.top=y+'px';
	}
}

function getpagescrolly(){
	if(NS4||NS6)return window.pageYOffset;
	if(IE5||IE4)return ietruebody().scrollTop;
}

function getpagescrollx(){
	if(NS4||NS6)return window.pageXOffset;
	if(IE5||IE4)return ietruebody().scrollLeft;
}

function writeindiv(text){
	if(NS4){
		popuptxt.document.open();
		popuptxt.document.write(text);
		popuptxt.document.close();
	}
	if(W3C||IE4)popuptxt.innerHTML=text;
}

function writetxt(text){
	if(isloaded){
		if(text!=0){
			ishover=true;
			writeindiv(text);
			getboxheight();
			if((W3C || IE4) && dofade){
				ieop=0;
				incropacity();
			}
		}else{
			if(NS4)popuptxt.visibility="hide";
			if(IE4||W3C){
				if(dofade)clearTimeout(op_id);
				popuptxt.style.visibility="hidden";
			}
			writeindiv('');
			ishover=false;
		}
	}
}

function incropacity(){
	ieop=100;
	if(ieop<=100){
		if(IE4 || IE5)popuptxt.style.filter="alpha(opacity="+ieop+")";
		if(NS6)popuptxt.style.MozOpacity=ieop/100;
		ieop+=7;
		op_id=setTimeout('incropacity()', 50);
	}
}

function moveobj(evt){
	if(isloaded && ishover){
		margin=(IE4||IE5)? 1 : 23;
		if(NS6)if(document.height+27-window.innerHeight<0)margin=15;
		if(NS4)if(document.height-window.innerHeight<0)margin=10;
		if (NS4){
			mx=evt.pageX;
			my=evt.pageY;
		}
		else if (NS6){
	   	mx=evt.clientX;
	   	my=evt.clientY;
		}
		else if (IE5){
			mx=event.clientX;
			my=event.clientY;
		}
		else if (IE4){
	   	mx=0;
			my=0;
		}
		if(NS4){
			mx-=getpagescrollx();
			my-=getpagescrolly();
		}
		xoff=(center)? mx-boxwidth/2 : mx+5;
		yoff=(my+boxheight+30+margin>=w_y)? -10-boxheight: 20;
		movepopuptxt( Math.min(w_x-boxwidth-margin , Math.max(2,xoff))+getpagescrollx() , my+yoff+getpagescrolly());
		if(NS4)popuptxt.visibility="show";
		if(W3C||IE4)popuptxt.style.visibility="visible";
	}
}

if(NS4)document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=moveobj;



