function getPosition(e) {
	var left = 0;
	var top  = 0;

	while (e.offsetParent) {
		left += e.offsetLeft;
		top  += e.offsetTop;
		e     = e.offsetParent;
	}

	left += e.offsetLeft;
	top  += e.offsetTop;

	return {x:left, y:top};
}

var timeOut;
var currPopOut;
var currMenu;

function Menu(title, menuTitleClass, menuItemClass) {
	this.title = title;
	this.options = new Array();
	this.titleStyle = menuTitleClass;
	this.itemStyle = menuItemClass;
}

function menuItem(item,link) {
		this.itemName = item;
		this.link = link;
}

function menuMouseOver(item) {
	currMenu = item;
	currMenu.style.backgroundColor = "#8b232c";
	currPopOut = document.getElementById("popOut" + currMenu.id.substring(4));
	currPopOut.style.display = "block";

	var m;
	for (var i = 0; i < Menus.length; i++) {
		if (currPopOut != (m = document.getElementById("popOut" + i))) m.style.display = "none";
		if (currMenu != (m = document.getElementById("menu" + i))) m.style.backgroundColor = "#d3d3d3";
	}

	var pos = getPosition(currMenu);
	currPopOut.style.top = pos.y + 25;
	currPopOut.style.left = pos.x;
	clearTimeout(timeOut);
}

function menuMouseOut(currMenu) {
	timeOut = setTimeout('hideMenu(currMenu)',300);
}

function listMouseOver(currPopOut) {
	clearTimeout(timeOut);
	currPopOut.style.display = "block";
}

function listMouseOut(currPopOut) {
	timeOut = setTimeout('hideMenu(currMenu)',300);
}

function hideMenu() {
	currMenu.style.backgroundColor = "#8B232C";
	currPopOut.style.display = "none";
}

var Menus = [];
Menus[0] = new Menu("Select Week     <img src='arrow.gif'>", "mt_style", "mi_style");


// ####### NEW MENU ITEMS ADDED HERE ##############
Menus[0].options[31] = new menuItem("About Me", "about.html");
Menus[0].options[30] = new menuItem("9.26.06 - Fall '06 - 1", "1.html");
Menus[0].options[29] = new menuItem("Variations on a Chanel Skirt" , "2.html");
Menus[0].options[28] = new menuItem("Favorite Editorial Pics!" , "3.html");
Menus[0].options[27] = new menuItem("Two Ladies: A Vignette" , "4.html");
Menus[0].options[26] = new menuItem("10.03.06 - Fall '06 - 2" , "5.html");
Menus[0].options[25] = new menuItem("10.10.06 - Fall '05 - 1" , "6.html");
Menus[0].options[24] = new menuItem("10.17.06 - Fall '05 - 2" , "7.html");
Menus[0].options[23] = new menuItem("10.24.06 - Spring '07 - 1" , "8.html");
Menus[0].options[22] = new menuItem("Halloween Special" , "9.html");
Menus[0].options[21] = new menuItem("10.31.06 - Spring '07 - 2" , "10.html");
Menus[0].options[20] = new menuItem("11.07.06 - Spring '07 - 3" , "11.html");
Menus[0].options[19] = new menuItem("11.14.06 - HC Fall '06" , "12.html");
Menus[0].options[18] = new menuItem("11.21.06 - Spring '06 - 1" , "13.html");
Menus[0].options[17] = new menuItem("11.28.06 - Spring '06 - 2" , "14.html");
Menus[0].options[16] = new menuItem("12.05.06 - Spring '07 - Men" , "15.html");
Menus[0].options[15] = new menuItem("12.12.06 - Fall '06 - Men" , "16.html");
Menus[0].options[14] = new menuItem("12.19.06 - Best of B&W" , "17.html");
Menus[0].options[13] = new menuItem("2.26.06 - Crazy Pix" , "18.html");
Menus[0].options[12] = new menuItem("1.02.07 - Magazine Pix - 1" , "19.html");
Menus[0].options[11] = new menuItem("1.09.07 - Magazine Pix - 2" , "20.html");
Menus[0].options[10] = new menuItem("1.16.07 - Magazine Pix - 3" , "21.html");
Menus[0].options[9] = new menuItem("1.23.07 - Magazine Pix - 4" , "22.html");
Menus[0].options[8] = new menuItem("1.30.07 - Magazine Pix - 5" , "23.html");
Menus[0].options[7] = new menuItem("2.08.07 - Women of Letters" , "24.html");
Menus[0].options[6] = new menuItem("2.13.07 - Love Songs!" , "valentinesvids.html");
Menus[0].options[5] = new menuItem("2.13.07 - Love Special - 1" , "25.html");
Menus[0].options[4] = new menuItem("2.20.07 - New Intro" , "intro.html");
Menus[0].options[3] = new menuItem("2.20.07 - Love Special - 2" , "26.html");
Menus[0].options[2] = new menuItem("2.27.07 - Love Special - 3" , "27.html");
Menus[0].options[1] = new menuItem("2.27.07 - Fashion, Money & Power" , "28.html");
Menus[0].options[0] = new menuItem("2.27.07 - From Russia..." , "29.html");

// #################################################


function createMenus() {
	for (var i = 0; i < Menus.length; i++) {
		document.write("<div id = 'menu" + i + "' class = '" + Menus[i].titleStyle + "' style = 'float: left; cursor: pointer'\
			onmouseover = 'menuMouseOver(this)' onmouseout = 'menuMouseOut(this)'>" + Menus[i].title + "</div>")
		currMenu = document.getElementById("menu"+i);
		var menubar = document.getElementById("menubar");
		menubar.appendChild(currMenu);

		document.write("<div id = 'popOut" + i + "' style = 'display:none; position:absolute; cursor: pointer; overflow:auto; height:300px;' onmouseover='listMouseOver(this)' onmouseout='listMouseOut(this)'><table cellpadding = '5' cellspacing = '0'>");
		for (var n = 0; n < Menus[i].options.length; n++) {
				document.write("<tr><td class = '" + Menus[i].itemStyle + "' onmouseover = 'this.style.backgroundColor = \"#8B232C\"' onmouseout = 'this.style.backgroundColor = \"#f9fafb\"' onmousedown='window.location=(\""+Menus[i].options[n].link+"\")'>" + Menus[i].options[n].itemName + "</td></tr>");
		}
		document.write("</table></div>");
	}
}

		
