﻿
// Input: ID of the permissions control
// return: value to be sellected
function _ISD_UI_Permissions_setAll(ID, Val)
{
	var frm = window.document.forms[0];
	for(i = 0; i < frm.elements.length; i++)
	{
		if('radio' == frm.elements[i].type)
		{
			// TODO: make sure that this radio belongs to the current Permissions control by checking the ID
			frm.elements[i].checked = (frm.elements[i].value == Val);
		}
	}
}

// Input: ID of the permissions control
function _ISD_UI_Permissions_setRestrict(ID)
{
	var checked = true;
	var frm = window.document.forms[0];
	for(i = 0; i < frm.elements.length && checked; i++)
	{
		if('checkbox' == frm.elements[i].type)
		{
			// TODO: make sure that this checkbox belongs to the current Permissions control by checking the ID
			checked = checked & frm.elements[i].checked;
		}
	}
	var revchecked = !checked;
	
	for(i = 0; i < frm.elements.length; i++)
	{
		if('checkbox' == frm.elements[i].type)
		{
			// TODO: make sure that this checkbox belongs to the current Permissions control by checking the ID
			frm.elements[i].checked = revchecked;
		}
	}
}
