function init()
	{
	optionTest = true;
	lgth = document.forms['ogl'].p_kat.options.length - 1;
	document.forms['ogl'].p_kat.options[lgth] = null;
	if (document.forms['ogl'].p_kat.options[lgth]) optionTest = false;
	}

function generuj()
	{
	if (!optionTest) return;
	var box = document.forms['ogl'].kat;
	var number = box.options[box.selectedIndex].value;
	if (!number) return;
	var box2 = document.forms['ogl'].p_kat;
	box2.options.length = 0;
	for(var i=0;i<kat[box.selectedIndex].length;i++)
		{
			box2.options[i] = new Option(kat[box.selectedIndex][i],id[box.selectedIndex][i]);
		}
}
function wczytaj(z,b_index)
	{
	optionTest = true;
	var box2 = document.forms['ogl'].p_kat;
	var b;
	box2.options.length = 0;
	for(var i=0;i<kat[z].length;i++)
		{
			box2.options[i] = new Option(kat[z][i],id[z][i]);
			if(b_index == id[z][i]) b = i;

		}
	box2.selectedIndex = b;
}

function przetwarzaj_dane ()
{
var brakuje_danych=false;
var napis="";
if (ogl.kat.value == ""){
napis += "kategoria\n"
brakuje_danych=true;
}
if (ogl.p_kat.value == ""){
napis += "podkategoria\n"
brakuje_danych=true;
}
if (ogl.imie.value == ""){
napis += "imie\n"
brakuje_danych=true;
}
if (ogl.nazwisko.value == ""){
napis += "nazwisko\n"
brakuje_danych=true;
}
if (!brakuje_danych)
ogl.submit();
else
alert ("Nie wypełniłeś nastepujących pól:\n" + napis);
}

function usun_ogloszenie()
{
if(confirm('Czy napewno chcesz usunąć to ogłoszenie?')) document.usun.submit();
}