function changeCena(cena)
{
	var suma = document.getElementById('sumazam').innerHTML;
	cena = parseFloat(cena);
	suma = parseFloat(suma);

	var cenapok = cena.toFixed(2);
 
 
	if (document.getElementById('checkprezent').checked == true)
	{
		liczba=suma+cena;
		document.getElementById('cenaprezentu').innerHTML=cenapok;
	}
	else
	{
		liczba=suma-cena;
		document.getElementById('cenaprezentu').innerHTML='0';	
	}
 
	var result = liczba.toFixed(2);
	document.getElementById('sumazam').innerHTML = result;
 
}
 
function PrzeliczCene(cena, suma, Gratis1, Gratis2, DostawaFree1, DostawaFree2,Mode) {

	// alert('cena: '+cena);
	// alert('suma: '+suma);
	//alert('DostawaFree1: '+DostawaFree1);
	//alert('DostawaFree2: '+DostawaFree2);
	//alert('Gratis1: '+Gratis1);
	//alert('Gratis2: '+Gratis2);
	
	cena = parseFloat(cena);
	suma = parseFloat(suma);
	
	
	cenadodost1 = DostawaFree1-suma;
	cenadodost2 = DostawaFree2-suma;
	
	cenadodost1 = cenadodost1.toFixed(2);
	cenadodost2 = cenadodost2.toFixed(2);
						
	//alert ('cenadodost1'+cenadodost1);
	//alert ('cenadodost2'+cenadodost2);					
						
	if (cena != Gratis2) {
		if (cenadodost1 > 0) {
			dostawa = "<div style=\"width: 100%; height:28px; color:red; text-align: right;\"><i>Zamów jeszcze za minimum "+cenadodost1+" zł, a wysyłkę otrzymasz gratis.</i></div>";
		} else {
			dostawa = '';
		}
	} else {
		if (cenadodost2 > 0) {
			dostawa = "<div style=\"width: 100%; height:28px; color:red; text-align: right;\"><i>Zamów jeszcze za minimum "+cenadodost2+" zł, a wysyłkę otrzymasz gratis.</i></div>";
		} else {
			dostawa = '';
		}
	}
	liczba = cena + suma;
 
	var result = liczba.toFixed(2);
	var cena = cena.toFixed(2);

	if (Mode != 1) {
		el = document.getElementById("sumazam");
		el.innerHTML = result;
		if (cena != '0.00') {
			el = document.getElementById("cenadost").innerHTML = cena + ' zł';
		} else {
			el = document.getElementById("cenadost").innerHTML = 'GRATIS !';
		}
	}
	
	el = document.getElementById("dostawa4free").innerHTML = dostawa;
}
 
function ZaznaczBox(idzan)
{
 var all = document.getElementById('all'+idzan).value;
 
 if (document.getElementById('gl'+idzan).checked == true) 
 {
  for (i = 1; i <= all; i++) 
  {
   document.getElementById('zaint'+idzan+'_'+i).checked = true;  
  }
 }
 else 
 {
  for (i = 1; i <= all; i++) 
  {
   document.getElementById('zaint'+idzan+'_'+i).checked = false;
  }
 }
 
}
 
function DisplayPlatnosci(id)
{
    var div = document.getElementById('DivPlatnosci');
 
 if (id == 3) div.style.display = "block";
 else div.style.display = "none";
}
 
function MM_jumpMenu(targ,selObj,restore)
{ //v3.0
 eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value+"'");
 if (restore) selObj.selectedIndex=0;
}
 
function ShowHide(id,ilosc) 
{
  var divtemp;
  var div=document.getElementById('podkategorie'+id);
  if(div.style.display == "none") div.style.display = "block";
  //else div.style.display = "none";
  
  
  for(i=1; i<=ilosc; i++)
  {
   if(i!=id)
   {
    divtemp=document.getElementById("podkategorie"+i);
    divtemp.style.display = "none";
   }
  } 
}
 
function ShowHide2(nron)
{
 var stan;
 if (nron == 1)
 {
  document.getElementById("p1").style.display = "block"; 
  document.getElementById("p2").style.display = "none"; 
 }
 else
 {
  document.getElementById("p2").style.display = "block"; 
  document.getElementById("p1").style.display = "none"; 
 }
}
 

function DisplayDostawcy(id)
{
    var plat1 = document.getElementById('plat1');
 var plat2 = document.getElementById('plat2');
    var plat3 = document.getElementById('plat3'); 
 
 if( (id==1) || (id==4) )
 {
  plat1.disabled=true;  
  plat2.disabled=false;  
  plat3.disabled=true;  
  plat2.checked=true;  
 }
 if( (id==2) || (id==3) )
 {
  plat1.disabled=false;  
  plat2.disabled=true;  
  plat3.disabled=false;  
  plat1.checked=true;    
 }
 DisplayPlatnosci(2);
}

