
function CommonControlFunction()
{
	//	Declarations
	//******************************************************************************************************
	
	//******************************************************************************************************
	
	//	Public Methods
	//******************************************************************************************************

	this.GetCheckBoxListRadioButtonListAnswer = function(blnSingleAnswer, ctl)
	{
		var ii;
		var intLength;
		var aAnswer;
		var aInputControl;
		
		try
		{
			//	create the array to hold the answer
			aAnswer = new Array();
			
			//	get array containing the input controls (radio buttons or check boxes)
			aInputControl = ctl.getElementsByTagName("INPUT");
			
			//	loop through child nodes to find the one selected
			ii = 0;
			intLength = aInputControl.length;
			for (ii; ii < intLength; ii++)
			{
				//	determine if answer selected
				if (aInputControl[ii].checked)
				{	
					//	selected answer found
					aAnswer[aAnswer.length] = aInputControl[ii].nextSibling.outerText;
					if (blnSingleAnswer){	break;	}
				}
			}
			return aAnswer;
		}
		catch (ex)
		{	throw ex;	}
		finally
		{
			//	clean up
			blnSingleAnswer = null;
			ctl = null;
			ii = null;
			intLength = null;
			aAnswer = null;
			aInputControl = null;
		}
	}
	
	this.GetRadioButtonListValue = function(blnSingleAnswer, ctl)
	{
		var ii;
		var intLength;
		var aValue;
		var actlInputControl;
		
		try
		{
			//	create the array to hold the answer
			aValue = new Array();
			
			//	get array containing the input controls (radio buttons or check boxes)
			actlInputControl = ctl.getElementsByTagName("INPUT");
			
			//	loop through child nodes to find the one selected
			ii = 0;
			intLength = actlInputControl.length;
			for (ii; ii < intLength; ii++)
			{
				//	determine if answer selected
				if (actlInputControl[ii].checked)
				{	
					//	selected answer found
					 aValue[aValue.length] = actlInputControl[ii].value;
								
					if (blnSingleAnswer){	break;	}
				}
			}
			return aValue;
		}
		catch (ex)
		{	throw ex;	}
		finally
		{
			//	clean up
			blnSingleAnswer = null;
			ctl = null;
			ii = null;
			aValue = null;
			actlInputControl = null;
			intLength = null;
		}
	}
	
	this.ResetCheckBoxListRadioButtonList = function (ctl)
	{
		var ii;
		var intLength;
		var aInputControl;
		
		try
		{
			//	get array containing the input controls (radio buttons or check boxes)
			aInputControl = ctl.getElementsByTagName("INPUT");
			
			//	loop through child nodes to find the one selected
			ii = 0;
			intLength = aInputControl.length;
			for (ii; ii < intLength; ii++)
			{
				//	set checked = false
				aInputControl[ii].checked = false;
			}
		}
		catch (ex)
		{	throw ex;	}
		finally
		{
			//	clean up
			ctl = null;
			ii = null;
			intLength = null;
			aAnswer = null;
		}
	}
	
	this.SelectAllCheckBoxList = function (ctl)
	{
		var ii;
		var intLength;
		var aInputControl;
		
		try
		{
			//	get array containing the input controls (check boxes)
			aInputControl = ctl.getElementsByTagName("INPUT");
			
			//	loop through child nodes and select each
			ii = 0;
			intLength = aInputControl.length;
			for (ii; ii < intLength; ii++)
			{
				//	set checked = true
				aInputControl[ii].Selected = true;
				aInputControl[ii].checked = true;
			}
		}
		catch (ex)
		{	throw ex;	}
		finally
		{
			//	clean up
			ctl = null;
			ii = null;
			intLength = null;
			aAnswer = null;
		}
	}
	
	this.GetDropDownListListBoxAnswer =	function (blnSingleAnswer, ctl)
	{
		var ii;
		var intLength;
		var aAnswer;
		var aInputControl;
		
		try
		{
			//	create the array to hold the answer
			aAnswer = new Array();
			
			//	get array containing the input controls (radio buttons or check boxes)
			aInputControl = ctl.getElementsByTagName("OPTION");
			
			//	loop through child nodes to find the one selected
			ii = 0;
			intLength = aInputControl.length;
			for (ii; ii < intLength; ii++)
			{
				//	determine if answer selected
				if (aInputControl[ii].selected)
				{	
					//	selected answer found
					aAnswer[aAnswer.length] = aInputControl[ii].outerText;
					if (blnSingleAnswer){	break;	}
				}
			}
			return aAnswer;
		}
		catch (ex)
		{	throw ex;	}
		finally
		{
			//	clean up
			blnSingleAnswer = null;
			ctl = null;
			ii = null;
			intLength = null;
			aAnswer = null;
			aInputControl = null;
		}
	}
	
	this.GetDropDownListListBoxValue =	function (blnSingleAnswer, ctl)
	{
		var ii;
		var intLength;
		var aValue;
		var actlOption;
		
		try
		{
			//	create the array to hold the value
			aValue = new Array();
			
			//	get array containing the Option controls
			actlOption = ctl.getElementsByTagName("OPTION");
			
			//	loop through child nodes to find the one selected
			ii = 0;
			intLength = actlOption.length;
			for (ii; ii < intLength; ii++)
			{
				//	determine if answer selected
				if (actlOption[ii].selected)
				{	
					//	selected value found
					aValue[aValue.length] = actlOption[ii].value;
					if (blnSingleAnswer){	break;	}
				}
			}
			return aValue;
		}
		catch (ex)
		{	throw ex;	}
		finally
		{
			//	clean up
			blnSingleAnswer = null;
			ctl = null;
			ii = null;
			intLength = null;
			aValue = null;
			actlOption = null;
		}
	}
	
	this.ResetDropDownListListBox =	function (blnDropDownList, ctl)
	{
		var ii;
		var intLength;
		var aInputControl;
		
		try
		{
			//	get array containing the input controls (radio buttons or check boxes)
			aInputControl = ctl.getElementsByTagName("OPTION");
			
			if (blnDropDownList)
			//	control is a drop down list
			//	select the first item
			{	aInputControl[0].selected = true;	}
			else
			//	loop through child nodes to find the one(s) selected
			{
				ii = 0;
				intLength = aInputControl.length;
				for (ii; ii < intLength; ii++)
				{				
					//	set selected = false
					aInputControl[ii].selected = false;
				}
			}
		}
		catch (ex)
		{	throw ex;	}
		finally
		{
			//	clean up
			ctl = null;
			ii = null;
			intLength = null;
		}
	}
	
	
	this.GetControlPrefix = function (strControlName, strControlNameWithPrefix)
	{
		try
		{
			return strControlNameWithPrefix.slice(0, strControlNameWithPrefix.indexOf(strControlName));
		}
		catch (ex)
		{	alert("Error encountered.  " + ex.description);	}
		finally
		{
			//	clean up
			strControlName = null;
			strControlNameWithPrefix = null;
		}
	}

	//******************************************************************************************************
	
	return;
	
	//	Private Methods
	//******************************************************************************************************
	
	//******************************************************************************************************
}