Adding classes to menu items
have a look at l() function in includes/common.inc:

...
if (($path == $_GET['q'] || ($path == '&lt;front&gt;' &amp;&amp; drupal_is_front_page())) &amp;&amp;
    (empty($options['language']) || $options['language']-&gt;language == $language_url-&gt;language)) {
  $options['attributes']['class'][] = 'active';
}
...