I use a similar technique in a constant sum question but instead of having a check box to tick, I have a "don't know" entry as part of the constant sum question. No check box required.
strErrorMessage="You must select a response for Don't know of 0% or 100%. Please review your answers before continuing.";
Looking at your script, I don't think you need to check the ".length". Can't you apply the conditions by using "document.mainform["Q54_r8_c1"].value"?
And I suspect part of your problem is this is a constructed list and your conditions are assuming all codes are present, hence why it works off the parent list and not the constructed list.