function kat_or_podkat() {
	var val = document.getElementById("sel_pod").options[document.getElementById("sel_pod").selectedIndex].value;
	
	if (val == -1 && !document.getElementsByName("swicz").checked) {
		document.getElementById("podkat").style.display = 'none';
		document.getElementById("podkat").value = -1;
		document.getElementById("podkat").selectedIndex = 0;
		document.getElementById("kat").style.display = 'block';
	}      		
}

function przywroc() {
		if (document.getElementById("podkat").style.display == 'none') {
		document.getElementById("podkat").style.display = 'block';
		document.getElementById("kat").style.display = 'none';
	} else {
		document.getElementById("podkat").style.display = 'none';
		document.getElementById("kat").style.display = 'block';
	}
	return true;
}

function dodaj(obj) {
document.getElementById("add").style.display="block";
obj.style.display="none";
}
      
function set_cena(obj,ceny) {
	
	var disp_cena = document.getElementById('cena_w');
	
	var valuta = obj.options[obj.selectedIndex].value;
	
	if (valuta == 'EUR') {
		dynamiccontentNS6(disp_cena,ceny[1].toFixed(2));
	} else if (valuta == 'USD') {
		dynamiccontentNS6(disp_cena,ceny[2].toFixed(2));
	} else {
		dynamiccontentNS6(disp_cena,ceny[0].toFixed(2));
	}
}


//dynamic content for FF
//kurwa...

function dynamiccontentNS6(elem,content){
	if (document.getElementById && !document.all){
		rng = document.createRange();
		rng.setStartBefore(elem);
		htmlFrag = rng.createContextualFragment(content);
		while (elem.hasChildNodes()) {
			elem.removeChild(elem.lastChild);
		}
		elem.appendChild(htmlFrag);
	} else {
		elem.innerText = content;
	}
}
      	
function kontener(p, suma, curr) {
	if (!document.getElementById("kwota")) {
		return false;
	}
	var txt = document.getElementById("txt");
	var kwota = document.getElementById("kwota");
	var cash = 0;
	if (p == 1) {
		cash = 20 + suma;
		dynamiccontentNS6(txt,"+ koszt transportu firm± kuriersk± DHL po przedpłacie na konto - 20 zl.");
		dynamiccontentNS6(kwota,cash.toFixed(2)+" "+curr);
	} else {
		cash = 25 + suma;
		dynamiccontentNS6(txt,"+ koszt transportu firm± kuriersk± DHL za pobraniem - 25 zl.");
		dynamiccontentNS6(kwota,cash.toFixed(2)+" "+curr);
	}
	
	
}
      	
      	
	function checkForm(dest,jezyk) {
		
		var forma = document.forms[0];
		
		var osoba_re = /[A-Za-z]+/;
		if (forma.osoba.value.length==0 || !forma.osoba.value.match(osoba_re)) {
			alert('Prosze podać Imie i Nazwisko');
			return false;
		}
/*			
		var dostawa_re = /[A-Za-z0-9]+/;
		if (forma.dostawa.value.length==0 || !forma.dostawa.value.match(dostawa_re)) {
			alert('Prosze podać Adres dostawy');
			return false;
		}
*/
		var mail_re = /[A-Za-z0-9_\.\-]+@[A-Za-z0-9\-_]+\.[A-Za-z]{2,}/;
		if (forma.mail.value.length==0 || !forma.mail.value.match(mail_re)) {
			alert('Prosze podać Adres mail');
			return false;
		}

		var tel_re = /[0-9]/g;
		if (forma.tel.value.length==0 || 
				forma.tel.value.match(tel_re)== null || 
				forma.tel.value.match(tel_re).length < 9 ||
				forma.tel.value.match(/[A-Za-z]/)
				) {
			alert('Prosze podać Numer telefonu');
			return false;
		}
/*		
		var faktura_re = /[A-Za-z0-9]+/;
		if (forma.faktura.value.length==0 || !forma.faktura.value.match(faktura_re)) {
			alert('Prosze podać Dane do faktury');
			return false;
		}
*/		
	
		if (!forma.platnosc[0].checked && !forma.platnosc[1].checked) {
			alert('Prosze podać Formę płatno¶ci');
			return false;
		}
		
		if (forma.txtCountry.options[forma.txtCountry.selectedIndex].value == "") {
			alert('Prosze wybrać kraj');
			return false;
		}
		
		forma.action = dest;
		forma.submit();
		return true;

	}
	
function aktualizuj(dest) {
	var forma = document.forms[0];
	forma.action = dest;
	forma.submit();

}
	
	
function add_curr(obj,lnk) {
	
	var walut = obj.options[obj.selectedIndex].value
	
	window.document.location.href = window.document.location.pathname + '?' + lnk + '&curr='+walut;
		
	
	var cur_val = document.getElementById('curs').options[document.getElementById('curs').selectedIndex].value;
	
	var lin = obj.href + "&curr=" + cur_val;
	
	obj.href = lin;
	
}

function disp0() {
	var pct = window.open('','Galeria','scrollbar=no,location=no,menubar=no');
	pct.document.write('aaaaaaaaaaaaaaaaa');
}

function disp(fname,wid,high) {
	var pct = window.open('','Galeria','scrollbar=no,location=no,menubar=no,width='+wid+',height='+high);
	pct.document.write('<HTML><HEAD><TITLE>Galeria</TITLE></HEAD><body bgcolor="#FFFFFF" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">');
	pct.document.write("<IMG src="+fname+" border=0 onclick='self.close()'>");
	pct.document.write('</body></HTML>');
}