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

window.onload = init;

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 ocq (obj,zm) {
		
		var inp = obj.parentNode.firstChild;
		trobj = obj.parentNode.parentNode;
		inp = inp.nextSibling;
		
		var tmpIl = parseInt(inp.value,10);

		var reszta = tmpIl%zm;

		if ((zm > 0) && (tmpIl < 999999) ) {
			inp.value = tmpIl + zm - reszta;
		}

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

			if ( reszta > 0 ) { inp.value = tmpIl - reszta; }
			else {	inp.value = tmpIl + zm; }
			

		}
		trobj.className = (inp.value > 0)?'wyr':'';


}



function switchModel(mid) {
	document.getElementById('cecha').value = mid;
	document.getElementById('pstan').innerHTML = typy[mid][0];
	document.getElementById('pcena').innerHTML = typy[mid][1];
}

function showSubMenu(obj,o) {
	var classn = o?'menuProd'+o:'menuProd';
	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 == classn) 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;
		}
	}
}


var xrozmiary = {'CO':['UK24','UK26','UK28','UK30','UK32','UK34','UK36','UK38','UK40','UK42'],
'BR':['UK24','UK26','UK28','UK30','UK32','UK34','UK36','UK38','UK40','UK42','UK44'],
'JRW':['6Y','8Y','10Y','12Y','14Y','16Y'],
'JRM':['6Y','8Y','10Y','12Y','14Y','16Y'],
'SH':['36','37','39','40','41','42','43','44','45','46','47','48']};

var grppath = {'CO':'/sklep/stroje_plywackie/damskie',
'BR':'/sklep/stroje_plywackie/meskie',
'JRW':'/sklep/stroje_plywackie/juniorskie_damskie',
'JRM':'/sklep/stroje_plywackie/juniorskie_meskie',
'SH':'/sklep/klapkibuty'}


function relrozm() {
if (document.getElementById('rgrp')) {
	var v = document.getElementById('rgrp').value
	
	var s = document.getElementById('rozm');

	s.options.length = 0;
	if (v) {
		s.style.display = '';
		s.options[0] = new Option('- wybierz rozmiar -','');
	}
	else {
		s.style.display = 'none';  
		s.options[0] = new Option('-----------','');
	}
	if (xrozmiary[v]) {
	for (var i = 0; i < xrozmiary[v].length; ++i) {
		if (v == 'JRW' || v == 'JRM') 
			s.options[(i+1)] = new Option(xrozmiary[v][i].replace('Y',' lat'),xrozmiary[v][i]);
		else
			s.options[(i+1)] = new Option(xrozmiary[v][i],xrozmiary[v][i]);
		if (selrozm.substr(1) == xrozmiary[v][i]) {
			s.selectedIndex = i+1;
		}
	}
	}
}

}

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

/* 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($) {
	/**
	 * equalizes the heights of all elements in a jQuery collection
	 * thanks to John Resig for optimizing this!
	 * usage: $("#col1, #col2, #col3").equalizeCols();
	 */
	 
	$.fn.equalizeCols = function(){
		var height = 0,
			reset = $.browser.msie ? "1%" : "auto";
  
		return this
			.css("height", reset)
			.each(function() {
				height = Math.max(height, this.offsetHeight);
			})
			.css("height", height)
			.each(function() {
				var h = this.offsetHeight;
				if (h > height) {
					$(this).css("height", height - (h - height));
				};
			});
			
	};
	
})(jQuery);

$(document).ready( function(){

	$('.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>');
		}

		
	});

	if ($.fn.colorbox) {

		$('a[rel=inline],a.colorbox_element').each(function(){

			var wm = this.className.match(/width-(\d+)/);
			var hm = this.className.match(/height-(\d+)/);
			var w = wm ? wm[1]+'px' : '850px';
			var h = hm ? hm[1]+'px' : '85%';
			
			$(this).colorbox({inline:true, href: this.href.replace(/.+#/,'#'), width: w, height: h, rel:'nofollow', close: 'Zamknij'});
		});


		$('a[rel=ajax]').each(function(){

			var wm = this.className.match(/width-(\d+)/);
			var hm = this.className.match(/height-(\d+)/);
			var w = wm ? wm[1]+'px' : '850px';
			var h = hm ? hm[1]+'px' : '85%';
			
			$(this).colorbox({href: this.href, width: w, height: h, rel:'nofollow', close: 'Zamknij'});
		});
		
		$('a[rel=iframe],a.colorbox_page').each(function(){

			var wm = this.className.match(/width-(\d+)/);
			var hm = this.className.match(/height-(\d+)/);
			var w = wm ? wm[1]+'px' : '850px';
			var h = hm ? hm[1]+'px' : '85%';
			
			$(this).colorbox({href: this.href, width: w, height: h, rel:'nofollow', 'iframe':true, close: 'Zamknij'});
		});

 		$('a[rel=lightbox],a[rel=colorbox]').colorbox({scalePhotos: true, maxWidth: '950px', maxHeight: '100%', close: 'Zamknij'});

	}
	else {

$(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'
   });
});

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

	$('img.actItemYoutube').remove();
	$("#homenews, #hhome").equalizeCols();
/*
	$("div.rounded").corner("7px keep");
	$("div.rounded-10").corner("10px keep");
	$("body.rungirl #subpage").corner("7px");
	*/
	//$.sifr({path:'/fonts'});
	//$('body.rungirl h2.title').sifr({font: '721th.swf'});

	$(document).pngFix();
	$('#gfx').cycle('fade');

	$('.menu-box p').hover(function(){

		$(this).animate({ top: "70px" }, 100);
	},
	function(){

		$(this).animate({ top: "110px" }, 100);
	}, 500);

	$("#menu ul span").click(function(){
		var nextel, a, pel, apel;
		pel = this;
		apel = [];
		$('ul.menu-l0 ul').addClass('tgl');
		while (pel.className != 'menu-l0') {
			if (pel.tagName == 'UL') $(pel).removeClass('tgl');
			pel = pel.parentNode;
		}
		
		
		nextel = this.parentNode.firstChild;
		while (nextel.nextSibling) {
			nextel = nextel.nextSibling;
			if (nextel.nodeType == 1 && nextel.tagName == 'UL') {
				$(nextel).removeClass('tgl');
				$('ul.menu-l0 ul.tgl').slideUp('slow');
				$(nextel).slideToggle('slow');
				this.blur();
				return false;
			}
		}
		return true;
		//if (this.parentNode.childNodes.length
	});

	
	$('.promo-slideshow').each(function() {

		promoSS.slides[promoSS.cnt] = {promoPause: false, promoStop: false};
		$(this).attr('rel',promoSS.cnt);
		$(this).after('<div class="promo-slideshow-navi" rel="'+promoSS.cnt+'" id="slnav'+promoSS.cnt+'">') 
		.cycle({ 
			fx:     'fade', 
			delay:  0, 
			timeout: 4000, 
			pager:  '#slnav'+promoSS.cnt,
			pauseOnPagerHover: true,
			onPagerEvent: function(zeroBasedSlideIndex, slideElement) {
				var i = parseInt($(slideElement.parentNode).attr('rel'));
				promoSS.slides[i].promoPause = true;
				promoSS.slides[i].promoStop = true;
			},
			after: function(currSlideElement, nextSlideElement, options, forwardFlag){
				var i = parseInt($(currSlideElement.parentNode).attr('rel'));
				if (promoSS.slides[i].promoPause == true) $(currSlideElement.parentNode).cycle('pause');
			}
		});

		$(this).mouseenter(function(){
			var i = parseInt($(this).attr('rel'));
			$(this).cycle('pause');
			promoSS.slides[i].promoPause = true;
		});
	
		$(this).mouseleave(function(){
			var i = parseInt($(this).attr('rel'));
			if (!promoSS.slides[i].promoStop) {
				$(this).cycle('resume');
				promoSS.slides[i].promoPause = false;
			}
		});
		++promoSS.cnt;
	});

});

var promoSS = {
	cnt: 0,
	slides: []
}




