    // 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_opera = (window.opera)?true:false;
    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]; }

if(document.all && !document.getElementsByTagName)
    document.getElementsByTagName = function(tag) { return document.all.tags(tag); }





function oW (path,Xsiz,Ysiz,winName,xPoz,yPoz,scr) {
	if (typeof winName == 'undefined') winName = 'fotozoom';
	if (typeof xPoz == 'undefined') xPoz = 30;
	if (typeof yPoz == 'undefined') yPoz = xPoz;
	if (typeof scr == 'undefined') scr = 'yes';
	var przed = '';
	if (!(Xsiz > 0)) { Xsiz = 300; }
	if (!(Ysiz > 0)) { Ysiz = 300; }
	w = window.open(przed+path, winName, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scr+',resizable=no,fullscreen=no,channelmode=no,width='+Xsiz+',height='+Ysiz+',top='+yPoz+',left='+xPoz+'');
	w.focus();
	void(0);
}


function flash(name,src,x,y,ver,opcja) {
		
	if (is_ie) { b = 'ie' }
	else if (is_gecko) { b = 'gecko' }
	else if (is_opera) { b = 'opera' }

	if (opcja == 'w3c' || (opcja == 'jsOpti' && b != 'ie')) {
		document.write ('<object id="'+name+'" type="application/x-shockwave-flash" data="'+src+'" width="'+x+'" height="'+y+'" >');
		document.write ('<param name="movie" value="'+src+'" >');
		document.write ('<param name="swliveconnect" value="true">');
		document.write ('<param name="wmode" value="opaque">');
		document.write ('</object>');
	}
	else if (opcja == 'fsc' || (opcja == 'jsOpti' && b == 'ie') || (opcja == 'transparent' && b == 'ie')) {

		document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write ('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ver+',0,0,0"');
		document.write ('width='+x+' height='+y+' id="'+name+'">');
		document.write ('<param name=movie value="'+src+'">');
		document.write ('<param name=quality value=high>');

		if (opcja == 'transparent') document.write ('<param name="wmode" value="transparent">');

		document.write ('<param name="swliveconnect" value="true">');
		document.write ('<embed src="'+src+'" quality="high" width="'+x+'" height="'+y+'"');
		document.write (' type="application/x-shockwave-flash"');
		document.write (' pluginspage="http://www.macromedia.com/downloads/"');
		document.write (' name="'+name+'" swliveconnect="true">');
		document.write ('</embed>');
		document.write ('</object>');
	}
}



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));
        }
	return false;
    }
    return false;
}

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 zoomImg(url,title){

    var okno;

    if (okno){
       okno.close();
    }

    okno = window.open(url,title,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,fullscreen=no,channelmode=no,width=400,height=400,top=0,left=0');
    okno.document.open();
    okno.document.write("<HEAD><title>"+title+"</title></head><BODY style=\"margin:0;padding:0;overflow:hidden;\"><IMG src="+url+" id=\"obrazek\" onload=\"window.resizeTo(this.width + 10,this.height + 30);window.moveTo(20,20);\"></body>");
    okno.document.close();
    okno.focus();
	void(0);

}

function zoomThis(obj){
	// x = obj.firstChild;
	msrc = obj.src;
	//bsrc = msrc.substring(0,msrc.length-4)+'_big.jpg';
	bsrc = msrc.replace(/m_/ig, "");

	zoomImg(bsrc,"Ilustracja");
	void(0);
}

/***********************************
   CSS CheckBox (c) UV design 2004
************************************/

function ChBswitch(obj) {
	ch = obj.firstChild;
	if (obj.className.indexOf("Off")==-1) {
		ch.checked = false;
		obj.className = obj.className.replace(/On$/g,"Off");
	}
	else {
		ch.checked = true;
		obj.className = obj.className.replace(/Off$/g,"On");
	}
}

/***********************************
   CSS RadioButton (c) UV design 2004
************************************/

function radioSwitch(obj) {
	r = obj.firstChild;

	allR = [];
	allR = document.getElementsByTagName('input');
	for (a = 0; a < allR.length; ++a) {
		if (allR[a].name == r.name && allR[a].type == 'radio') {
			allR[a].checked = false;
			pDiv = (allR[a].parentNode)?allR[a].parentNode:allR[a].parentElement;
			pDiv.className = pDiv.className.replace(/On$/g,"Off");
		}
	}
	obj.className = obj.className.replace(/Off$/g,"On");
	r.checked = true;
}


/***********************************
   dhtmlSelect (c) UV design 2004
   + IE5+,Gecko,Opera7+
   + onchange event support
************************************/

function dhtmlSelect() {
	var agt=navigator.userAgent.toLowerCase();
	var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);
	var is_gecko = (agt.indexOf('gecko') != -1);
    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_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_opera = (agt.indexOf("opera") != -1  || window.opera);
    var is_opera7up = (is_opera && document.getElementById);

	if (is_gecko || is_ie5up || is_opera7up) {

	outHtml = allS = tallS = [];
	var dg = 'document.getElementById';
	tallS = document.getElementsByTagName('select');

	for (a = 0; a < tallS.length; ++a) {
		allS[a] = {};
		allS[a].selectedIndex = tallS[a].selectedIndex;
		allS[a].onchange = tallS[a].onchange + '';
		allS[a].onchange = allS[a].onchange.replace(/this\.selectedIndex/g, dg+"('dhtmlSelectInput"+a+"').title");
		allS[a].onchange = allS[a].onchange.replace(/this/g, dg+"('dhtmlSelectInput"+a+"')");
		allS[a].onchange = allS[a].onchange.replace(/\n|function \w*\(\w*\)/g, "");
		allS[a].onchange = allS[a].onchange.replace(/"/g, "'");
		
		allS[a].value = tallS[a].value;
		allS[a].name = tallS[a].name;
		allS[a].parentNode = (tallS[a].parentNode)?tallS[a].parentNode:tallS[a].parentElement;
		allS[a].length = tallS[a].length;
		for (i = 0; i < tallS[a].length; ++i) {
			allS[a][i] = {};
			allS[a][i].value = (tallS[a][i].value)?tallS[a][i].value:tallS[a][i].text;
			allS[a][i].text = tallS[a][i].text;
		}
		
	}

	for (a = 0; a < allS.length; ++a) {
		//alert (a + ':' + allS[a].name);
		mTag = (is_gecko)?'a':'div';
		outHtml = '<'+mTag+' href="javascript:void(0);" class="selectSelector" ';
		if (is_opera7up) {
			outHtml += ' onmousedown="t='+dg+'(\'dhtmlSelectList'+a+'\');if(t.style.display==\'none\'){t.style.display=\'block\';this.style.zIndex=100;'+dg+'(\'dsItem'+a+'I\'+'+dg+'(\'dhtmlSelectInput'+a+'\').title).className=\'selectItemOn\'; }else {t.style.display=\'none\';this.style.zIndex=3;}" >';
			sdEvent = 'onclick';
			sdEvent = 'onmousedown';
		}
		else {
			outHtml += ' onmousedown="focus(this)" onfocus="t='+dg+'(\'dhtmlSelectList'+a+'\');if(t.style.display==\'none\')t.style.display=\'block\';else t.style.display=\'none\';this.style.zIndex=100;'+dg+'(\'dsItem'+a+'I\'+'+dg+'(\'dhtmlSelectInput'+a+'\').title).className=\'selectItemOn\';this.style.zIndex=100;" ';
			outHtml += ' onblur="'+dg+'(\'dhtmlSelectList'+a+'\').style.display=\'none\';this.style.zIndex=3;" >';
			sdEvent = 'onmousedown';
		}
		outHtml += '<input name="'+allS[a].name+'" value="'+allS[a].value+'" id="dhtmlSelectInput'+a+'" type="hidden" title="'+allS[a].selectedIndex+'">';
		outHtml += '<div id="dhtmlSelectLabel'+a+'" class="selectLabel" >';
		outHtml += allS[a][allS[a].selectedIndex].text+'</div>';
		outHtml += '<div style="position:absolute;z-index:3;width:100%">';
		outHtml += '<ul id="dhtmlSelectList'+a+'" style="z-index:4;position:absolute;left:-1;display:none;"';
		outHtml += ' class="selectList">';
		for (i = 0; i < allS[a].length; ++i) {
			outHtml += '<li id="dsItem'+a+'I'+i+'" ' ;
			outHtml += sdEvent+'="'+dg+'(\'dhtmlSelectInput'+a+'\').title=\''+i+'\';dsOVal='+dg+'(\'dhtmlSelectInput'+a+'\').value;'+dg+'(\'dhtmlSelectInput'+a+'\').value=\''+allS[a][i].value+'\';';
			outHtml += dg+'(\'dhtmlSelectLabel'+a+'\').innerHTML=this.innerHTML;if (dsOVal != \''+allS[a][i].value+'\') '+allS[a].onchange+';this.parentNode.style.display=\'none\';" onclick="this.parentNode.style.display=\'none\'"';
			outHtml += ' onmouseover="'+dg+'(\'dsItem'+a+'I\'+'+dg+'(\'dhtmlSelectInput'+a+'\').title).className=\'selectItemOff\';this.className=\'selectItemOn\'" onmouseout="this.className=\'selectItemOff\'"';
			outHtml += ' class="selectItemOff">'+allS[a][i].text+'</li>';
		}
		outHtml += '</ul></div></'+mTag+'>';
		allS[a].parentNode.innerHTML=outHtml;
	}
	}

}

//  opera nie rozumie position:absolute;top:50% jesli height nie jest zdefiniowane, tu jej to tłumaczymy

function operaFix() {

		allDiv = [];
		allDiv = document.getElementsByTagName('div');
		for (a = 0; a < allDiv.length; ++a) {
			if (allDiv[a].className != 'of' && allDiv[a].className != 'f'  && allDiv[a].className != 'fhead') continue;
			//alert (allDiv[a].scrollHeight);
			allDiv[a].style.height = allDiv[a].scrollHeight + 'px';
			chB = allDiv[a].firstChild; while (chB.nodeType != 1) chB = chB.nextSibling;
			if (chB.className == 'checkboxOff' || chB.className == 'checkboxOn' || (chB.className == 'middle' && is_opera)) {
				chB.style.top = parseInt(allDiv[a].scrollHeight/2)+'px'; //"50%"; opera 7.1 nie łyka procentów
			}
		}

}

function init() {
	dhtmlSelect();	// podmiana selektów
	operaFix();		// korekty dla opery
}
window.onload = init;

function onClickClear(tagName) {
	if (typeof tagName == 'undefined') tagName = 'input';
	allInp = [];
	allInp = document.getElementsByTagName(tagName);
	for (a = 0; a < allInp.length; ++a) {
		
		if (allInp[a].type == 'text' || tagName == 'textarea') {
			allInp[a].memory = new String();
			allInp[a].onfocus = function () {
				if (this.memory == '') {
					this.memory = this.value;
					this.value = '';
				}
			}
			allInp[a].onblur = function () {
				if (this.value == '' && this.memory != '') {
					this.value = this.memory;
					this.memory = '';
				}
			}
		}
	}
}


function printWithPrv() {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.media == 'print') {
			a.media = "all";

			print();
			window.onfocus = function () {
					var i, a;
					for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
						if(a.getAttribute("rel").indexOf("style") != -1 && a.title && a.title == 'print') {
						a.media = "print";
					}
				}
			}
		}
	}
	void(0);
}

function printWindow (path,Xsiz,Ysiz) {
	p = window.open(path, 'printWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,fullscreen=no,channelmode=no,width='+Xsiz+',height='+Ysiz+',top=10,left=10');
	p.focus();
	void(0);
}