// Skrypty menu - start

kryj = 0; id = 0;
function menu(element) {
  i = 1; kryj = 1;
  while (e = document.getElementById("m" + i++))
    e.style.visibility = "hidden";
  document.getElementById(element).style.visibility = "visible";
}

function koniec() {
  clearTimeout(id);
  kryj=0; id = setTimeout(ukryj, 500)
}

function ukryj() {
  if (kryj==0) {
    i = 1;
    while (e = document.getElementById("m" + i++))
      e.style.visibility = "hidden";
  }
}
// Skrypty menu - end



// Okno drukowania
function drukuj(adr) {
  Prn = window.open(adr,"Prn","width=800,height=600,left=0,top=0,scrollbars=yes,toolbar=no");
  Prn.focus();	
}


// Okno PDF
function pdf(adr) {
  Pdf = window.open(adr,"Pdf","width=800,height=600,left=0,top=0,scrollbars=yes,toolbar=no,resizable=yes");
  Pdf.focus();	
}


// Okno oswiadczenia
function oswiadczenie(adr) {
  Osw = window.open(adr,"Osw","width=800,height=600,left=0,top=0,scrollbars=yes,toolbar=no,resizable=yes");
  Osw.focus();	
}


// Okno uchwaly
function uchwaly(adr) {
  Uch = window.open(adr,"Uch","width=800,height=600,left=0,top=0,scrollbars=yes,toolbar=no,resizable=yes");
  Uch.focus();	
}


// Link w nowym oknie
function blank(url) {
	window.open(url,'_blank');
	return false;
}


// Okno zdjecia z newsa
function foto_news(url) {

	Foto = window.open(url,"Foto","width=300,height=200,left=0,top=0,scrollbars=no,toolbar=no,resizable=no,status=yes");
  	Foto.focus();
}


// Okno zdjecia z galerii
function foto(url,w,h) {
	Gal = window.open(url,"okno","width="+w+",height="+h+",left=0,top=0,scrollbars=0,status=0");	
	Gal.focus();
}


// Zamknij okno
function zamknij() {
	window.close();
}


// Sprawdz ksiege
function spr_ksiege(f1) {

	if (f1.nick.value.length<2) {
  		alert("Przedstaw się!");
		f1.nick.focus();
		return false;
  }
  if (!f1.email.value.match(/^[0-9a-z_.-]+@([0-9a-z-]+\.)+[a-z]{2,6}$/)) {
    		alert("Wpisz poprawny adres e-mail!");
		f1.email.focus();
		return false;
  }
  if (f1.wpis.value.length<5) {	
  		alert("Uzupełnij treść wpisu!");
		f1.wpis.focus();
		return false;
  }
  
  return true;
}


// Sprawdz kontakt
function spr_kontakt(f1) {

	if (f1.nick.value.length<2) {
  		alert("Przedstaw się!");
		f1.nick.focus();
		return false;
  }
  if (!f1.email.value.match(/^[0-9a-z_.-]+@([0-9a-z-]+\.)+[a-z]{2,6}$/)) {
    	alert("Wpisz poprawny adres e-mail!");
		f1.email.focus();
		return false;
  }
  if (f1.adresat.selectedIndex<1) { 
  		alert("Wybierz adresata!");
		f1.adresat.focus(); 
		return false; 
  }	
  if (f1.wpis.value.length<5) {	
  		alert("Uzupełnij treść wpisu!");
		f1.wpis.focus();
		return false;
  }
  
  return true;
}