function SetProcent(proc_changed, space){
	if(proc_changed.value < 0 || proc_changed.value >100){
		alert('Значение приоритета должно быть в диапазоне от 0 до 100');
		return;
	}

	var proc = document.getElementsByName('rel'+space);
	var active = document.getElementsByName('status'+space);

	var actcnt=0;
	for(j=0;j<proc.length;j++){
		if(active[j].value == 1 || active[j].value == 'Y') actcnt++;
	}
//	alert(actcnt);
	
	for(i=0;i<proc.length;i++){
		if(proc[i].id != '' && proc[i].id != proc_changed.id && (active[i].value == 1 || active[i].value == 'Y')){
			proc[i].value = (100 - proc_changed.value)/(actcnt - 1);
			proc[i].style.color="red";
		}
		if(proc[i].id != '' && proc[i].id != proc_changed.id && (active[i].value == 0 || active[i].value == 'N')){
			proc[i].value = 0;
		}

	}
}


function ShowVote(content,texxt) {
	var ul = document.getElementById('votePlace');
	if(texxt.length > 5){
		ul.innerHTML = content;
	}
	else{
		document.getElementById('votePlaceMain').style.display='none';
	}
}

function ShowRes(frm, action, parentid){
try{
	if(action == 'show_res'){		
		frm = document.getElementsByName('rbvote');
		var rblen = frm.length;
		for(i=0; i<rblen;i++){
			if(frm[i].checked){
				var chkd = frm[i].value;
				break;
			}
		}
		var ifrm = document.getElementById('voteFrame');
		if(chkd > 0)

			ifrm.src = '/dinamic/poll?action=inc&id='+parentid+'&chkd='+chkd;
		else ifrm.src = '/dinamic/poll?action=showres&id='+parentid;
//		window.open(ifrm.src, '_blank');
	}
}
catch(err){};
//	window.open(ifrm.src, '_blank');
	return false;
}

