//image rollover script

if (document.images) {
	
	smbulleton = new Image();
	smbulleton.src = "img/smbullet_on.gif";
	
	smbulletoff = new Image();
	smbulletoff.src = "img/smbullet.gif";
	
	smbullet1on = new Image();
	smbullet1on.src = "/img/smbullet_on.gif";
	
	smbullet1off = new Image();
	smbullet1off.src = "/img/smbullet.gif";
	
	smbullet2on = new Image();
	smbullet2on.src = "/img/smbullet_on.gif";
	
	smbullet2off = new Image();
	smbullet2off.src = "/img/smbullet.gif";
}

function changeImage() {
	if (document.images) {
		for (var i=0; i<changeImage.arguments.length; i+=2) {
			document[changeImage.arguments[i]].src = eval(changeImage.arguments[i+1] + ".src");
		}
	}
}

//menu pulldown script, editable section

var ReMenu = new Array(5)
ReMenu[0] = '<a href="/research/stats.html">Computational Statistics and Simulation</a>'
ReMenu[1] = '<a href="/research/humanfactors.html">Human Factors</a>'
ReMenu[2] = '<a href="/research/optimization.html">Optimization and Control</a>'
ReMenu[3] = '<a href="/research/risk.html">Risk and Decision Analysis</a>'
ReMenu[4] = '<a href="/research/integration.html">Systems Integration</a>'

var GrMenu = new Array(11)
GrMenu[0] = '<a href="/students/currentgrads.html">Current Students</a>'
GrMenu[1] = '<a href="/students/grad_degrees.html">Degrees</a>'
GrMenu[2] = '<a href="/weekend/" target="external">Accelerated Masters Program</a>'
GrMenu[3] = '<a href="/students/grad_admissions.html">Admissions</a>'
GrMenu[4] = '<a href="/students/grad_preapp.shtml">Pre-application</a>'
GrMenu[5] = '<a href="/students/grad_computing.html">Computing</a>'
GrMenu[6] = '<a href="https://sisuva.admin.virginia.edu/psp/epprd/EMPLOYEE/PSFT_HR_CSPRD/c/COMMUNITY_ACCESS.SSS_BROWSE_CATLG.GBL?TAB=TEST&FolderPath=PORTAL_ROOT_OBJECT.UV_HC_SSS_BROWSE_CATLG_GBL3&IsFolder=false&IgnoreParamTempl=FolderPath%2cIsFolder" target="external">Courses</a>'
GrMenu[7] = '<a href="/students/grad_concentrations.html">Concentrations</a>'
GrMenu[8] = '<a href="/students/grad_handbooks.html">Handbooks</a>'
GrMenu[9] = '<a href="/students/forms.html">Forms and Documentation</a>'
GrMenu[10] = '<a href="http://cgep.virginia.edu" target="external">CGEP</a>'

var UnMenu = new Array(10)
UnMenu[0] = '<a href="/students/undergrad_admissions.html">Admissions</a>'
UnMenu[1] = '<a href="/students/undergrad_computing.html">Computing</a>'
UnMenu[2] = '<a href="https://sisuva.admin.virginia.edu/psp/epprd/EMPLOYEE/PSFT_HR_CSPRD/c/COMMUNITY_ACCESS.SSS_BROWSE_CATLG.GBL?TAB=TEST&FolderPath=PORTAL_ROOT_OBJECT.UV_HC_SSS_BROWSE_CATLG_GBL3&IsFolder=false&IgnoreParamTempl=FolderPath%2cIsFolder" target="external">Courses</a>'
UnMenu[3] = '<a href="/students/capstone.html">Capstone</a>'
UnMenu[4] = '<a href="/students/undergrad_curricula_and_policies.html">Curricula and Policies</a>'
UnMenu[5] = '<a href="/students/undergrad_electives.html">Electives</a>'
UnMenu[6] = '<a href="/students/undergrad_minors.html">Minors</a>'
UnMenu[7] = '<a href="/students/undergrad_sequences.html">Sequences</a>'
UnMenu[8] = '<a href="/students/forms.html">Forms and Documentation</a>'
UnMenu[9] = '<a href="/forms/merp.pdf">MERP</a>'

var PeMenu = new Array(4)
PeMenu[0] = '<a href="/people/faculty.html">Faculty</a>'
PeMenu[1] = '<a href="/people/researchstaff.html">Research Staff</a>'
PeMenu[2] = '<a href="/people/staff.html">Staff</a>'
PeMenu[3] = '<a href="/students/currentgrads.html">Current Graduate Students</a>'

var CaMenu = new Array(9)
CaMenu[0] = '<a href="http://www.google.com/calendar/embed?src=l29nou0egl31e83h4cf7qo5vg4%40group.calendar.google.com" target="external">OLS 002</a>'
CaMenu[1] = '<a href="http://www.google.com/calendar/embed?src=d2ud6j014217t9k74seouo0ihk%40group.calendar.google.com" target="external">OLS 101G</a>'
CaMenu[2] = '<a href="http://www.google.com/calendar/embed?src=secalendar%40gmail.com" target="external">OLS 102</a>'
CaMenu[3] = '<a href="http://www.google.com/calendar/embed?src=slrkl4kquk69kbn4orcf1no6do%40group.calendar.google.com" target="external">OLS 102</a>'
CaMenu[4] = '<a href="http://www.google.com/calendar/embed?src=slrkl4kquk69kbn4orcf1no6do%40group.calendar.google.com" target="external">OLS Table 102</a>'
CaMenu[5] = '<a href="http://www.google.com/calendar/embed?src=actrecnr9ctnofve5nr1jsq4l4%40group.calendar.google.com" target="external">OLS 105</a>'
CaMenu[6] = '<a href="http://www.google.com/calendar/embed?src=25836b65hjn8mg2gbnivg6i0qg%40group.calendar.google.com" target="external">Department</a>'
CaMenu[7] = '<a href="http://www.google.com/calendar/embed?src=04r0fhl2tjr353l2fqkte8is54%40group.calendar.google.com" target="external">Grad Students</a>'
CaMenu[8] = '<a href="/contact/calendars.html">Calendars and Reservations</a>'

var CoMenu = new Array(3)
CoMenu[0] = '<a href="/contact/index.html">Department</a>'
CoMenu[1] = '<a href="/contact/website.html">Website Feedback</a>'
CoMenu[2] = '<a href="/contact/directions.html">Directions</a>'


var VaMenu = new Array(8)
VaMenu[0] = '<a href="http://www.seas.virginia.edu/" target="external">Engineering</a>'
VaMenu[1] = '<a href="http://www.mail.virginia.edu/" target="external">Webmail</a>'
VaMenu[2] = '<a href="http://www.virginia.edu/dir.html" target="external">People/Web Search&nbsp;</a>'
VaMenu[3] = '<a href="http://www.lib.virginia.edu/" target="external">Library</a>'
VaMenu[4] = '<a href="http://www.virginia.edu/Calendar/" target="external">Calendar</a>'
VaMenu[5] = '<a href="http://www.virginia.edu/Map/" target="external">Map</a>'
VaMenu[6] = '<a href="http://www.virginia.edu/OfAlum.html" target="external">UVA Alumni</a>'
VaMenu[7] = '<a href="http://www.virginia.edu/website.html" target="external">A - Z Index</a>'
		
		
var menuwidth='165px' 
var menubgcolor='000033' 
var disappeardelay=250 
var hidemenu_onclick="yes"

//menu pulldown script, stuff you probably shouldn't play with

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ 
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) 
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu
