function printemail(acctname)
{
    document.write('<a href="mailto:'+acctname+'@researchchicago.com" class="bodylinks">'+acctname+'@researchchicago.com</a>');
}

function numeric(data) {
    var valid="0123456789";
    var c;
    var result=true;
    if (data.length == 0) return false;
    for (i=0;i<data.length;i++) {
	c=data.charAt(i);
	if (valid.indexOf(c) == -1)
	   result=false;
    }
    return result;
}

var currentmenu;
var currenttimer;
function domouseover(which) {
    if (currentmenu != which && currentmenu != "" && typeof(currentmenu) != "undefined") {
        dotimedmouseout(currentmenu);
    }
    clearTimeout(currenttimer);
    currentmenu=which;
    if (document.getElementById('sub_'+which) != null) {
        document.getElementById('sub_'+which).style.visibility="visible";
        document.getElementById('sub_'+which).style.position="relative";
        document.getElementById('spacer').style.position="absolute";
    }
    document.getElementById('round_l_'+which).src=topdir+"/images/"+rolloverdir+"/toplinks_l_s.gif";
    document.getElementById('round_r_'+which).src=topdir+"/images/"+rolloverdir+"/toplinks_r_s.gif";
    document.getElementById('middlebg_'+which).style.backgroundImage="url('')";
    document.getElementById('link_'+which).className="toplinks_s";
}
function domouseout(which) {
    clearTimeout(currenttimer);
    if (document.getElementById('sub_'+which) == null) {
        dotimedmouseout(which);
    } else {
        currenttimer=setTimeout("dotimedmouseout('"+which+"')",500);
    }
}
function dotimedmouseout(which) {
    if (document.getElementById('sub_'+which) != null) {
        document.getElementById('sub_'+which).style.visibility="hidden";
        document.getElementById('sub_'+which).style.position="absolute";
        document.getElementById('spacer').style.position="relative";
    }
    document.getElementById('round_l_'+which).src=topdir+"/images/"+rolloverdir+"/toplinks_l.gif";
    document.getElementById('round_r_'+which).src=topdir+"/images/"+rolloverdir+"/toplinks_r.gif";
    document.getElementById('middlebg_'+which).style.backgroundImage="url('"+topdir+"/images/"+rolloverdir+"/toplinks_bg.gif')";
    document.getElementById('link_'+which).className="toplinks";
    currentmenu="";
}

function studychange(id,which) {
  var color='#EEEEEE';
  if (which == 'on') {
    color='#E9E9E9';
  }
  document.getElementById(id+'_top').style.backgroundColor=color;
  document.getElementById(id+'_middle').style.backgroundColor=color;
  document.getElementById(id+'_bottom').style.backgroundColor=color;
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function showoverlay() {
	var objOverlay = document.getElementById('overlay');
	var objTourbox = document.getElementById('tourbox');
	var arrayPageSize = getPageSize();
	objOverlay.style.height = (arrayPageSize[1] + 'px');
	objTourbox.style.display = 'block';
	objTourbox.style.left = (arrayPageSize[0]-450);
}

