function popWindow(url, width, height, target)
{
	if (target == "") target = "_blank";
	window.open(url, target, "width=" + width + ",height=" + height + ",statusbar=no,resizable=yes,scrollbars=yes");
}

function showElement(id)
{
	obj = document.getElementById(id);
	if (obj.style) obj = obj.style;
	obj.display = 'block';
}

function hideElement(id)
{
	obj = document.getElementById(id);
	if (obj.style) obj = obj.style;
	obj.display = 'none';
}

function setClass(id, className)
{
	obj = document.getElementById(id);
	obj.setAttribute('class', className);
}

function updateCharCount(nm, limit)
{
	ta = document.getElementById(nm);
	label = document.getElementById(ta.id + "_label");
	counter = label.childNodes[1];
	if (!counter)
	{
		label.innerHTML = label.innerHTML + "<SPAN CLASS='charsleft'>dupa</SPAN>";
		counter = label.childNodes[1];
	}
	charsLeft = limit - ta.value.length;
	if (charsLeft >= 0)
	{
		counter.setAttribute('class', 'charsleft');
		counter.innerHTML = "zostało " + charsLeft + " znak(ów)";
	}
	else
	{
		counter.setAttribute('class', 'charsleftbad');
		counter.innerHTML = (-charsLeft) + " znak(ów) za dużo"
	}
}
