function licz(pole, to, max)
{
	var sample = document.getElementsByName(pole);
	var foo = sample.item(0);

	var licz = (foo.value).length;
   	document.getElementById(to).innerHTML = licz;
   		
   	foo.style.backgroundColor="#FFFFFF";

   	if (licz < (max/2))
   	{
   		document.getElementById(to).style.color = "green";
   	}
   		
   	if (licz > ((max/2)-1))
   	{
   		document.getElementById(to).style.color = "orange";
   		document.getElementById(to).innerHTML=licz;
   	}
   		
   	if (licz > max)
   	{
   		document.getElementById(to).style.color = "red";
   		document.getElementById(to).innerHTML = licz;
		foo.style.backgroundColor = "#FFDBDB";
   	}
   		
   	if (licz > ((max*4)-1))
   	{
   		document.getElementById(to).innerHTML = 'X';
   	}
}

function liczExt(pole, to, min, max)
{
	var sample = document.getElementsByName(pole);
	var foo = sample.item(0);

   	var licz = (foo.value).length;
   	document.getElementById(to).innerHTML = licz;
   		
   	foo.style.backgroundColor="#FFFFFF";

   	if (licz > min)
   	{
   		document.getElementById(to).style.color="green";
   	}
   	else
   	{
		document.getElementById(to).style.color="red";
   	}

   	if (licz > max)
   	{
   		document.getElementById(to).style.color="red";
   		document.getElementById(to).innerHTML=licz;
		foo.style.backgroundColor="#FFDBDB";
   	}

   	if (licz > ((max*4)-1))
   	{
   		document.getElementById(to).innerHTML='X';
   	}
}
