
YAHOO.util.Event.onDOMReady(function() {
	// If the hash indicates a valid page, load it and expand any necessary parts.
	var m;
	
	// In Safari, location.hash will be escaped as with encodeURIComponent.
	// Since percents don't appear in there otherwise, it's recoverable.
	var page = location.hash.match("%") ? decodeURIComponent(location.hash) : location.hash;
	
	if (m = page.match(/^#([a-z0-9\'\-\u80-\uffff]+\/[a-z0-9\'\-\u80-\uffff]*)$/))
	{
		// If that's a URL in the side menu, open it.
		var anchor = YAHOO.util.Selector.query("a[href=/services/" + m[1] + "]", YAHOO.util.Dom.get("subnav"))[0];
		if (anchor)
		{
			sidenav.expandEl(YAHOO.util.Selector.query('ul', anchor.parentNode, true) || anchor.parentNode.parentNode);
			ajaxpage.load(anchor);
		}
		else
		{
			// If not in the side menu, consult it anyway. 
			ajaxpage.loadUrl("/services/"+m[1]);
		}
	}
})
