How to know, if on taxonomy page?
You could try menu_get_object(), it's slightly cleaner:

$term = menu_get_object('taxonomy_term', 2);
if ($term) {
  // You're on a term page and have the loaded object in $term
}