Hello. I would recommend making the tooltips output themable. This way, if a tooltip needed extra styling (like rounded corners or some such) that needed extra markup, or some extra class so different tooltips could have different formatting, the tooltip output would be available to be modified on the theme layer.

The basic idea is this. You implement hook_theme():

function tooltips_theme(){
  return array(
    'tooltips' => array(
      'arguments' => array('link' => '', 'tip' => ''),
    ),
  );
}

You define the theme function:

function theme_tooltips($link, $tip) {
  $output = '<a href="javascript:;" class="tooltip">' . $link 
                    . '<span>'. $tip .'</span></a>';
  return $output;
}

And in _tooltips_substitute() you replace :

      $replace[] = '<a href="javascript:;" class="tooltip">' . $link 
                    . '<span>'. $tip .'</span></a>';

with:

      $replace[] = theme('tooltips', $link, $tip);

Thanks.