// JavaScript Document

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//write NN4 stylesheet if not version5 browser
if(!document.getElementById){
document.write('<link href="/css/nonstandard2.css" rel="stylesheet" type="text/css" />');
document.close();
}

// Popup Menus
// created by Jamin Hegeman, Web Specialist
// University of Pittsburgh Web Team
// 2004

document.onclick = hideAllMenus;

var numMenus = 10
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"
	document.getElementById('nav' + subMenu.substr(4,6)).style.fontWeight="bold"			
}

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"
			document.getElementById('nav' + counter).style.fontWeight="normal"	
  	}
	}
}

function timerOn() {
	timeout = setTimeout("hideAllMenus()", 700)
}
function timerOff() {
	clearTimeout(timeout)
}

function newWindow(url){
	urlWindow = window.open(url, "urlWindow", "scrollbars=yes,width=600,height=600")
	urlWindow.focus()
}

function checkForm(form){
	choice1 = form.choice1.selectedIndex
	choice2 = form.choice2.selectedIndex
	choice3 = form.choice3.selectedIndex

	if(!form.lname.value){
		alert("Please enter a Last Name")
		return false
	}
	else if(!form.fname.value){
		alert("Please enter a First Name")
		return false
	}
	else if(!form.userid.value){
		alert("Please enter a User ID")
		return false
	}
	else if(!form.ssn.value || isNaN(form.ssn.value)){
		alert("Please enter the last 4 digits of your Social Security Number")
		return false
	}
	else if(form.ssn.value.length != 4){
		alert("Please enter only the last 4 digits of your Social Security Number")
		return false
	}
	else if(choice1 == 0 || choice2 == 0 || choice3 == 0)
	{	
		alert("You must pick three different programs!")
		return false
	}
	else if(choice1 == choice2 || choice2 == choice3 || choice3 == choice1 )
	{
		alert("You have selected the same program more than once. You must have three different choices!")
		return false
	}
	return true
}
function newWindow(url, options){
	urlWindow = window.open(url, "urlWindow", options)
	urlWindow.focus()
}