function okienko(adres,szerokosc,wysokosc)
{
	window.open(adres, '_blank', 'width='+szerokosc+', height='+wysokosc+','
			+ ' location=0, status=0,'
			+ ' directories=0, scrollbars=1, menubar=0, toolbar=0, resizable=1');
}

function okienkoScroll(adres,szerokosc,wysokosc)
{
	window.open(adres, '_blank', 'width='+szerokosc+', height='+wysokosc+','
			+ ' location=0, status=0,'
			+ ' directories=0, scrollbars=1, menubar=0, toolbar=0, resizable=1');
}

function validateNotice(Form) {

	if(Form.tytul.value.length < 1) {
		alert("Ogłoszenie musi zawierać tytuł!");
		return false;
	}
	if(Form.autor.value.length < 1) {
		alert("Ogłoszenie musi zawierać autora!");
		return false;
	}
  if((Form.tresc.value.length > 1) & (Form.tresc.value.length > 5000)) {
		alert("Twój tekst jest za długi! Maksymalna liczba znaków: 5000");
		return false;
	}
	
	return true;
}

function addToText(icon) {

	var textarea = document.getElementById('tresc');
	var text1,text2;
	var curPos = 0;
	
	text1 = textarea.value.substring(0,textarea.selectionStart);
	text2 = textarea.value.substring(textarea.selectionStart,textarea.value.length);
	textarea.value = text1 + ' ' + icon + ' ' + text2;
	
	textarea.focus();
	
	curPos = text1.length + icon.length + 2;
	textarea.selectionStart = curPos;
	textarea.selectionEnd = curPos;

}

function show_hide(elem) {

	if(document.getElementById(elem).style.display=="none")
		document.getElementById(elem).style.display="inline";
	else document.getElementById(elem).style.display="none";
	
}

function validatePost(Form) {
  
	if ((Form.tresc.value.length < 1) | (Form.tresc.value.length > 5000)) {
		alert("Twój tekst jest za długi! Maksymalna liczba znaków: 5000");
		return false;
	}
	if ((Form.autor.value.length < 1) | (Form.autor.value.length > 100)) {
		alert("Uzupełnij pole 'autor'!");
		return false;
	}
	
	return true;
}

function validatePostNew(Form) {
  
	if ((Form.temat.value.length < 1) | (Form.temat.value.length > 5000)) {
		alert("Uzupełnij pole 'temat'!");
		return false;
	}
	if ((Form.tresc.value.length < 1) | (Form.tresc.value.length > 5000)) {
		alert("Twój tekst jest za długi! Maksymalna liczba znaków: 5000");
		return false;
	}
	if ((Form.autor.value.length < 1) | (Form.autor.value.length > 100)) {
		alert("Uzupełnij pole 'autor'!");
		return false;
	}
	
	return true;
}

function validateGalery(Form) {
	
	if(!(Form.zdjecie.value.length > 1)) {
		alert("Musisz podać ścięťkę do pliku ze zdjęciem!");
	
		return false;
	}
	
	if(!Form.akceptacja.checked) {
		alert("Musisz potwierdzić posiadanie praw autorskich do zdjęcia!");
	
		return false;
	}

	return true;
}

function onM(id,img)
{
	document.getElementById(id).src=img;
}

function outM(id,img)
{
	document.getElementById(id).src=img;
}

function gdzie(elem)
{
  var d = document;

	if(elem!='a') { d.getElementById('a').style.fontWeight="normal"; d.getElementById("szuk_gdzie").value="w"; }
	if(elem!='p') { d.getElementById('p').style.fontWeight="normal"; d.getElementById("szuk_gdzie").value="w"; }
	if(elem!='f') { d.getElementById('f').style.fontWeight="normal"; d.getElementById("szuk_gdzie").value="w"; }
	if(elem!='k') { d.getElementById('k').style.fontWeight="normal"; d.getElementById("szuk_gdzie").value="w"; }
	if(elem!='o') { d.getElementById('o').style.fontWeight="normal"; d.getElementById("szuk_gdzie").value="w"; }
	if(d.getElementById(elem).style.fontWeight=="normal")
	{
		d.getElementById(elem).style.fontWeight="bold";
		d.getElementById("szuk_gdzie").value=elem;
	}
	else {
		d.getElementById(elem).style.fontWeight="normal";
		d.getElementById("szuk_gdzie").value="w";
	}	
}

