//--------------------------------------------------------------------
//                   KOSZYK
//--------------------------------------------------------------------
function dodaj_do_koszyka(co, ile, za_ile, sid, przedrostek)
{
  	advAJAX.get({
  		url:przedrostek+"koszyk.php",
  		onSuccess:
		 function(o)
		  {
		   //document.getElementById('il_produktow').innerHTML=o.responseText
		   //document.location.reload();
		   //wyswietl_il_produktow(sid);
		   //wyswietl_sume_koszyka(sid);
		   document.location.href=przedrostek+'zawartosc_koszyka/index_9_0_0_0_0_0_0.html';
		  },
  		parameters:{
  			"co":co,
		 	"ile":ile,
			"za_ile":za_ile,
		 	"SID":sid,
		 	"ak":'koszyk_add'
  	}
  })
}
function dodaj_do_koszyka_komplet(co, sid, przedrostek)
{
  	advAJAX.get({
  		url:przedrostek+"koszyk.php",
  		onSuccess:
		 function(o)
		  {
		   produkty=o.responseText.split(';');
		   for (i=0; i<produkty.length-1; i++)
		   {
		   	elementy=produkty[i].split('|');
			//alert(elementy[0]);
			//alert(elementy[1]);
			dodaj_do_koszyka(elementy[0], 1, elementy[1], sid, przedrostek)
			//dodaj_do_koszyka(co, ile, za_ile, sid)
		   }
		   //wyswietl_il_produktow(sid);
		   //wyswietl_sume_koszyka(sid);
		  },
  		parameters:{
  			"co":co,
		 	"SID":sid,
		 	"ak":'koszyk_add_komplet'
  	}
  })
}
function usun_z_koszyka(co, get, sid, przedrostek)
{
  	advAJAX.get({
  		url:przedrostek+"koszyk.php",
  		onSuccess:
		 function(o)
		  {
		   //document.getElementById('il_produktow').innerHTML=o.responseText
		   document.location.href='index.php?'+get;
		   //wyswietl_il_produktow(sid);
		   //wyswietl_sume_koszyka(sid);
		  },
  		parameters:{
  			"co":co,
		 	"SID":sid,
		 	"ak":'koszyk_del'
  	}
  })
}
function wyswietl_il_produktow(sid)
{
  	advAJAX.get({
  		url:"koszyk.php",
  		onSuccess:
		 function(o)
		  {
		   document.getElementById('il_produktow').innerHTML=o.responseText
		   //document.location.reload();
		  },
  		parameters:{
			"SID":sid,
		 	"ak":'koszyk_il_produktow'
  	}
  })
}
function wyswietl_sume_koszyka(sid)
{
  	advAJAX.get({
  		url:"koszyk.php",
  		onSuccess:
		 function(o)
		  {
		   document.getElementById('suma_koszyka').innerHTML=o.responseText
		   //document.location.reload();
		  },
  		parameters:{
			"SID":sid,
		 	"ak":'koszyk_suma'
  	}
  })
}
//--------------------------------------------------------------------
//                   NEWSLETTER
//--------------------------------------------------------------------
function newsletter_dodaj(kolor, przedrostek)
{
document.getElementById('form_newsletter').action=przedrostek+"newsletter_dodaj/index_"+kolor+".html"
document.getElementById('form_newsletter').submit()
}

function newsletter_usun(kolor, przedrostek)
{
document.getElementById('form_newsletter').action=przedrostek+"newsletter_usun/index_"+kolor+".html"
document.getElementById('form_newsletter').submit()
}
//--------------------------------------------------------------------
//                   ZAMÓWIENIE
//--------------------------------------------------------------------
function zapisz_zamowienie()
{
if (document.getElementById('miasto').value=='' || document.getElementById('kod_pocztowy').value=='' || document.getElementById('nr_domu').value=='') 
{
 alert('Pola: miasto, kod pocztowy i nr domu nie mog± być puste')
 return false
}
document.getElementById('form_zamowienie').submit();
}


