$(document).ready(function(){

	/*
	 * XmlSiteMapProvider multiple nodes can't be the same url, but for products
   * since there's no landing page, we're linking to the first subitem.
   *
   * remove the query string appended to the url (# or ##)
	 */
	$('ul#Menu a[href$="#"]').each(function() {
		/*var href = $(this).attr('href');
		$(this).attr('href', href.substring(0, href.length - 1));*/
		var href = $(this).attr('href');
		$(this).attr('href', href.replace('##', ''));
		$(this).attr('href', href.replace('#', ''));
	});

	/*
   * the menu system allows an item to occur in one place / one area
   * we need the subitems to appear both as a dropdown in the topnav & in the
   * sidebar.
	 *
	 * placing all elements in the main menu and cloning for the sidebar
	 */
	$submenu = $('ul#Menu li.selected div ul:first');
	if ($submenu.length && $('#Left').length) {
		// if there's already a submenu, hide it
		$('#Left #SubMenu').hide();

		// make a copy of the submenu and add it to the left sidebar
		$submenu.clone().attr('id', 'SubMenu').appendTo('#Left');
		$('#SocialLinks').appendTo('#Left');
	}

	// IE7: the top dropdown appears underneath the left nav
	if ($('div.Menu').css('position') == 'absolute') {
		// center with rest of page
		offset = $('#Left').offset();
		$('div.Menu').css('left', offset.left);
		// to prevent the menu from looking like it's *jumping* from left to center
		// ie7.css sets display:none, remove that now
		$('div.Menu').css('display', 'block');
		// absolute positioning takes the height out of the flow of the page
		$('#Left').css('margin-top', '3em');
		$('#Content').css('margin-top', '3em');
	}

})
