From memory I don't believe ezurl() takes into account the SiteURL setting within the [SiteSettings] block in site.ini. If this is infact the case then the domain name would be based on HTTP_HOST which is an environment variable defined by Apache.
To work around this you would have to customise your menu template and conditionally change those URLs for specific subtrees.