/* -- To check on the check box in control list */
function chk_Max(csID, inTotCount, inMaxSelected, csLabelNm)
{ 
	var inCtr; 
	var inCheckMaxCtr = 0;
	if (inTotCount > 0)
	{
		for (inCtr=0; inCtr <= inTotCount - 1; inCtr++)
			{ 
				var csCreatedID = csID + inCtr;
				if(window.document.getElementById(csCreatedID).checked==true)
				{
					inCheckMaxCtr	= inCheckMaxCtr + 1;
				}
			}
			if(inCheckMaxCtr > inMaxSelected)
			{
			alert("Please select atleast "  + inMaxSelected + " number from " + csLabelNm + ". ");
			return false;
			}
	} 
	return true;
}

/* -- To check Drop Down on the button */	
function chk_DropDown_OnButton(cmbName)	
{
	var cmbObject = window.document.getElementById(cmbName); 
	if((cmbObject.selectedIndex) == -1) 
	{return false;} return true;
}

/* -- To check Drop Down on the button */	
function chk_TextBox_OnButton(FieldName)	
{
	var cmbObject = window.document.getElementById(FieldName); 
	if((FieldName.value) == "") 
	{return false;} return true;
}

/*  set single radio in control to be selected */
function Set_Single_Radio_OnCtrl(csParentID, csRadioButtonID, csSelectedRadioButtonID, inTotCount)
{ 
	var inCtr; 
	if (inTotCount > 0)
	{
		for(inCtr=inTotCount; inCtr > 0; inCtr--)
			{
				var csCreatedID = csParentID + "__ctl" + inCtr + "_" + csRadioButtonID;
				if (csCreatedID==csSelectedRadioButtonID)
				{
					document.getElementById(csCreatedID).checked=true;	
				}
				else
				{
					document.getElementById(csCreatedID).checked=false;	
				}
			}
	} 
}

/* -- To check checkbox / Radio Button in control on the button */
function chk_OnCtrl_Max_OnBtn(csParentID, csID, inTotCount, inMaxSelected)
{
	var inCtr;
	var inCheckMaxCtr = 0;
	
	if (inTotCount > 0)
	{
		for (inCtr=0; inCtr <= inTotCount - 1; inCtr++)
			{ 
				var csCreatedID = csParentID + "__ctl" + inCtr + "_" + csID;
				if(window.document.getElementById(csCreatedID).checked==true)
				{
					inCheckMaxCtr	= inCheckMaxCtr + 1;
				}
			}
			if(inCheckMaxCtr != inMaxSelected) return false;
	} 
	return true;
}
/* -- Checkbox List / Radio Button List on the button */
	function chkList_Max_OnBtn(csListID, inTotCount, inMaxSelected)
	{
		var inCtr;
		var inCheckMaxCtr = 0;
		if (inTotCount > 0)
		{
			for (inCtr=0; inCtr <= inTotCount - 1; inCtr++)
				{ 
					var csCreatedID = csListID + "_" + inCtr;
					if(window.document.getElementById(csCreatedID).checked==true)
					{
						inCheckMaxCtr	= inCheckMaxCtr + 1;
					}
				}
				if(inCheckMaxCtr < inMaxSelected) return false;
		} 
		return true;
	}

