// id, dir, left, top, width, height
var browser = navigator.appName
var myMenu1 = new ypSlideOutMenu("menu1", "down", -10, 92, 200, 200);
var myMenu2 = new ypSlideOutMenu("menu2", "down", -10, 92, 200, 200);
var myMenu3 = new ypSlideOutMenu("menu3", "down", -10, 92, 112, 200);
var myMenu4 = new ypSlideOutMenu("menu4", "down", -10, 92, 91, 200);

var topadd = browser == "Netscape" ? (-30) : 0;

// for each menu, we set up hte onactivate event to call repositionMenu with the amount offset from center, in pixels
myMenu1.onactivate = function() { repositionMenu(myMenu1, -297); }
myMenu2.onactivate = function() { repositionMenu(myMenu2, -212); }
myMenu3.onactivate = function() { repositionMenu(myMenu3, -83); }
myMenu4.onactivate = function() { repositionMenu(myMenu4, 284); }

// this function repositions a menu to the speicified offset from center
function repositionMenu(menu, offset) {
	var newLeft = getWindowWidth() / 2 + offset;
	newLeft = browser == "Netscape" ? (newLeft - 8) : newLeft
	menu.container.style ? menu.container.style.left = newLeft + "px" : menu.container.left = newLeft;
}

function getWindowWidth() {
	return window.innerWidth ? window.innerWidth : document.body.offsetWidth;
}	

function getWindowWidth() {
	BrowserWidth = window.innerWidth ? window.innerWidth : document.body.offsetWidth;
	return (BrowserWidth < 761 ) ? 761 : BrowserWidth;
}
