	function zaokr(liczba){
liczba=liczba*100; 
liczba=Math.round(liczba);
liczba=liczba/100;
return liczba;
} 
	
	function abon(c0,c1,c2)
	{
		var abonament_ilosc_dni = document.getElementById("abonament_ilosc_dni");
		var cena_a = document.getElementById("cena_a");
		if (abonament_ilosc_dni.value == 366)
		{
			cena_a.innerHTML = c2;
		}
		if (abonament_ilosc_dni.value == 183)
		{
			cena_a.innerHTML = c1;
		}
		if (abonament_ilosc_dni.value == 31)
		{
			cena_a.innerHTML = c0;
		}
		
		
	}
	function promo(c0,c1,c2)
	{
		var promowanie_ilosc_dni = document.getElementById("promowanie_ilosc_dni");
		var cena_p = document.getElementById("cena_p");
		if (promowanie_ilosc_dni.value == 366)
		{
			cena_p.innerHTML = c2;
		}
		if (promowanie_ilosc_dni.value == 183)
		{
			cena_p.innerHTML = c1;
		}
		if (promowanie_ilosc_dni.value == 31)
		{
			cena_p.innerHTML = c0;
		}
		
		
	}
	function tekst3(c0,c1,c2)
	{
		var tekst_ilosc_dni = document.getElementById("tekst_ilosc_dni");
		var cena_t = document.getElementById("cena_t");
		if (tekst_ilosc_dni.value == 366)
		{
			cena_t.innerHTML = c2;
		}
		if (tekst_ilosc_dni.value == 183)
		{
			cena_t.innerHTML = c1;
		}
		if (tekst_ilosc_dni.value == 31)
		{
			cena_t.innerHTML = c0;
		}
		
		
	}

	function pogrubieniee(c0,c1,c2)
	{
		var pogrubienie_ilosc_dni = document.getElementById("pogrubienie_ilosc_dni");
		var cena_bold = document.getElementById("cena_bold");
		if (pogrubienie_ilosc_dni.value == 366)
		{
			cena_bold.innerHTML = c2;
		}
		if (pogrubienie_ilosc_dni.value == 183)
		{
			cena_bold.innerHTML = c1;
		}
		if (pogrubienie_ilosc_dni.value == 31)
		{
			cena_bold.innerHTML = c0;
		}
		
		
	}

	function podswietleniee(c0,c1,c2)
	{
		var podswietlenie_ilosc_dni = document.getElementById("podswietlenie_ilosc_dni");
		var cena_light = document.getElementById("cena_light");
		if (podswietlenie_ilosc_dni.value == 366)
		{
			cena_light.innerHTML = c2;
		}
		if (podswietlenie_ilosc_dni.value == 183)
		{
			cena_light.innerHTML = c1;
		}
		if (podswietlenie_ilosc_dni.value == 31)
		{
			cena_light.innerHTML = c0;
		}
		
		
	}

	function abon2(c0, c1,c2)
	{
		var abonament_ilosc_dni = document.getElementById("abonament_ilosc_dni");
		var abonament = document.getElementById("abonament");
		var cena_a = document.getElementById("cena_a");
		if(abonament.checked)
		{
			abonament_ilosc_dni.disabled = false;
			if (abonament_ilosc_dni.value == 366)
			{
				cena_a.innerHTML = c2;
			}
			if (abonament_ilosc_dni.value == 183)
			{
				cena_a.innerHTML = c1;
			}
			if (abonament_ilosc_dni.value == 31)
			{
				cena_a.innerHTML = c0;
			}
		}
		else
		{
			abonament_ilosc_dni.disabled = true;
			cena_a.innerHTML = '0 zł';

		}		
	}
	function promo2(c0,c1,c2)
	{
		var promowanie_ilosc_dni = document.getElementById("promowanie_ilosc_dni");
		var promowanie = document.getElementById("promowanie");
		var cena_p = document.getElementById("cena_p");
		if(promowanie.checked)
		{
			promowanie_ilosc_dni.disabled = false;
			if (promowanie_ilosc_dni.value == 366)
			{
				cena_p.innerHTML = c2;
			}
			if (promowanie_ilosc_dni.value == 183)
			{
				cena_p.innerHTML = c1;
			}
			if (promowanie_ilosc_dni.value == 31)
			{
				cena_p.innerHTML = c0;
			}
		}
		else
		{
			promowanie_ilosc_dni.disabled = true;
			cena_p.innerHTML = '0 zł';

		}		
	}
	function pogrubienie2(c0,c1,c2)
	{
		var pogrubienie_ilosc_dni = document.getElementById("pogrubienie_ilosc_dni");
		var pogrubienie = document.getElementById("pogrubienie");
		var cena_bold = document.getElementById("cena_bold");
		if(pogrubienie.checked)
		{
			pogrubienie_ilosc_dni.disabled = false;
			if (pogrubienie_ilosc_dni.value == 366)
			{
				cena_bold.innerHTML = c2;
			}
			if (pogrubienie_ilosc_dni.value == 183)
			{
				cena_bold.innerHTML = c1;
			}
			if (pogrubienie_ilosc_dni.value == 31)
			{
				cena_bold.innerHTML = c0;
			}
		}
		else
		{
			pogrubienie_ilosc_dni.disabled = true;
			cena_bold.innerHTML = '0 zł';

		}		
	}
	function podswietlenie2(c0,c1,c2)
	{
		var podswietlenie_ilosc_dni = document.getElementById("podswietlenie_ilosc_dni");
		var podswietlenie = document.getElementById("podswietlenie");
		var cena_light = document.getElementById("cena_light");
		if(podswietlenie.checked)
		{
			podswietlenie_ilosc_dni.disabled = false;
			if (podswietlenie_ilosc_dni.value == 366)
			{
				cena_light.innerHTML = c2;
			}
			if (podswietlenie_ilosc_dni.value == 183)
			{
				cena_light.innerHTML = c1;
			}
			if (podswietlenie_ilosc_dni.value == 31)
			{
				cena_light.innerHTML = c0;
			}
		}
		else
		{
			podswietlenie_ilosc_dni.disabled = true;
			cena_light.innerHTML = '0 zł';

		}		
	}
	function tekst2(c0,c1,c2)
	{
		var tekst_ilosc_dni = document.getElementById("tekst_ilosc_dni");
		var tekst = document.getElementById("tekst");
		var cena_t = document.getElementById("cena_t");
		if(tekst.checked)
		{
			tekst_ilosc_dni.disabled = false;
			if (tekst_ilosc_dni.value == 366)
			{
				cena_t.innerHTML = c2;
			}
			if (tekst_ilosc_dni.value == 183)
			{
				cena_t.innerHTML = c1;
			}
			if (tekst_ilosc_dni.value == 31)
			{
				cena_t.innerHTML = c0;
			}
		}
		else
		{
			tekst_ilosc_dni.disabled = true;
			cena_t.innerHTML = '0 zł';

		}		
	}
	function sumuj(c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,rabacik,kod_partnerski,rabat_partnerski)
	{
		var tekst_ilosc_dni = document.getElementById("tekst_ilosc_dni");
		var promowanie_ilosc_dni = document.getElementById("promowanie_ilosc_dni");
		var abonament_ilosc_dni = document.getElementById("abonament_ilosc_dni");
		var pogrubienie_ilosc_dni = document.getElementById("pogrubienie_ilosc_dni");
		var podswietlenie_ilosc_dni = document.getElementById("podswietlenie_ilosc_dni");
		var tekst = document.getElementById("tekst");
		var promowanie = document.getElementById("promowanie");
		var abonament = document.getElementById("abonament");
		var pogrubienie = document.getElementById("pogrubienie");
		var podswietlenie = document.getElementById("podswietlenie");
		var suma = 0;
		if (tekst.checked)
		{
			if (tekst_ilosc_dni.value == 31)
			{
				suma = suma + c9;
			}
			if (tekst_ilosc_dni.value == 183)
			{
				suma = suma + c5;
			}
			if (tekst_ilosc_dni.value == 366)
			{
				suma = suma + c6;
			}
		}
		if (promowanie.checked)
		{
			if (promowanie_ilosc_dni.value == 31)
			{
				suma = suma + c8;
			}
			if (promowanie_ilosc_dni.value == 183)
			{
				suma = suma + c3;
			}
			if (promowanie_ilosc_dni.value == 366)
			{
				suma = suma + c4;
			}
		}
		if (abonament.checked)
		{
			if (abonament_ilosc_dni.value == 31)
			{
				suma = suma + c7;
			}
			if (abonament_ilosc_dni.value == 183)
			{
				suma = suma + c1;
			}
			if (abonament_ilosc_dni.value == 366)
			{
				suma = suma + c2;
			}
		}
		if (pogrubienie.checked)
		{
			if (pogrubienie_ilosc_dni.value == 31)
			{
				suma = suma + c10;
			}
			if (pogrubienie_ilosc_dni.value == 183)
			{
				suma = suma + c11;
			}
			if (pogrubienie_ilosc_dni.value == 366)
			{
				suma = suma + c12;
			}
		}
		if (podswietlenie.checked)
		{
			if (podswietlenie_ilosc_dni.value == 31)
			{
				suma = suma + c13;
			}
			if (podswietlenie_ilosc_dni.value == 183)
			{
				suma = suma + c14;
			}
			if (podswietlenie_ilosc_dni.value == 366)
			{
				suma = suma + c15;
			}
		}
		if(document.getElementById("rabat").innerHTML)
		{
			if(document.getElementById("refik").value==kod_partnerski)
				suma = suma - suma * (rabat_partnerski/100);
			else
				suma = suma - suma * (rabacik/100);
		}
		suma = zaokr(suma) + '';
		suma = suma.replace('.',',');
		suma = suma + ' zł';
		document.getElementById("suma").innerHTML = suma;



	}
	function disen()
	{
		var iffaktura = document.getElementById("iffaktura");
		var ffirm = document.getElementById("ffirm");
		var fname = document.getElementById("fname");
		var fsurname = document.getElementById("fsurname");
		var faddress = document.getElementById("faddress");
		var fnip = document.getElementById("fnip");
		if (iffaktura.checked)
		{
			ffirm.disabled = false;
			fname.disabled = false;
			fsurname.disabled = false;
			faddress.disabled = false;
			fnip.disabled = false;
		}
		else
		{
			ffirm.disabled = true;
			fname.disabled = true;
			fsurname.disabled = true;
			faddress.disabled = true;
			fnip.disabled = true;
		}
		
	}

	function rabat(ref,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,rabacik,kod_partnerski,rabat_partnerski) {
				var oXmlHttp = zXmlHttp.createRequest();
				oXmlHttp.open("get","ajax_requests/checkRabat.php?ref="+ref,true);
				oXmlHttp.onreadystatechange = function () {
				if (oXmlHttp.readyState == 4)
				{
					if(oXmlHttp.status==200) {
							if (oXmlHttp.responseText == 'OK')
							{
								document.getElementById("rabat").innerHTML = '-'+rabacik+'%';
								
								var tekst_ilosc_dni = document.getElementById("tekst_ilosc_dni");
								var promowanie_ilosc_dni = document.getElementById("promowanie_ilosc_dni");
								var abonament_ilosc_dni = document.getElementById("abonament_ilosc_dni");
								var pogrubienie_ilosc_dni = document.getElementById("pogrubienie_ilosc_dni");
								var podswietlenie_ilosc_dni = document.getElementById("podswietlenie_ilosc_dni");
								var tekst = document.getElementById("tekst");
								var promowanie = document.getElementById("promowanie");
								var abonament = document.getElementById("abonament");
								var pogrubienie = document.getElementById("pogrubienie");
								var podswietlenie = document.getElementById("podswietlenie");
								var suma = 0;
								if (tekst.checked)
								{
									if (tekst_ilosc_dni.value == 31)
									{
										suma = suma + c9;
									}
									if (tekst_ilosc_dni.value == 183)
									{
										suma = suma + c5;
									}
									if (tekst_ilosc_dni.value == 366)
									{
										suma = suma + c6;
									}
								}
								if (promowanie.checked)
								{
									if (promowanie_ilosc_dni.value == 31)
									{
										suma = suma + c8;
									}
									if (promowanie_ilosc_dni.value == 183)
									{
										suma = suma + c3;
									}
									if (promowanie_ilosc_dni.value == 366)
									{
										suma = suma + c4;
									}
								}
								if (abonament.checked)
								{3
									if (abonament_ilosc_dni.value == 31)
									{
										suma = suma + c7;
									}
									if (abonament_ilosc_dni.value == 183)
									{
										suma = suma + c1;
									}
									if (abonament_ilosc_dni.value == 366)
									{
										suma = suma + c2;
									}
								}
								if (pogrubienie.checked)
								{
									if (pogrubienie_ilosc_dni.value == 31)
									{
										suma = suma + c10;
									}
									if (pogrubienie_ilosc_dni.value == 183)
									{
										suma = suma + c11;
									}
									if (pogrubienie_ilosc_dni.value == 366)
									{
										suma = suma + c12;
									}
								}
								if (podswietlenie.checked)
								{
									if (podswietlenie_ilosc_dni.value == 31)
									{
										suma = suma + c13;
									}
									if (podswietlenie_ilosc_dni.value == 183)
									{
										suma = suma + c14;
									}
									if (podswietlenie_ilosc_dni.value == 366)
									{
										suma = suma + c15;
									}
								}
								suma = suma - suma * (rabacik/100);
								suma = zaokr(suma) + '';
								suma = suma.replace('.',',');
								suma = suma + ' zł';
								document.getElementById("suma").innerHTML = suma;
								document.getElementById("refik").value = document.getElementById("kodrabatowy").value;
								document.getElementById("kodrabatowy").disabled=true;
							}	
							else
						{
								document.getElementById("rabat").innerHTML = '';
								var tekst_ilosc_dni = document.getElementById("tekst_ilosc_dni");
								var promowanie_ilosc_dni = document.getElementById("promowanie_ilosc_dni");
								var abonament_ilosc_dni = document.getElementById("abonament_ilosc_dni");
								var tekst = document.getElementById("tekst");
								var promowanie = document.getElementById("promowanie");
								var abonament = document.getElementById("abonament");
								var suma = 0;
								if (tekst.checked)
								{
									if (tekst_ilosc_dni.value == 31)
									{
										suma = suma + c9;
									}
									if (tekst_ilosc_dni.value == 183)
									{
										suma = suma + c5;
									}
									if (tekst_ilosc_dni.value == 366)
									{
										suma = suma + c6;
									}
								}
								if (promowanie.checked)
								{
									if (promowanie_ilosc_dni.value == 31)
									{
										suma = suma + c8;
									}
									if (promowanie_ilosc_dni.value == 183)
									{
										suma = suma + c3;
									}
									if (promowanie_ilosc_dni.value == 366)
									{
										suma = suma + c4;
									}
								}
								if (abonament.checked)
								{
									if (abonament_ilosc_dni.value == 31)
									{
										suma = suma + c7;
									}
									if (abonament_ilosc_dni.value == 183)
									{
										suma = suma + c1;
									}
									if (abonament_ilosc_dni.value == 366)
									{
										suma = suma + c2;
									}
								}
								if(ref == kod_partnerski)
									suma = suma - suma * (rabat_partnerski/100);
								suma = zaokr(suma) + '';
								suma = suma.replace('.',',');
								suma = suma + ' zł';
								document.getElementById("suma").innerHTML = suma;
								if(ref == kod_partnerski)
								{
									document.getElementById("rabat").innerHTML = '-'+rabat_partnerski+'%';
									document.getElementById("refik").value = document.getElementById("kodrabatowy").value;
									document.getElementById("kodrabatowy").disabled=true;
								}
								if(ref != kod_partnerski)
									alert('Wprowadzono niepoprawny kod rabatowy.');
						}
					}
					else {
						alert('Błąd. Przepraszamy.');
					}
				}
				//if (oXmlHttp.readyState == 1) 
					//document.getElementById("modelDiv").innerHTML = '<select name="model" style="width:140px;" id="model"><option value="0">Ładownie...</option></select>';
				}
			oXmlHttp.send(null);



	}


	/* onmouseover przyciski */

	obrazek1_on = new Image(149, 43);
obrazek1_on.src = "images/pl/bazanoclegowa_11b.gif";
obrazek1_off = new Image(149, 43);
obrazek1_off.src = "images/pl/bazanoclegowa_11.gif";

obrazek2_on = new Image(134, 43);
obrazek2_on.src = "images/pl/bazanoclegowa_12b.gif";
obrazek2_off = new Image(134, 43);
obrazek2_off.src = "images/pl/bazanoclegowa_12.gif";

obrazek3_on = new Image(125, 43);
obrazek3_on.src = "images/pl/bazanoclegowa_13b.gif";
obrazek3_off = new Image(125, 43);
obrazek3_off.src = "images/pl/bazanoclegowa_13.gif";

obrazek4_on = new Image(91, 43);
obrazek4_on.src = "images/pl/bazanoclegowa_schowekb.gif";
obrazek4_off = new Image(91, 43);
obrazek4_off.src = "images/pl/bazanoclegowa_schowek.gif";

obrazek5_on = new Image(68, 43);
obrazek5_on.src = "images/pl/bazanoclegowa_15b.gif";
obrazek5_off = new Image(68, 43);
obrazek5_off.src = "images/pl/bazanoclegowa_15.gif";

obrazek6_on = new Image(104, 43);
obrazek6_on.src = "images/pl/bazanoclegowa_16b.gif";
obrazek6_off = new Image(104, 43);
obrazek6_off.src = "images/pl/bazanoclegowa_16.gif";

obrazek7_on = new Image(99, 43);
obrazek7_on.src = "images/pl/bazanoclegowa_17b.gif";
obrazek7_off = new Image(99, 43);
obrazek7_off.src = "images/pl/bazanoclegowa_17.gif";


function img_act(pic)
{
  document[pic].src = eval(pic + "_on.src");
}
function img_deact(pic)
{
  document[pic].src = eval(pic + "_off.src");
}

function pausecomp(millis)
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); }
while(curDate-date < millis);
} 

function zliczaj()	{		
	var len = document.getElementById('opis_ob').value.length;		
	document.getElementById('ilosc_zn').innerHTML = 'Opis zawiera aktualnie ' + len + ' znaków.';
}
