function PustePole(inp)
{
	return (inp.value.search(/^\s*$/) == 0);
}

function BladWPolu(pole, komunikat, zaznacz)
{
	var cName = pole.className;
	if (zaznacz == null)
		zaznacz = true;
	pole.focus();
	pole.className = 'crit_Err ' + pole.className;
	alert(komunikat);
	pole.className = cName;
	if (pole.type.match(/^text/) && zaznacz)
		pole.select();
}

function SprawdzPuste(form, nazPola, komunikat)
{
	var el = form.elements[nazPola];
	if (!el) return false;
	if (PustePole(el))
	{
		if (komunikat)
			BladWPolu(el, komunikat);
		else
			BladWPolu(el, 'Proszę wypełnić wymagane pola');
		return false;
	}
	else
		return true;
}

function SprawdzPusteSelect(form, nazPola, komunikat)
{
	var el = form.elements[nazPola];
	if (!el) return false;
	if (el.selectedIndex == -1) 	
	{
		if (komunikat)
			BladWPolu(el, komunikat);
		else
			BladWPolu(el, 'Proszę wypełnić wymagane pola');
		return false;
	}
	else
		return true;
}

function DocOnLoad(ev)
{
	var rPanel = document.getElementById('prawy_panel');
	if (rPanel)
		rPanel.style.width = document.body.clientWidth - 150 - 2 - 90 + "px";
}


window.onload = DocOnLoad;

