zaznaczonych = 0
elementow = 0

function messanger_zamknij() {
	document.getElementById('messanger').parentNode.removeChild(document.getElementById('messanger'));
}
function ZakodujHasloHmac(form) {
	var pola = form.getElementsByTagName('input');
	for(ind = 0; ind < pola.length; ind++) {
		if(pola[ind].type == 'password')
			pola[ind].value = hex_hmac_md5(form.klucz.value, hex_md5(pola[ind].value));
	}
}
function ZakodujHasloMd5(form) {
	var pola = form.getElementsByTagName('input');
	for(ind = 0; ind < pola.length; ind++) {
		if(pola[ind].type == 'password')
			pola[ind].value = hex_md5(pola[ind].value);
	}
}

function przeslij_tresc(formularz) {
	formularz.tekst.value = document.getElementById('hdndane[kod]').value;
	formularz.submit();
}
function ukryj_komunikat() {
	document.getElementById('komunikat').style.visibility='hidden'
}
function wyslij_form(form, akcja) {
	form.action.value=akcja;
	form.submit();
}
function rob(element, akcja) {
	pozycja=document.getElementById('check_'+element);
	wiersz_all(pozycja.form, false);
	pozycja.checked=true;
	kieruj(pozycja.form, akcja);
	pozycja.form.submit();
}
function sekcja_ustaw(element, kierunek) {
	pozycja=document.getElementById('check_'+element);
	sek = document.getElementById('sekcja');
	pozycja.form.sekcja.value = kierunek;
	pozycja.form.action.value = '';
	wiersz_all(pozycja.form, false);
	pozycja.checked = true;
	pozycja.form.submit()
}
function kieruj(form, wartosc) {
	form.action.value = wartosc
}
function wiersz(form) {
	ilosc = form.length
	zaznaczony = 0;
	wszystkich = 0;
	for(ind = 0; ind < ilosc; ind++) {
		if(form.elements[ind].type=='checkbox') {
			if(form.elements[ind].checked)
				zaznaczony++;
			wszystkich++;
		}
	}
	if(document.getElementById('przesun_div')) {
		if(zaznaczony == 1 && wszystkich > 1)
			document.getElementById('przesun_div').style.visibility='visible'
		else
			document.getElementById('przesun_div').style.visibility='hidden'
	}
}
function wiersz_all(form, prop) {
	ilosc=form.length
	for(ind=0; ind<ilosc; ind++) {
		if(form.elements[ind].type=='checkbox') {
			form.elements[ind].checked=prop
			aktywny=ind
		}
	}
	if(document.getElementById('przesun_div')) {
		if(ilosc==1 && prop)
			document.getElementById('przesun_div').style.visibility='visible'
		else
			document.getElementById('przesun_div').style.visibility='hidden'
	}
}
function zmien(prop) {
	ilosc=document.forms[0].length
	for(ind=0; ind<ilosc; ind++) {
		if(document.forms[0].elements[ind].type=="checkbox") {
			document.forms[0].elements[ind].checked=prop
		}
	}
}
function przypomnij() {
	window.open("/admin/moduly/haslo.php","hasło","toolbar=no,directories=no,menubar=no,status=no,width=550,height=200, left=100, top=50");
}