                    tiptext = '<br>'.join(titletext)
                    maketip_js.append("maketip('%s','%s','%s');" % (tipname, tiptitle, tiptext))
                    onmouse = '''onMouseOver="tip('%s')" onMouseOut="untip()"''' % tipname
                    
                    # gsg 2005-11-15 - change background colour depending on contents of heading 1
                    lowertip = tiptext.lower()
                    if lowertip.find('appointment') >= 0:
                        r, g, b, u = (255, 200, 200, 1)
                    elif lowertip.find('to do') >= 0:
                        r, g, b, u = (200, 200, 255, 1)
                    else:
                        r, g, b, u = (200, 255, 200, 1)
