    // 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); }


var lo = 1;
var url_pvid = [];
url_pvint = {};

function sof (a) {
	if (document.getElementById('foto' + lo)) document.getElementById('foto' + lo).style.display = 'none';
	document.getElementById('oferta' + lo).style.display = 'none';
	document.getElementById('lin' + lo).className = '';
	lo = a;
	if (document.getElementById('foto' + lo)) document.getElementById('foto' + lo).style.display = '';
	document.getElementById('oferta' + lo).style.display = '';
	document.getElementById('lin' + lo).className = 'selected';

}

function footReset() {
	f = document.getElementById('footer').style.position="relative";
	f = document.getElementById('footer').style.position="absolute";
	//alert('test');

}


function flash(name,src,x,y,ver,opcja) {
	

	if (opcja == 'w3c') {
		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 ('</object>');
	}
	else {

		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 setSize() {

	ww = (window.innerWidth)?window.innerWidth:document.body.clientWidth
	if (ww>800) {
		document.getElementById('container').style.marginLeft = '-490px';
		document.getElementById('container').style.width = '980px';
	}
	else {
		document.getElementById('container').style.marginLeft = '-389px';
		document.getElementById('container').style.width = '954px';
	}
}


function oW (path,Xsiz,Ysiz,popUnder) {
	var przed = '';
	if (!(Xsiz > 0)) { Xsiz = 450; }
	if (!(Ysiz > 0)) { Ysiz = 300; }
	w = 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');
	if (popUnder) {
		w.blur();
		window.focus();
	}
	else {
		w.focus();
	}
	void(0);
}



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 :"";
    wygasnie.setTime(dzisiaj.getTime()+1000*60*60*24*dni);
	document.cookie=nazwa+"="+escape(wartosc)+";expires="+wygasnie.toGMTString();
}

function sClear(obj,itxt) {
	if (obj.value == itxt) obj.value = '';
}
function sReturn(obj,itxt) {
	if (obj.value == '') obj.value = itxt;
}

function init() {
	

}

function el(x) { return document.getElementById(x); }

function edOpts(s,tf,n) {	
	for (var i=1, option; option = s.options[i]; i++) {
		if ((n != null && option.value == n) || n == null) {
			 option.disabled = tf;
			 if (tf == true && s.selectedIndex == i) s.selectedIndex = 0;
		} 
	}
}

function switchZest(tv) {

	el('ztypl').style.display=(tv)?'':'none';
	edOpts(el('ztyp'),false);
	//alert (tv.substr(1) + '::' + tv.substr(0,1));
	//if (tv.substr(0,1) == '-') {
	//	edOpts(el('ztyp'),true,tv.substr(1));
	//}
	edOpts(el('ztyp'),true,tv);
}


function cq (kod,zm) {

		var tmpIl = eval( "document.grupa[\"il["+kod+"]\"].value;");

		++tmpIl;

		--tmpIl;

		reszta = tmpIl%zm;

		if ((zm > 0) && (tmpIl < 999999) ) {

			eval( "document.grupa[\"il["+kod+"]\"].value = tmpIl + zm - reszta;");

		}

		else if ((zm < 0) && (tmpIl > 0)){

			if ( reszta > 0 ) { eval( "document.grupa[\"il["+kod+"]\"].value = tmpIl - reszta;"); }

			else {	eval( "document.grupa[\"il["+kod+"]\"].value = tmpIl + zm;"); }

		}

	if (document.getElementById('zzm')) {

			

			document.getElementById('zzm').className  = "bma";

		}

}



function rq (kod,zm) {

		var tmpIl = eval( "document.grupa[\"il["+kod+"]\"].value;");

		++tmpIl;

		--tmpIl;

		reszta = tmpIl%zm;

		if (!(tmpIl >= 0)) {

			alert ("Wprowadzono nie poprawna wartosc!");

			eval( "document.grupa[\"il["+kod+"]\"].value = 0;");

		}

		else if (reszta > 0) {

			alert ("Ilosc musi byæ wielokrotnoscia liczby "+zm);

			eval( "document.grupa[\"il["+kod+"]\"].value = tmpIl - reszta;");

		}

		if (document.getElementById('zzm')) {

			

			document.getElementById('zzm').className  = "bma";

		}



}


function switchModel(mid) {

	document.getElementById('pstan').innerHTML = typy[mid][0];
	document.getElementById('pcena').innerHTML = typy[mid][1];
	document.getElementById('bcena').innerHTML = typy[mid][2];
	document.getElementById('addtocardbtn').style.display = (typy[mid][3])?'block':'none';
}

function showSubMenu(obj) {

	if (document.getElementsByTagName)
		var x = document.getElementsByTagName('ul');
	else if (document.all)
		var x = document.all.tags('ul');
	for (var i=0;i<x.length;i++) 
		if (x[i].className == 'menuProd') x[i].style.display = "none";


	kids = obj.childNodes;
 	for (var i = 0; i < kids.length; i++) {
 

		t = kids[i].tagName;
 		if (t == 'UL') {

			kids[i].style.display = "";
			break;
		}
 
	}

	void(0);
}


function clearOpts(os) {
	for(a = 1; a <= 5; ++a) {
		if (a != os && document.getElementById('cecha'+a)) {
			s = document.getElementById('cecha'+a);
			s.options.length = 0;
		}
	}
}



/* Made by Mathias Bynens <http://mathiasbynens.be/> */
function number_format(a, b, c, d) {
 if (b == null) b = 2;
 if (c == null) c = ',';
 if (d == null) d = ' ';
 a = Math.round(a * Math.pow(10, b)) / Math.pow(10, b);
 e = a + '';
 f = e.split('.');
 if (!f[0]) {
  f[0] = '0';
 }
 if (!f[1]) {
  f[1] = '';
 }
 if (f[1].length < b) {
  g = f[1];
  for (i=f[1].length + 1; i <= b; i++) {
   g += '0';
  }
  f[1] = g;
 }
 if(d != '' && f[0].length > 3) {
  h = f[0];
  f[0] = '';
  for(j = 3; j < h.length; j+=3) {
   i = h.slice(h.length - j, h.length - j + 3);
   f[0] = d + i +  f[0] + '';
  }
  j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3));
  f[0] = j + f[0];
 }
 c = (b <= 0) ? '' : c;
 return f[0] + c + f[1];
}

function array_search(igla,stog) {
	var a;
	for(a in stog) {
		if (stog[a] == igla) return true;
	}
	return false;
}

function searchRozm(v) {
	var grp = document.getElementById('rgrp').value
	if (v) document.location.href =	grppath[grp]+'/query-rozmiary,*2F'+v+'.html';
}

$(document).ready( function(){
	$("#menu, #page, #right").equalizeCols();

	$("div.rounded").corner();
	$("div.rounded-right").corner("tr br");
	$(".rounded-small").corner("5px keep");
	$(".rounded-small-bottom").corner("br bl 5px keep");
	$("div.rounded-top").corner("tr tl 8px");
	
	$('.sp-kill').hide();
	$('.display-none').hide();
	$('.sp-kill input').val('nospam');

	$('img.actItemYoutube').each(function(){
		if (this.alt != '') {
			$(this).after('<object type="application/x-shockwave-flash" style="width: ' + this.width + 'px; height:' + this.height + 'px;" data="' + this.alt + '"><param name="movie" value="' + this.alt + '" /><param name="wmode" value="transparent" /></object>');
		}

		
	});

	$('a.login-required').click(function() {
		this.innerHTML = $(this).attr('nicetitle');
		return false;
	});

	$('img.actItemYoutube').remove();
	

	if (url_pvid.length > 0) {
	$('select.pvselect').each(function() {
		for (a in this.options) {
			if (array_search(this.options[a].value,url_pvid)) {
				this.value = this.options[a].value;
				break;
			}
		}
	});
	}
	for(a in url_pvint) {
		$('select.pvselect[name='+a+']').val(url_pvint[a])
	}

});

$(function() {
   $('a[@rel*=lightbox]').lightBox({
	overlayBgColor: '#000',
	overlayOpacity: 0.7,
	imageLoading: '/img/lb/lightbox-ico-loading.gif',
	imageBtnClose: '/img/lb/closelabel.gif',
	imageBtnPrev: '/img/lb/prev.gif',
	imageBtnNext: '/img/lb/next.gif',
	containerResizeSpeed: 350,
	txtImage: 'Ilustracja',
	txtOf: 'z'
   });
});

jQuery(function(){
	jQuery('ul.sf-menu').superfish();
});


function pvfilter(c) {
	var pvid = '';
	var pvint = '';
	var pvsep = '';
	var sep = '';
	$('select.pvselect').each(function() {
		if (this.value) {
			if (this.value.indexOf('t') != -1) {
				pvint += sep + 'pvint-'+this.name+','+this.value
				sep = ',';
			}
			else {
				pvid += pvsep + this.value;
				pvsep = '-';
			}
		}
	});
	if (pvid != '') pvid = 'pvid,'+pvid;
	var prd = $('select[name=producent]').val();
	if (prd != '') pvid += (pvid?',':'')+'eq-producent,'+prd;
	if (pvint != '') pvid += (pvid?',':'')+pvint;
	if (pvid) {
		document.location.href=c+pvid+'.html';
	}
	else document.location.href = c;
}