    // convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase();

    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);

    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie4up  = (is_ie && (is_major >= 4));
    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
        var is_opera7 = (window.opera)?true:false;
    var is_gecko = (agt.indexOf('gecko') != -1);


if(document.all && !document.getElementById)
    document.getElementById = function(id) { return document.all[id]; }


function chS(obj, new_style) {
    obj.className = new_style;
}

var lastWin;
function setImg (imgSrc,reSize) {
        if (lastWin.jestem) {
                
                if (reSize == 1) {
                        lastWin.document.body.innerHTML = '<img src="'+imgSrc+'" id="obrazek" onload="window.resizeTo(this.width + 10,this.height + 30);window.moveTo(20,20);" >'; 
                        lastWin.focus();
                }
                else {
                        lastWin.document.body.innerHTML = '<img src="'+imgSrc+'" id="obrazek" >'; 
                }
                        
        }        
        else {
                setTimeout("setImg('"+imgSrc+"', '"+reSize+"')",100);
        }
}


function setSizeImg () {
        if (lastWin.document.getElementById('obrazek')) {

        //        lastWin.resizeTo(lastWin.document.getElementById('obrazek').width + 10,lastWin.document.getElementById('obrazek').height + 30);
        //        lastWin.moveTo(20,20); 
                alert(lastWin.document.getElementById('obrazek').src);
                lastWin.close(); 
                zoomImg(lastWin.document.getElementById('obrazek').src,lastWin.document.getElementById('obrazek').width,lastWin.document.getElementById('obrazek').height);
        }        
        else {
                setTimeout("setSizeImg()",100);
        }
}

// onload="window.resizeTo(this.width + 10,this.height + 30);window.moveTo(20,20);

function zoomImg(imgSrc,xSize,ySize) {
        reSize = 1;
        if (xSize && ySize) reSize = 0;
        if (!xSize) xSize=300;
        if (!ySize) ySize=300;
        scrollBary='no';
        xPos=20;
        lastWin = window.open('blank.html','zoomOkno','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollBary+',resizable=yes,fullscreen=no,channelmode=no,width='+xSize+',height='+ySize+',top=0,left='+xPos);
        
        setImg (imgSrc,reSize);
        void(0);
}

function oW (path,Xsiz,Ysiz) {
        var przed = '';
        if (!(Xsiz > 0)) { Xsiz = 300; }
        if (!(Ysiz > 0)) { Ysiz = 300; }
        window.open(przed+path, 'fotozoom', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,fullscreen=no,channelmode=no,width='+Xsiz+',height='+Ysiz+',top=30,left=30');
        void(0);
}


function el (id) {
        return document.getElementById(id);
}

function tf (txt,id) {
                if (el(id).value == '') {
                alert(txt);
                        el(id).focus();
                        return false;
                }
                else return true;
}

function ts (txt,id) {
                if (el(id).selectedIndex == 0) {
                alert(txt);
                        el(id).focus();
                        return false;
                }
                else return true;
}

function te (txt,id) {
                if (el(id).value != '' && el(id).match(/^.*\@.*\..*$/)==null) {
                alert(txt);
                        el(id).focus();
                        return false;
                }
                else return true;
}

function tc (txt,id) {
                if (!(el(id).checked)) {
                
                if (txt != '') { alert(txt); el(id).focus(); }
                        return false;
                }
                else return true;
}




function pobierz(nazwa) {
    if (document.cookie.length > 0) {
        startc = document.cookie.indexOf(nazwa + "=");
        if (startc != -1) {
            startc += nazwa.length + 1;
            endc = document.cookie.indexOf(";", startc);
            if (endc == -1) {
                endc = document.cookie.length;
            }
            return unescape(document.cookie.substring(startc,endc));
        }
    }
}

function rejestruj(nazwa, wartosc,dni) {
    var dzisiaj=new Date();
    var wygasnie=new Date();
    !dni ?dni=7 :"";
    // dni - data po której ciastko traci ważność (domyślnie tydzień)
    // jeśli dni==0 to ważne w ciągu danej "sesji"
    wygasnie.setTime(dzisiaj.getTime()+1000*60*60*24*dni);
	document.cookie=nazwa+"="+escape(wartosc)+";expires="+wygasnie.toGMTString();
}

function rescaleLayout() {
	dW = document.body.offsetWidth-15;
	rP = parseInt((dW - 200)*100/dW);
	rP = is_ie5?rP:rP - 8;
	if (el('rightColumn')) el('rightColumn').style.width = rP+'%';

	// ('window width: '+dW+' rightProc:'+rP);
}

// pokoloruj tabelke w stylu listing
function colorTableRows() {
  var myTR = document.getElementsByTagName('tr');
  for (var i=0;i<myTR.length;i++) {
    if (i%2) {
      myTR[i].className = 'even';
    }
    else {
      myTR[i].className = 'odd';
    }
  }
}

