function refreshChildNodes(strCBID,chkChildId,chkParentId)
{
	var strCheckId, strSplit, strParent, i,thisCheckBox, arrCheckBoxes;
	
	enableSpans();
	
	strCBID = strCBID.replace(":","_");
	thisCheckBox = document.getElementById(strCBID+"$"+chkParentId+"$"+chkChildId+"$");
	arrCheckBoxes = document.getElementsByTagName("input");
	//alert(strCBID+"$"+chkParentId+"$"+chkChildId+"$");
	
	for (i=0; i< arrCheckBoxes.length; i++)
	{
			strCheckId = arrCheckBoxes[i].id;
			strSplit = strCheckId.split("$");
			strParent = strSplit[1];
			//alert(strParent)
			if (strParent == chkChildId && arrCheckBoxes[i].id!=thisCheckBox.id)
			{
				if (thisCheckBox.checked)
				{
					arrCheckBoxes[i].checked = true;
					arrCheckBoxes[i].disabled="disabled";
					//alert(arrCheckBoxes[i].id);
				}
				else
				{
					arrCheckBoxes[i].checked = false;
					document.getElementById(arrCheckBoxes[i].id).disabled = false;
				}
			}
	}
	
	
	for (i=0; i< arrCheckBoxes.length; i++)
	{
			strCheckId = arrCheckBoxes[i].id;
			strSplit = strCheckId.split("$");
			strParent = strSplit[1];
			
			if (strParent == chkChildId && arrCheckBoxes[i].id != thisCheckBox.id)
			{
				//alert(strParent + "--"+chkChildId +"&&"+ arrCheckBoxes[i].id+"--"+thisCheckBox.id);
				if (thisCheckBox.checked)
				{
					arrCheckBoxes[i].checked = true;
					//alert(arrCheckBoxes[i].id);
					refreshChildNodes(strCBID,arrCheckBoxes[i].id.split("$")[2],arrCheckBoxes[i].id.split("$")[1]);
				}
				else
				{
					arrCheckBoxes[i].checked = false;
					refreshChildNodes(strCBID,arrCheckBoxes[i].id.split("$")[2],arrCheckBoxes[i].id.split("$")[1]);
				}
			}
	}

}

function openEditSame(sURL)
{
	window.open(sURL, "_self");
}

function enableAllTicked()
{
	enableSpans();
	var arrCheckBoxes = document.getElementsByTagName("input");
	for (i=0; i< arrCheckBoxes.length; i++)
	{
				if (arrCheckBoxes[i].disabled)
				{
					arrCheckBoxes[i].checked = true
					document.getElementById(arrCheckBoxes[i].id).disabled = false;
					//alert(arrCheckBoxes[i].id);
				}
	}
	//ValidatorOnSubmit();
	//document.Form1.submit();
}

function deleteConfirm(sURL,menuName)
{
	var replaceText = /'/g;
	var sParseVal = menuName.replace(replaceText, "");
				
	var x=confirm("Do you want to delete "+ sParseVal +  " ?");
	if (x==true)
		openEditSame(sURL);
		//alert("Are you sure you want to Delete Menu Item?");
	
}

function deleteConfirmFeedback(sURL,menuName)
{
	var x=confirm('Do you want to delete '+menuName+ ' ?');
	if (x==true)
		openEdit(sURL,300,500);
		//alert("Are you sure you want to Delete Menu Item?");
	
}

function enableSpans()
{
	var arrSpans = document.getElementsByTagName("span");
	for(h=0; h<arrSpans.length; h++)
	{
		arrSpans[h].disabled = false;
	}
}