/* Validate from text if checkbox has been selected.

 * Accepts a list of one to many form elements as parameters.

 */



function SetCbxFromText(pText, pCbx)

{

	if ((pText.value == "0") | (pText.value <= "  "))

		pCbx.checked = false;

	else

		pCbx.checked = true;



	return true;

}



/* Validate from checkbox the text value of the checkbox.

 * Accepts a list of one to many form elements as parameters.

 */



function SetTextFromCbx(pCbx, pText)

{

	if (pCbx.checked)

		pText.value = pCbx.value;

	else

		pText.value = "0";



	return true;

}





/* Sets or clears check box based on value of pbit in ptext parameter. 

 * Accepts a list of one to many form elements as parameters.

 * No longer in use.

 */



function SetCbxFromBitMask(pCbx, pText, pBit)

{

	if (  ( parseInt(pText.value) & Math.pow( 2, (pBit -1) )) > 0 )

		pCbx.checked = true;

	else

		pCbx.checked = false;

	return true;

}



/* Sets or clears check box based on value of ptext parameter.

 * Accepts a list of one to many form elements as parameters.

 * No longer in use.

 */



function SetBitMaskFromCBX(pCbx, pText, pBit)

{

	if (pCbx.checked)

	{

		pText.value =   parseInt(pText.value) | Math.pow(2, (pBit-1))

	}

	else

	{

		pText.value =   parseInt(pText.value) ^ Math.pow(2, (pBit-1))

	}

	return true;

}



/* Sets value of p2 to p1.

 * Accepts a list of one to many form elements as parameters.

 */



function SetValueFromValue(pInput1, pInput2)

{

	pInput2.value = pInput1.value;

	return true;

}



/* Validates radio list selection.

 * Accepts a list of one to many form elements as parameters.

 */



function SetCheckboxByValue(pCbx, pValue)

{

	if (pValue == 0) 

		pCbx.checked = false

	else

		pCbx.checked = true;		

}







/* Validates radio list selection.

 * Accepts a list of one to many form elements as parameters.

 */



function SetRadioByValue(pRadio, pValue)

{

	for (i = 0; i < pRadio.length; i++)

	{

		if (pRadio[i].value == pValue)

		{

			pRadio[i].checked = true;

			return;

		}

	}

}