var childControlCollection=new Array();
		
function ChildControl()
{
	this.sourceControlID=null;
	this.triggerValue=null;
	this.targetControlID=null;
	this.operator='=';
}

function RegisterChildControl(sourceControlID,triggerValue,targetControlID,strOperator)
{
	var toAdd=new ChildControl();
	toAdd.sourceControlID=sourceControlID;
	toAdd.triggerValue=triggerValue;
	toAdd.targetControlID=targetControlID;
	toAdd.operator=strOperator;		
	childControlCollection[childControlCollection.length]=toAdd;
	
	SetControlVisibility(toAdd);
}

function SetControlVisibility(objChildControl)
{
	sourceControl=document.getElementById(objChildControl.sourceControlID);		
	targetControl=document.getElementById(objChildControl.targetControlID);		
				
	if (targetControl!=null && sourceControl!=null)
	{	
		var val=sourceControl.value;
		if (val==null || objChildControl.triggerValue==true || objChildControl.triggerValue==false ) val=sourceControl.checked;		

		targetControl.style.visibility=( (val==objChildControl.triggerValue) == (objChildControl.operator=='=')  )?'':'hidden';
		targetControl.style.display=( (val==objChildControl.triggerValue) == (objChildControl.operator=='=')  )?'':'none';
		
	} 									
}

function ProcessChangeEvent(objSource)
{	
	var i=0;
	while (i<childControlCollection.length)
	{
		if (objSource==null || childControlCollection[i].sourceControlID==objSource.id)
		{							    
			SetControlVisibility(childControlCollection[i]);
		}
		i++;
	}
}

