function clearText(caller)
{
	if (caller.checked == true)
	{
		var callingName = caller.name;
		callingName = callingName.substring(0, callingName.length - 1);
		var objs = document.getElementsByName(callingName + '1_1');
		var txtBox = objs[0];

		txtBox.value = "";
	}
}

function clearCheck(caller)
{
	var callingName = caller.name;
	for (var i=0; i<2; i++){
		var LastIndexNum = callingName.lastIndexOf('_');
		callingName = callingName.substring(0, LastIndexNum);
	}	
	var objs = document.getElementsByName(callingName + '_2');
	for(x=0;x<objs.length;x++)
	{
  	var checkBox = objs[x];
  	checkBox.checked = false;
  }
}

function clearCheckFromRadio(callingName)
{
	/*var callingName = caller.name;
	for (var i=0; i<2; i++){
		var LastIndexNum = callingName.lastIndexOf('_');
		callingName = callingName.substring(0, LastIndexNum);
	}*/
	var objs = document.getElementsByName(callingName + '_1_1');
	for(x=0;x<objs.length;x++)
	{
  	var checkBox = objs[x];
  	checkBox.checked = false;
  }
}


function clearRadioFromCheck(callingName, numQ, numA)
{
	/*var callingName = caller.name;
	for (var i=0; i<2; i++){
		var LastIndexNum = callingName.lastIndexOf('_');
		callingName = callingName.substring(0, LastIndexNum);
	}*/
	for (var i=1; i<=numQ; i++){
	    var radioName = callingName + "_" + i + "_" + 1;
	    var radio = document.getElementsByName(radioName);
	    for (j=0; j<radio.length; j++)
	    {
        var loopRadio = radio[j];
        loopRadio.checked = false;
	    }
  }
}

function clearSpecificText(caller, itemsToClear)
{
	if (caller.checked == true)
	{
		var itemList = itemsToClear.split(',');
		for (var i = 0; i < itemList.length; i++)
		{
			var objs = document.getElementsByName(itemList[i]);
			if(objs.length>0)
			{
        var txtBox = objs[0];
			  txtBox.value = "";
			}
		}
	}
}

function clearSpecificText_To0(caller, itemsToClear, OtherNumber)
{
	if (caller.checked == true)
	{
		var itemList = itemsToClear.split(',');
		for (var i = 0; i < itemList.length; i++)
		{
			var objs = document.getElementsByName(itemList[i]);
			var txtBox = objs[0];
			if (txtBox.name != (OtherNumber)){
				txtBox.value = "0";
			} else {
				var OtherName = document.getElementsByName(txtBox.name+"_OTHER");
				txtBox.value = "";
				OtherName[0].value="";
			}
		}
	}
}

function clearSpecificTextTo0TwoLists(caller, itemsToClear1, itemsToClear2, OtherNumber)
{
  var itemsToClear = '';
  if (caller.name.substr(caller.name.indexOf('_')+1,1) == '1'){
    itemsToClear = itemsToClear1;
  } else {
    itemsToClear = itemsToClear2;
  }
	if (caller.checked == true)
	{
		var itemList = itemsToClear.split(',');
		for (var i = 0; i < itemList.length; i++)
		{
			var objs = document.getElementsByName(itemList[i]);
			var txtBox = objs[0];
			if (txtBox.name != (OtherNumber)){
				txtBox.value = "0";
			} else {
				var OtherName = document.getElementsByName(txtBox.name+"_OTHER");
				txtBox.value = "";
				OtherName[0].value="";
			}
		}
	}
}
