function blok_adsi(form_id, checked, ids)
{
var ch=0;
var elements = document.getElementById(form_id).elements;
    	
  	for (var i = 0; i < elements.length; i ++) 
  	{
  	if (elements[i].name == ids) 
		{
  		if (elements[i].type == 'checkbox') elements[i].checked = checked;
		if(checked==1) ch=0;
		}
	}
  	for (var i = 0; i < elements.length; i ++) 
  	{
		if (elements[i].value == ids) elements[i].checked = ch;
 	}
}

function blok_adsi2(form_id, checked, ids, arr)
{
var ch=0;
var j=0;
var k='';
var elements = document.getElementById(form_id).elements;
    	
  	for (var i = 0; i < elements.length; i ++) 
  	{
  	if (elements[i].name == ids) 
		{
			k=i;
		}
	}
	
  	for (var i = 0; i < elements.length; i ++) 
  	{
		if (elements[i].value == ids) 
			{
  			if (elements[i].checked == 1) j++;
  			}
	}
	
	if(j==arr) 
	{
	elements[k].checked = 1;
  	for (var i = 0; i < elements.length; i ++)
		{
			if (elements[i].value == ids) elements[i].checked = ch;
		} 
	}
	else elements[k].checked = 0;
 }

