var myArticles = new ypSlideOutMenu("articles", "down", 426, 29, 200, 150);
var myStore = new ypSlideOutMenu("store", "down", 426, 29, 200, 125);

// for each menu, we set up the onactivate event to call repositionMenu with the amount offset from center, in pixels
myArticles.onactivate = function() { repositionMenu(myArticles, -85); }
myStore.onactivate = function() { repositionMenu(myStore, 3); }

// this function repositions a menu to the speicified offset from center
function repositionMenu(menu, offset) {
	/* getWindowWidth and compare to the width of content,
	if windowSize is greater than contentWidth , then centerLine = windowSize / 2
	else window is smaller than content, so then centerLine = contentWidth / 2
	newLeft = centerLine + offset    */
	var contentWidth = 600;
	var windowSize = getWindowWidth();
	if (windowSize > contentWidth) var centerLine = windowSize / 2
	else var centerLine = contentWidth / 2;
	var newLeft = centerLine + offset;
	// adjust edge for MS IE6 win
	if (navigator.appName=='Microsoft Internet Explorer') {
		newLeft += 7;
	} 
	// add a few more pixels for mac users
	if (navigator.platform=='MacPPC') {
		newLeft += 3;
	}

	// setting the left position in netscape is a little different than IE
	menu.container.style ? menu.container.style.left = newLeft + "px" : menu.container.left = newLeft;
}

// this function calculates the window's width - different for IE and netscape
function getWindowWidth() {
	return window.innerWidth ? window.innerWidth : document.body.offsetWidth;
}
