if (window != window.top)
  top.location.href = location.href;
if (parent.frames.length > 0) parent.location.href = self.document.location
noweOkno = null;

function check_upload_form(form) {
var pliki = form.getElementsByTagName('input');
	for(i = 0; i < pliki.length; i++){
	if(pliki[i].type == "file" && pliki[i].value=="") {
	alert("wybierz plik do wysłania"); return false; }
	}
return true;
}

function pokaz(co) {
elem = document.getElementById(co).style.display;
if(elem == 'none') document.getElementById(co).style.display = 'block';
else document.getElementById(co).style.display = 'none';
}

function zaznacz(source, form) {
var checkboxy = document.getElementById(form).getElementsByTagName('input');
for(i = 0; i < checkboxy.length; i++)
if(checkboxy[i].type == 'checkbox' && checkboxy[i].name != 'testowy')
checkboxy[i].checked = (source.checked) ? true : false;
}

function powieksz(src, w, h, tytul){
  if(window.screen){
    aw=screen.availWidth;
    ah=screen.availHeight;
  }else{
    aw=700;
    ah=700;
  }
  if (noweOkno!=null&&(!noweOkno.closed))
  {noweOkno.window.close();}
  if(noweOkno==null || noweOkno.closed)
  {
    ustawienia= "left=" + (aw-w)/2 + ",top=0,screenX=" + (aw-w)/2 + ",screenY=" + (ah-h)/2 + ","
    +"width=" + w + ",height=" + h + ",innerWidth=" + w + ",innerHeight=" + h + ",toolbar=no,"
    +"location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no"
    noweOkno = window.open('','obrazek',ustawienia);
	}
	noweOkno.document.open();
	noweOkno.document.clear();
	noweOkno.document.write("<HTML><HEAD><TITLE>"+tytul+"</TITLE></HEAD><BODY marginwidth='0' marginheight='0' topmargin='0' onclick=\"javascript:window.close()\"><img src='"+src+"'></body></html>");
	noweOkno.document.close();
	noweOkno.focus();
}

function form_chk(formname,mask){
  f=document.forms[formname];
  var pwt=0;
  n = new Array;
  for(var i=0;i< f.elements.length;i++ ) if(f.elements[i].name.substring(0,mask.length) == mask)
  n[n.length]=f.elements[i].value;
  for(i in n) {if(n[i] == ''){pwt=1;alert('numery nie mog&#177; być puste');} for(var j=i;j<n.length;j++) if(i != j && n[i] == n[j]){alert('powtarza się nr '+n[i]);pwt=1;}}
  if (pwt==0) f.submit();
}

function menu(d){
if(document.getElementById(d).style.display=='none')
document.getElementById(d).style.display='inline';
else document.getElementById(d).style.display='none';
}