improved logic for determining active state of header navs