/*
window.addEvent("domready",function(){
	var efekt = new Accordion('h2.zakladkaProdukt', 'div.trescZakladki',
			{
				opacity: true
			}, 
			'div.zalkadkiProduktu');
});


window.addEvent("domready",function(){
	var efekt = new Accordion('h2.zakladkaProdukt', 'p.trescZakladki', {
		opacity: true,
		onActive: function(toggler){
			new Fx.Styles(toggler).start({
				"background-color" : "#FFF"
			});
		},
		onBackground: function(toggler){
			new Fx.Styles(toggler).start({
				"background-color": "#EFEFEF"
			});		
		}
	},'div.zalkadkiProduktu');
});
*/
jQr(document).ready(function(){  
	jQr("#fCartAddProduct").bind("click", function() {
		
		var ilosc = jQr("#fProductCount").val();
		var opcja = jQr("#fWybierzOpcje").val();
		var prodID = jQr("#fProductId").val();
		
		jQr.fancybox.showActivity();
		jQr.ajax({
			type	: "POST",
			cache	: false,
			url		: "koszyk_dodaj.php",
			data	: "fProductCount=" + ilosc + "&fProductOptions=" + opcja + "&fProductId=" + prodID,
			success: function(data) {
				jQr.fancybox(
					data,
					{
						'titleShow'     : false,
						'transitionIn'	: 'elastic',
						'transitionOut'	: 'elastic',
						'easingIn'      : 'easeOutBack',
						'speedIn'		: 500, 
						'speedOut'		: 200,
						'autoScale'		: false,
						'width'			: 375,
						'height'		: 200,
						'overlayOpacity': 0.8
					}
				);
			}
		});
		
		return false;
	});
		
});

function dodajPrzechowalnia(prodID) {
	
	jQr.fancybox.showActivity();
	jQr.ajax({
		type	: "POST",
		cache	: false,
		url		: "przechowalnia_dodaj.php",
		data	: "fProductId=" + prodID,
		success: function(data) {
			jQr.fancybox(
				data,
				{
					'titleShow'     : false,
					'transitionIn'	: 'elastic',
					'transitionOut'	: 'elastic',
					'easingIn'      : 'easeOutBack',
					'speedIn'		: 500, 
					'speedOut'		: 200,
					'autoScale'		: false,
					'width'			: 375,
					'height'		: 200,
					'overlayOpacity': 0.8
				}
			);
		}
	});
	
	return false;
	
}

function dodajProduktBox() {
	
	var ilosc = jQr("#fProductCountBox").val();
	var opcja = jQr("#fWybierzOpcjeBox").val();
	var prodID = jQr("#fProductIdBox").val();
	
	jQr.fancybox.showActivity();
	jQr.ajax({
		type	: "POST",
		cache	: false,
		url		: "koszyk_dodaj.php",
		data	: "fProductCount=" + ilosc + "&fProductOptions=" + opcja + "&fProductId=" + prodID,
		success: function(data) {
			jQr.fancybox(
				data,
				{
					'titleShow'     : false,
					'transitionIn'	: 'elastic',
					'transitionOut'	: 'elastic',
					'easingIn'      : 'easeOutBack',
					'speedIn'		: 500, 
					'speedOut'		: 200,
					'autoScale'		: false,
					'width'			: 375,
					'height'		: 200,
					'overlayOpacity': 0.8
				}
			);
		}
	});
	
	return false;	
}


function dodajProduktBoxPrzech(prodID) {
	
	var ilosc = 1;
	var opcja = 0;
	
	jQr.fancybox.showActivity();
	jQr.ajax({
		type	: "POST",
		cache	: false,
		url		: "koszyk_dodaj.php",
		data	: "fProductCount=" + ilosc + "&fProductOptions=" + opcja + "&fProductId=" + prodID,
		success: function(data) {
			jQr.fancybox(
				data,
				{
					'titleShow'     : false,
					'transitionIn'	: 'elastic',
					'transitionOut'	: 'elastic',
					'easingIn'      : 'easeOutBack',
					'speedIn'		: 500, 
					'speedOut'		: 200,
					'autoScale'		: false,
					'width'			: 375,
					'height'		: 200,
					'overlayOpacity': 0.8
				}
			);
		}
	});
	
	return false;	
}

function textCounter( maxlimit) 
{
	if (document.getElementById('tresckartki').value.length > maxlimit) document.getElementById('tresckartki').value = document.getElementById('tresckartki').value.substring(0, maxlimit);
	else document.getElementById('iloscznakow').innerHTML = maxlimit - document.getElementById('tresckartki').value.length;
}

function textCounterReklamacje(id, maxlimit) 
{
	if (document.getElementById(id).value.length > maxlimit) document.getElementById(id).value = document.getElementById(id).value.substring(0, maxlimit);
	else document.getElementById('iloscznakow').innerHTML = maxlimit - document.getElementById(id).value.length;
}

function wlaczCheckbox(ilosc)
{
	if (document.getElementById('placwk').checked==true) stan='block';
		else stan='none';
	
	for (i=1; i<=ilosc; i++)
	{
		if (document.getElementById('checkzam'+i))document.getElementById('checkzam'+i).style.display = stan; 
	}
}

function podmienCeneProd()
{
	opcja = document.getElementById('fWybierzOpcje').value;
	if (opcja==0) return ''; 
	
	cena = document.getElementById('opcCena'+opcja).value;
	
	cena = parseFloat(cena);
	if (cena>0) document.getElementById('CenaProdukty').innerHTML = '<table style="float:right; margin-right:10px;"><tr><td valign="bottom" style=" font-size:12px; color: #777A81; font-weight:bold;">Cena:</td><td><span id="cenaProd" style="color:#000000; font-size:25px; ">'+ cena +'</span> <span style="color:#000000; font-size:14px;">PLN</span></td></tr></table>'
}

function zmienSume(wartosc)
{
	wartosc=parseFloat(wartosc);
	wysylka = document.getElementById('selDost').value;
	
	paczka = document.getElementById('selPaczka').value;
	
	iloscprod = document.getElementById('iloscProd').value; 
	iloscprod=parseFloat(iloscprod);
	
	kwotaWys = document.getElementById('kosztWys'+wysylka).value;
	gratisWys = document.getElementById('gratisOd'+wysylka).value;
	
	kwotaWys=parseFloat(kwotaWys);
	gratisWys=parseFloat(gratisWys);
	
	kwotaPaczki = document.getElementById('kosztOpak'+paczka).value;
	kwotaPaczki=parseFloat(kwotaPaczki);
	//kwotaPaczki = kwotaPaczki*iloscprod;
	
	if (wysylka=='4' || wysylka=='5') 
	{
		document.getElementById('formaopakowania').style.display='block';
		document.getElementById('kartkazzycz').style.display='block';
	}
	else 
	{
		document.getElementById('formaopakowania').style.display='none';
		document.getElementById('kartkazzycz').style.display='none';
		kwotaPaczki = 0;
	}
	
	if (document.getElementById('kartka').checked == true && (wysylka=='4' || wysylka=='5')) kwotaKartki = document.getElementById('kosztKartki').value;
	else kwotaKartki=0;
	
	kwotaKartki=parseFloat(kwotaKartki);
	
	suma = wartosc + kwotaWys + kwotaPaczki + kwotaKartki;
	suma=parseFloat(suma);
		
	document.getElementById('kosztWysylki').innerHTML = kwotaWys+' PLN';
	document.getElementById('kosztOpakowania').innerHTML = kwotaPaczki+' PLN';
	document.getElementById('sumaKoszyk').innerHTML = Numbers.Round(suma, 2);
	
	if ( kwotaWys > 0 ) { 
		doDarmowej = Numbers.Round( (gratisWys - wartosc) , 2);
		
		if ( doDarmowej <= 50 ) { 
			document.getElementById('darmowaWysylkaInfo').innerHTML = 'Do darmowej przesyłki brakuje Ci zakupów za: <span style="font-size: 12px; font-weight: bold; color:#FF6600">' + doDarmowej + ' PLN</span>';
			document.getElementById('darmowaWysylkaInfo2').innerHTML = 'Pamiętaj, że jeśli suma Twoich zakupów przekroczy <span style="color:#FF6600">' + gratisWys + ' zł</span> koszt przesyłki pokryje sklep<br />' + 
			'Do otrzymania darmowej przesyłki brakuje Ci zakupów za: <span style="font-size: 12px; font-weight: bold; color:#FF6600">' + doDarmowej + ' PLN</span>';
			j("#darmowaWysylkaProdukt").show();
		} else {
			document.getElementById('darmowaWysylkaInfo').innerHTML = '';
			document.getElementById('darmowaWysylkaInfo2').innerHTML = '';
			j("#darmowaWysylkaProdukt").hide();
		}
	} else {
		document.getElementById('darmowaWysylkaInfo').innerHTML = '';
		document.getElementById('darmowaWysylkaInfo2').innerHTML = '';
		j("#darmowaWysylkaProdukt").hide();
	}
	
	jqueryToggle('formZyczenia', 'kartka');
}

function sprKupTaniej()
{
	opcja1 = opcja2 = opcja3 = 0

	if (document.getElementById('wybOpcjKup1'))
	{
	 if (document.getElementById('wybOpcjKup1').value==0) 
	 {
	 	alert('Proszę wybrać opcję produktu!!');
	 	return false;
	 }
	}
	
	if (document.getElementById('wybOpcjKup2')) 
	{
	 if (document.getElementById('wybOpcjKup2').value==0) 
	 {
	 	alert('Proszę wybrać opcję produktu!!');
	 	return false;
	 }
	}
	
	if (document.getElementById('wybOpcjKup3')) 
	{
	 if (document.getElementById('wybOpcjKup3').value==0) 
	 {
	 	alert('Proszę wybrać opcję produktu!!');
	 	return false;
	 }
	}

}

function obliczKupTaniej()
{
	opcja1 = opcja2 = opcja3 = 0
	cenaRabat1 = cena1 = cenaRabat2 = cena2 = cenaRabat3 = cena3 = 0;
	
	if (document.getElementById('wybOpcjKup1')) opcja1 = document.getElementById('wybOpcjKup1').value;
	if (document.getElementById('wybOpcjKup2')) opcja2 = document.getElementById('wybOpcjKup2').value;
	if (document.getElementById('wybOpcjKup3')) opcja3 = document.getElementById('wybOpcjKup3').value;	
	
	
	if (opcja1>0) 
	{
		cena1 = document.getElementById('opcCenaOrg'+opcja1).value;
		cenaRabat1 = document.getElementById('opcCenaRabat'+opcja1).value;
		
		document.getElementById('normal1').innerHTML = cena1+' PLN';
		document.getElementById('komplet1').innerHTML = cenaRabat1+' PLN';
	}
	else if (document.getElementById('cenaOrg1'))
	{
		cena1 = document.getElementById('cenaOrg1').value;
		cenaRabat1 = document.getElementById('CenaRabat1').value;
	}
	
	
	if (opcja2>0) 
	{
		cena2 = document.getElementById('opcCenaOrg'+opcja2).value;
		cenaRabat2 = document.getElementById('opcCenaRabat'+opcja2).value;
		
		document.getElementById('normal2').innerHTML = cena2+' PLN';
		document.getElementById('komplet2').innerHTML = cenaRabat2+' PLN';
	}
	else if (document.getElementById('cenaOrg2'))
	{
		cena2 = document.getElementById('cenaOrg2').value;
		cenaRabat2 = document.getElementById('CenaRabat2').value;
	}
	
	if (opcja3>0) 
	{
		cena3 = document.getElementById('opcCenaOrg'+opcja3).value;
		cenaRabat3 = document.getElementById('opcCenaRabat'+opcja3).value;
		
		document.getElementById('normal3').innerHTML = cena3+' PLN';
		document.getElementById('komplet3').innerHTML = cenaRabat3+' PLN';
	}
	else if (document.getElementById('cenaOrg3'))
	{
		cena3 = document.getElementById('cenaOrg3').value;
		cenaRabat3 = document.getElementById('CenaRabat3').value;
	}
	
	cena1 = parseFloat(cena1);
	cena2 = parseFloat(cena2);
	cena3 = parseFloat(cena3);
	
	cenaRabat1 = parseFloat(cenaRabat1);
	cenaRabat2 = parseFloat(cenaRabat2);
	cenaRabat3 = parseFloat(cenaRabat3);
	
	sumaCena = cena1+cena2+cena3;
	SumaRabat = cenaRabat1+cenaRabat2+cenaRabat3;
	
	sumaCena = parseFloat(sumaCena);
	SumaRabat = parseFloat(SumaRabat);
	
	sumaCena = (Math.round(sumaCena*100)/100);
	SumaRabat = (Math.round(SumaRabat*100)/100);
	
	document.getElementById('sumaNormal').innerHTML = sumaCena+' PLN';
	document.getElementById('sumaKomplet').innerHTML = SumaRabat+' PLN';
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function podmienObrazek(srckolor, idkol, srcbig)
{
	
	document.getElementById('produktGlowny').src = srckolor;
	document.getElementById('prodGlID').href = srcbig;	
	
	

	for (i=1; i<=14; i++)
	{
		if (document.getElementById('DivKolor'+i))
		{
			document.getElementById('DivKolor'+i).style.border = '2px';
			document.getElementById('DivKolor'+i).style.borderColor = '#ffffff';
			document.getElementById('DivKolor'+i).style.borderStyle = 'solid';
		}
	}
	
	if ( document.getElementById('DivKolor'+idkol) ) {
		document.getElementById('DivKolor'+idkol).style.border = '2px';
		document.getElementById('DivKolor'+idkol).style.borderColor = '#E36E1F';
		document.getElementById('DivKolor'+idkol).style.borderStyle = 'solid';
	}
}

function zmienTabelke(stan)
{
	
	for(i=1; i<=5; i++)
	{
		if (document.getElementById('imgzakladki' + i)) document.getElementById('imgzakladki' + i).style.backgroundImage = 'url("images/tabprod' + i + '_off.jpg")';
		if (document.getElementById('zakladkaTabelki' + i)) document.getElementById('zakladkaTabelki' + i).style.display = 'none';
	}
	
	document.getElementById('zakladkaTabelki' + stan).style.display = 'block';
	document.getElementById('imgzakladki' + stan).style.backgroundImage = 'url("images/tabprod' + stan + '_on.jpg")';
}


function RozwinKoszykPrzechowalnie(wlacz,wylacz)
    {
    document.getElementById(wlacz).style.display = "block";
    document.getElementById(wylacz).style.display = "none";
	
	if ( wlacz == 'BoxKoszyk') {
		document.getElementById('ZakladkaKoszyk').src = "images/btn_koszyk2.jpg";
		document.getElementById('ZakladkaPrzechowalnia').src = "images/btn_przechowalnia2.jpg";
		document.getElementById('zakladka1').style.display = "block";
		document.getElementById('zakladka2').style.display = "none";
	} else {
		document.getElementById('ZakladkaKoszyk').src = "images/btn_koszyk3.jpg";
		document.getElementById('ZakladkaPrzechowalnia').src = "images/btn_przechowalnia3.jpg";
		document.getElementById('zakladka2').style.display = "block";
		document.getElementById('zakladka1').style.display = "none";
	}
	
	document.getElementById('zakladka1').style.borderLeft = "1px solid #d1d5e0";
	document.getElementById('zakladka1').style.borderRight = "1px solid #d1d5e0";
	document.getElementById('zakladka1').style.width = "293px";	 
	
	document.getElementById('zakladka2').style.borderLeft = "1px solid #d1d5e0";
	document.getElementById('zakladka2').style.borderRight = "1px solid #d1d5e0";
	document.getElementById('zakladka2').style.width = "293px";
	
    }

function ZwinKoszykPrzechowalnie(wylacz)
    {
    document.getElementById(wylacz).style.display = "none";
	
	document.getElementById('zakladka1').style.borderLeft = "0px";
	document.getElementById('zakladka1').style.borderRight = "0px";
	document.getElementById('zakladka1').style.width = "295px";
	
	document.getElementById('zakladka2').style.borderLeft = "0px";
	document.getElementById('zakladka2').style.borderRight = "0px";
	document.getElementById('zakladka2').style.width = "295px";
    }
	
function Menu(id, style, otworz, wysun, czasRozwin, czasZwin, czasOtworz, czasZamknij, nieInicjalizuj)
{
	if (typeof czasRozwin == 'undefined' || czasRozwin < 0) czasRozwin = 0;
	if (typeof czasZwin == 'undefined' || czasZwin < 0) czasZwin = 0;
	if (typeof czasOtworz == 'undefined' || czasOtworz < 0) czasOtworz =0;
	if (typeof czasZamknij == 'undefined' || czasZamknij < 0) czasZamknij = 0;
	
	var url = unescape(window.location.href);
	var base = window.location.protocol + '//' + window.location.host + window.location.pathname.replace(/[^\/\\]+$/, '');
	
	if (style)
	{
		if (style.indexOf(':') < 0)
		{
			document.getElementById(id).className += ' ' + style;
		}
		else
		{
			style = style.replace(/(^\s+|(\s|;)+$)/g, '').split(/\s*;\s*/);
			for (var i = 0; i < style.length; i++)
			{
				style[i] = style[i].split(/\s*:\s*/);
				for (var j = 0, c, property = ''; j < style[i][0].length; j++)
				{
					c = style[i][0].charAt(j);
					property += c == '-' ? style[i][0].charAt(++j).toUpperCase() : c.toLowerCase();
				}
				eval('document.getElementById("' + id + '").style.' + property + ' = "' + style[i][1].replace(/"/g, '\\"') + '"');
			}
		}
	}
	
	for (var i = 0; i < document.getElementById(id).getElementsByTagName('dt').length; i++)
	{
		var dd = new Array();
		var el = document.getElementById(id).getElementsByTagName('dt')[i].nextSibling;
		var nodeName;
		while (el && (nodeName = el.nodeName.toLowerCase()) != 'dt')
		{
			if (nodeName == 'dd')
			{
				el._dt = document.getElementById(id).getElementsByTagName('dt')[i];
				if (otworz)
				{
					el.onmouseover = function()
					{
						clearTimeout(this._dt._timoutID);
						this._dt._displayed = false;
						this._dt.onclick();
					}
					el.onmouseout = function()
					{
						clearTimeout(this._dt._timoutID);
						var dt = this._dt;
						this._dt._timoutID = setTimeout(function () { dt._displayed = true; dt.onclick(); }, czasZamknij);
					};
				}
				dd[dd.length] = el;
			}
			el = el.nextSibling;
		}
		document.getElementById(id).getElementsByTagName('dt')[i]._dd = dd;
		document.getElementById(id).getElementsByTagName('dt')[i]._timoutID = null;
		document.getElementById(id).getElementsByTagName('dt')[i]._displayed = false;
		document.getElementById(id).getElementsByTagName('dt')[i].onclick = function()
		{
			clearTimeout(this._timoutID);
			if (!this._displayed)
			{
				var el = this.parentNode.getElementsByTagName('dt')[0];
				while (el)
				{
					if (el.nodeName.toLowerCase() == 'dt' && el != this)
					{
						el._displayed = false;
						if (czasZwin) display(el, 0);
						else display(el);
					}
					el = el.nextSibling;
				}
			}
			this._displayed = !this._displayed;
			if (this._displayed && czasRozwin || !this._displayed && czasZwin) display(this, 0);
			else display(this);
		};
		if (otworz)
		{
			document.getElementById(id).getElementsByTagName('dt')[i].onmouseover = function()
			{
				clearTimeout(this._timoutID);
				var dt = this;
				this._timoutID = setTimeout(function () { dt._displayed = false; dt.onclick(); }, czasOtworz);
			};
			document.getElementById(id).getElementsByTagName('dt')[i].onmouseout = function()
			{
				clearTimeout(this._timoutID);
				var dt = this;
				this._timoutID = setTimeout(function () { dt._displayed = true; dt.onclick(); }, czasZamknij);
			};
		}
	}
	
	start(document.getElementById(id).getElementsByTagName('dt')[0]);
	
	function start(dt)
	{
		var hide = true;
		var el = dt;
		while (el)
		{
			var nodeName = el.nodeName.toLowerCase();
			if (nodeName == 'dt')
			{
				dt = el;
				hide = true;
			}
			if (nodeName == 'dt' || nodeName == 'dd')
			{
				if (!nieInicjalizuj && el.getElementsByTagName('a').length)
				{
					var active = el.getElementsByTagName('a')[0].href && unescape(el.getElementsByTagName('a')[0].href) == url;
					if (!active)
					{
						var rel = el.getElementsByTagName('a')[0].getAttribute('rel');
						if (rel)
						{
							var matches = (' ' + rel + ' ').match(/\s+Collection\(([^)]+)\)\s+/i);
							if (matches)
							{
								matches = matches[1].split(',');
								for (var k = 0; k < matches.length; k++)
								{
									if (/^[\/\\]/.test(matches[k])) matches[k] = window.location.protocol + '//' + window.location.host + matches[k];
									else if (!/^[a-z0-9]+:/i.test(matches[k])) matches[k] = base + matches[k];
									if (unescape(matches[k].replace(/[\/\\]\.([\/\\])/g, '$1').replace(/[^\/\\]+[\/\\]\.\.[\/\\]/g, '')) == url)
									{
										active = true;
										break;
									}
								}
							}
						}
					}
					if (active)
					{
						el.className = (el.className ? el.className + ' ' : '') + 'active';
						dt._displayed = true;
						display(dt);
						hide = false;
						var el_parentNode = el.parentNode;
						while (el_parentNode != document.getElementById(id))
						{
							if (el_parentNode.nodeName.toLowerCase() == 'dd')
							{
								var el_sibling = el_parentNode.previousSibling;
								while (el_sibling)
								{
									if (el_sibling.nodeName.toLowerCase() == 'dt')
									{
										el_sibling._displayed = true;
										display(el_sibling)
										break;
									}
									el_sibling = el_sibling.previousSibling;
								}
							}
							el_parentNode = el_parentNode.parentNode;
						}
					}
				}
			}
			if (nodeName == 'dd')
			{
				if (hide) el.style.display = 'none';
				start(el.getElementsByTagName('dt')[0]);
			}
			el = el.nextSibling;
		}
	}
	
	function display(dt, i)
	{
		if (typeof i == 'undefined')
		{
			for (var i = 0; i < dt._dd.length; i++)
			{
				dt._dd[i].style.display = dt._displayed ? 'block' : 'none';
				if (!dt._displayed)
				{
					for (var j = 0; j < dt._dd[i].getElementsByTagName('dt').length; j++)
					{
						dt._dd[i].getElementsByTagName('dt')[j]._displayed = false;
						display(dt._dd[i].getElementsByTagName('dt')[j]);
					}
				}
			}
		}
		else if (i < dt._dd.length)
		{
			var dir = wysun ? !dt._displayed : dt._displayed;
			var n = dir ? i : dt._dd.length - 1 - i;
			dt._dd[n].style.display = dt._displayed ? 'block' : 'none';
			if (!dt._displayed)
			{
				for (var j = 0; j < dt._dd[n].getElementsByTagName('dt').length; j++)
				{
					dt._dd[n].getElementsByTagName('dt')[j]._displayed = false;
					display(dt._dd[n].getElementsByTagName('dt')[j]);
				}
			}
			dt._timoutID = setTimeout(function() { display(dt, i + 1); }, dt._displayed ? czasRozwin : czasZwin);
		}
	}
}


	function pokazMenu ( idElementu, iloscElementow ) {
		
		element = document.getElementById('menu'+idElementu);
		link = document.getElementById('link'+idElementu);
		
		
		/* ukryj menu */
		for (i=1; i<=iloscElementow; i++) {
			if ( i != idElementu ) {
				document.getElementById('menu'+i).style.display = 'none';
				document.getElementById('link'+i).className = 'linkMenu';
			}
		}
		
		if ( element.style.display == 'none' ) {
			element.style.display = 'block';
			link.className = 'linkMenu2';
		} else {
			element.style.display = 'none';
			link.className = 'linkMenu';
		}
		
		
	}
	
	
	function ocena ( id ) {
		document.getElementById('twojaOcena').value = id;
		
		for ( i=1; i<=id; i++) {
			document.getElementById('glos'+i).src = 'images/gwiazdka_on.gif';
		}
		
		id = parseFloat(id)+1;
		
		for ( i=id; i<=5; i++) {
			document.getElementById('glos'+i).src = 'images/gwiazdka_off.gif';
		}

	}
	
	function jqueryToggle( iddiv, iddiv2 ) {
	 if ( document.getElementById(iddiv2).checked ) {
	 j("#"+iddiv).slideDown("slow");
	 } else {
	 j("#"+iddiv).slideUp("slow");
	 }
	}
	
/*	
	// teraz jest to w mootools. trzeba opracowac rozwijanie i zwijanie.
	function jqueryToggle( iddiv, iddiv2 ) {
		if ( document.getElementById(iddiv2).checked ) {
			var slider = new Fx.Slide(iddiv);
		} else {
			var slider = new Fx.Slide(iddiv);
		} 
	}
*/	
	
	function dodajOpinie() {
		
			lista  = document.getElementById('listaOpinii');
			dodaj = document.getElementById('dodajOpinie');
			btn = document.getElementById('btnOpinie');
			
			if ( dodaj.style.display == 'none' ) {
				dodaj.style.display = 'block';
				lista.style.display = 'none';
				btn.innerHTML = 'Wyświetl opinie';
				
			} else {
				dodaj.style.display = 'none';
				lista.style.display = 'block';
				btn.innerHTML = 'Dodaj opinie';
			}
		
	}
	
	function produktKoszykOn( id ) {
		document.getElementById('produkt' + id + '_zdjecie').style.border = '1px  solid #ff6600';
		document.getElementById('produkt' + id + '_odnosnik').style.color = '#ff6600';
	}
	
	
	function produktKoszykOff( id ) {
		document.getElementById('produkt' + id + '_zdjecie').style.border = '1px solid #ebeef3';
		document.getElementById('produkt' + id + '_odnosnik').style.color = '#464646';
	}
	
	/* otworz nowe okno - popup */
	function openWindow( adres ) {
		window.open(adres, 'okienko', 'menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=no, status=no,width=650, height=650');
	}

	function showSzczegolyOn (id) {
		document.getElementById('link'+id).style.textDecoration = 'underline';
		document.getElementById(id).src='images/strz_dol_on.gif';
		document.getElementById(id).style.cursor='pointer';
		document.getElementById('link'+id).style.color='#ff6600';
	}
	
	
	function showSzczegolyOff (id) {
		document.getElementById('link'+id).style.textDecoration = 'none';
		document.getElementById(id).src='images/strz_dol_off.gif';
		document.getElementById('link'+id).style.color='#000000';
	}
	
	function porownajKolor ( id ) {
		document.getElementById('divImage'+id).style.border = '3px solid #e2e3e5';
		document.getElementById('divImage'+id).style.padding = '1px 0px 1px 0px';
		document.getElementById('spanNazwa'+id).style.color = '#ff6700';
		
		document.getElementById('tdProducent'+id).style.color = '#ff6700';
		document.getElementById('tdProducent'+id).style.textDecoration = 'underline';
		
	}
	
	
	function porownajKolorOut ( id ) {
		document.getElementById('divImage'+id).style.border = '1px solid #e2e3e5';
		document.getElementById('divImage'+id).style.padding = '3px 2px 3px 2px';
		document.getElementById('spanNazwa'+id).style.color = '#1a1a1a';
		
		document.getElementById('tdProducent'+id).style.color = '#1a1a1a';
		document.getElementById('tdProducent'+id).style.textDecoration = 'none';
	}
	
	
	function porownajKolor2 ( id ) {
		document.getElementById('spanNazwa'+id).style.color = '#ff6700';
		
		
		document.getElementById('tdProducent'+id).style.textDecoration = 'underline';
		document.getElementById('tdProducent'+id).style.color = '#ff6700';
		
	}
	
	
	function porownajKolorOut2 ( id ) {
		document.getElementById('spanNazwa'+id).style.color = '#1a1a1a';
		
		
		document.getElementById('tdProducent'+id).style.textDecoration = 'none';
		document.getElementById('tdProducent'+id).style.color = '#1a1a1a';
	}
	
	function pokazZamowiome ( id ) {
		div = document.getElementById(id);
			
		if ( div.style.display == 'none' ) {
			div.style.display  = 'block';
		} else {
			div.style.display  = 'none';
		}
	}
	
	function sprawdzOpcje() {
		
		if ( document.getElementById('fWybierzOpcje') ) {
			if ( document.getElementById('fWybierzOpcje').value == "0" ) {
				alert("Wybierz opcję produktu.");
				return false;
			} else {
				return true;
			}
		} else {
			return true;
		}
	}
	

	function ocenProdukt ( idprod, ocena ) {
		var id = ocena;
				
		for ( i=1; i<=5; i++) {
			if ( i<= ocena ) {
				document.getElementById('prod_glos'+i).src = 'images/gwiazdka_on.gif';
			} else {
				document.getElementById('prod_glos'+i).src = 'images/gwiazdka_off.gif';
			}
		}
		
		
		j("#oceny").html('Czekaj...');
			
		j.ajax (
			{
				url: "ajax/ocenProdukt.php",
				data: "ocena="+ocena+"&idprod="+idprod,
				type: "GET",
				success: function(data){
					j("#oceny").html(data);
				},
				error: function(data){
					j("#oceny").html("Timeout error!");
				}

			}
		);
	}
	

/**
 * @author: Adrian Pietka
 */
var Numbers = {
	
	/**
	 * Ustawienia konfiguracyjne
	 */
	Config: {
		Glue: '.'
	},

	/**
	 * Przytnij liczbe do X miejsc po przecinku
	 */
	Round: function( number, round ) {
		var round = round + 1;
		var number_string = number.toString();
		
		var return_string = '';
		var iterator;
	
		for ( i=0; i < number_string.length; i = i + 1 ) {
			if ( number_string.charAt(i) == Numbers.Config.Glue ) {
				iterator = round;
			}
		
			if ( iterator == undefined || iterator > 0 ) {
				if ( iterator != undefined && iterator > 0 ) {
					iterator = iterator - 1;
				}
				
				return_string = return_string + number_string.charAt(i);
			} else {
				break;
			}
		}
		
		if ( iterator != undefined && iterator > 0 ) {
			for ( i=0; i < iterator; i = i + 1 ) {
				return_string = return_string + "0";
			}
		}
		
		return parseFloat( return_string );
	}
}