// Popup Menus
// created by Jamin Hegeman, Web Specialist
// modified slighly by Dan Foley (dan@micamedia.com)
// University of Pittsburgh Web Team
// 2004

var popWin = null    // use this when referring to pop-up window
var popupWin = null
var winCount = 0
var winName = "popWin"

// Functions for popup windows
function openPopup(url, wx, wy) {

  winFeatures = getLocation(wx, wy, 'cen', 'cen')
  popupWin = window.open(url, '', "width=" + wx + ",height=" + wy + winFeatures)
  window.close()
}

// Use it like
// popup('URL', width, height,'', 'cen', 'cen')

function popup(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
  var left_margin = 30
  var top_margin = 30
  winName = "popWin"

  // close anything else that might be open
  closePopWin()

  if (popup.arguments.length >= 4)  // any additional features?
    	winFeatures = "," + winFeatures
  else
    	winFeatures = ""
  if (popup.arguments.length == 6)  // location specified
		   	winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
  else
    winFeatures += getLocation(winWidth, winHeight, left_margin, top_margin)
		popWin = window.open(winURL, winName, "width=" + winWidth
           + ",height=" + winHeight + winFeatures + ",scrollbars=yes")
  }
function closePopWin(){    // close pop-up window if it is open
    if(popWin != null) if(!popWin.closed) popWin.close()
  }
function getLocation(winWidth, winHeight, winLeft, winTop){
  return ""
  }


function getLocation(winWidth, winHeight, winLeft, winTop){
  var winLocation = ""
  if (winLeft < 0)
    winLeft = screen.width - winWidth + winLeft
  if (winTop < 0)
    winTop = screen.height - winHeight + winTop
  if (winTop == "cen")
    winTop = (screen.height - winHeight)/2 - 20
  if (winLeft == "cen")
    winLeft = (screen.width - winWidth)/2
  if (winLeft>0 & winTop>0)
    winLocation =  ",screenX=" + winLeft + ",left=" + winLeft
                + ",screenY=" + winTop + ",top=" + winTop
  else
    winLocation = ""
  return winLocation
  }
  
  
// used to make the red right column expand to 100%
function setHGT() {
	document.getElementById('rightcolumn').style.height=document.getElementById('homeContainer').offsetHeight+'px';
}

onload=setHGT;
document.onloadsetHGT;
document.onclick = hideAllMenus;

var numMenus = 11
var timeout = null

function showSubMenu(subMenu) {
	if (!document.getElementById) return;
	hideAllMenus()
	timerOff()
	document.getElementById(subMenu).style.visibility="visible"
	document.getElementById('content-cover').style.visibility="visible"
	document.getElementById('nav' + subMenu.substr(4,6)).style.color="#CC0000"			
}

function hideAllMenus() {
  for(counter = 1; counter <= numMenus; counter++) {
		if(document.getElementById('menu' + counter) != null) {
			document.getElementById('menu' + counter).style.visibility="hidden"
			document.getElementById('content-cover').style.visibility="hidden"
			document.getElementById('nav' + counter).style.color="#333333"
  	}
	}
}

function timerOn() {
	timeout = setTimeout("hideAllMenus()", 1200)
}
function timerOff() {
	clearTimeout(timeout)
}