var currentMenu = null;

var sub_cell_bottom_high = new Image();
sub_cell_bottom_high.src = "/hyperspace/img/nav/sub_cell_bottom_high.gif";
var sub_cell_bottom = new Image();
sub_cell_bottom.src = "/hyperspace/img/nav/bottom.gif";
var sub_cell_extras_bottom = new Image();
sub_cell_extras_bottom.src = "/hyperspace/img/nav/bottom_extras.gif";
var sub_cell_extras_bottom_high = new Image();
sub_cell_extras_bottom_high.src = "/hyperspace/img/nav/sub_bottom_extras_high.gif";
var sub_cell_exclusives_bottom = new Image();
sub_cell_exclusives_bottom.src = "/hyperspace/img/nav/bottom_exclusives.gif";
var sub_cell_exclusives_bottom_high = new Image();
sub_cell_exclusives_bottom_high.src = "/hyperspace/img/nav/sub_bottom_exclusives_high.gif";

var subNavArray =  new Array("aboutDrop", "exclusivesDrop", "extrasDrop");
var showPop = false;

function initSubNav() {
	
	for(x=0; x<subNavArray.length; x++) {
		var myMenu = document.getElementById(subNavArray[x]);
		currentTop = parseInt(myMenu.style.top);
		if(headAd == true) {
			myMenu.style.top = currentTop+107;
		}
	}
	
	showPop = true;
}

 function changeSubBG(cell) {
	if(is.ie5 || is.ie6 || is.ns6) {
		document.getElementById(cell).style.backgroundImage = 'url("/hyperspace/img/dropdowns/cell_high.gif")';
		document.getElementById(cell+'_bullet').style.backgroundImage = 'url("/hyperspace/img/dropdowns/cell_high.gif")';
		switch(cell) {
			case "about_link_4":
				document[cell+'_bottom'].src=eval("sub_cell_bottom_high.src");
				break;
			case "exclusives_link_15":
				document[cell+'_bottom'].src=eval("sub_cell_exclusives_bottom_high.src");
				break;
			case "extras_link_6":
				document[cell+'_bottom'].src=eval("sub_cell_extras_bottom_high.src");
				break;
		default:
			break;
		}
	}
	
}
 
 function removeSubBG(cell) {
	 if(is.ie5 || is.ie6 || is.ns6) {
		 document.getElementById(cell).style.backgroundImage = 'url("")';
		 document.getElementById(cell+'_bullet').style.backgroundImage = 'url("")';
		switch(cell) {
			case "about_link_4":
				document[cell+'_bottom'].src=eval("sub_cell_bottom.src");
				break;
			case "exclusives_link_15":
				document[cell+'_bottom'].src=eval("sub_cell_exclusives_bottom.src");
				break;
			case "extras_link_6":
				document[cell+'_bottom'].src=eval("sub_cell_extras_bottom.src");
				break;
			default:
				break;
		}
	}

 }
 function adjustSubLeftPos(menuItem) {
	 // off center #s
	 var aboutDrop = 211;
	 var exclusivesDrop = 78;
	 var extrasDrop = -63;
	 var windowPos = 0;
	 
	if(is.ns6) { body = window.innerWidth; }
	if(is.ie || is.opera) { body = document.body.clientWidth; }

	var bodyCenter = body/2;				// Find the center of the browser window
	if(no_bananas != true) {
	var centerLine = 402.5;
	if(!is.subscriber && typeof(world) != "undefined") {
		aboutDrop += 85;
		exclusivesDrop += 85;
		extrasDrop += 85;
		centerLine = 487.5;
	 }
	}
	 
	 
	switch(menuItem) {
		case "aboutDrop":
			windowPos = bodyCenter - aboutDrop;
			if(bodyCenter <= centerLine) windowPos = 192;
			break;
		case "exclusivesDrop":
			windowPos = bodyCenter - exclusivesDrop;
			if(bodyCenter <= centerLine) windowPos = 325;
			break;
		case "extrasDrop":
			windowPos = bodyCenter - extrasDrop;
			if(bodyCenter <= centerLine) windowPos = 465;
			break;
		default:
			break;
	}
	
	var myMenu = document.getElementById(menuItem);
	myMenu.style.left = windowPos;

}

function showSubMenu(menuItem) {
	
	if(is.ns6 || is.ns7 || is.ie5 || is.ie6 || is.opera7) {
		if(menuItem != currentMenu && currentMenu != null) {
			hideMenu();
		}
		
		if(is.ns6) { body = window.innerWidth; }
		if(is.ie) { body = document.body.clientWidth; }
	
			var myMenu = document.getElementById(menuItem);
			adjustSubLeftPos(menuItem);
			myMenu.style.visibility = "visible";
			currentMenu = menuItem;
	}
}

var about_off = new Image();
about_off.src = "/hyperspace/img/nav/about_off.gif";
var about_on = new Image();
about_on.src = "/hyperspace/img/nav/about_on.gif";


var exclusives_off = new Image();
exclusives_off.src = "/hyperspace/img/nav/exclusives_off.gif";
var exclusives_on = new Image();
exclusives_on.src = "/hyperspace/img/nav/exclusives_on.gif";

var extras_off = new Image();
extras_off.src = "/hyperspace/img/nav/extras_off.gif";
var extras_on = new Image();
extras_on.src = "/hyperspace/img/nav/extras_on.gif";

function swapImgOn(img) {
		document[img].src = eval(img+"_on.src");
}

function swapImgOff(img) {
	document[img].src = eval(img+"_off.src");
}


