def buildLabel(nodeId, labelText, labelLink):
    """Build a label cell

    nodeId -- name of the node that the popup refers to
    labelText -- text of the label itself
    labelLink -- link to follow when label is clicked (if any)
    """

    if len(labelLink) > 0:
        onClick = ''
        href = labelLink
    else:    
        onClick = '\nonclick="return false;"'
        href = 'javascript:;'

    html = """<tr>
<td class="labelscell" nowrap="nowrap">
<a
href="%s"
onmouseout="javascript:hideNode('%s')"
onmouseover="javascript:showNode('%s')"
target="_top"
class="labellink"%s>%s</a></td>
<td><img src="img-static/no.gif" width="1" height="13" alt="" border="0" /></td>
</tr>\n
""" % (href, nodeId, nodeId, onClick, labelText)

    return html