//--------------------------------------------------------------------------------------------------
function getTop(e){
   var t = e;
   var y = t.offsetTop;
   while (t.offsetParent != null) {
      t = t.offsetParent;
      y += t.offsetTop;
   }
   return y;
}
//--------------------------------------------------------------------------------------------------
function getLeft(e){
   var t = e;
   var x = t.offsetLeft;
   while (t.offsetParent != null) {
      t = t.offsetParent;
      x += t.offsetLeft;
   }
   return x;
}
//--------------------------------------------------------------------------------------------------
function showTimeout(menuId) {
  var menu = document.getElementById(menuId);

  menu._height += menu._step;
  if (menu._height > menu.orgHeight) {
    menu._height = menu.orgHeight;
  } else {
    menu.timeoutId = window.setTimeout("showTimeout('" + menuId + "');", 7);
  }

  menu.style.height = menu._height + "px";
}
//--------------------------------------------------------------------------------------------------
function hideTimeout(menuId) {
  var menu = document.getElementById(menuId);

  menu._height -= menu._step;
  if (menu._height <= 0) {
    menu._height = 0;
    menu.style.visibility = "hidden";
  } else {
    menu.timeoutId = window.setTimeout("hideTimeout('" + menuId + "');", 7);
  }
  menu.style.height = menu._height + "px";
}
//--------------------------------------------------------------------------------------------------
function menuMouseMove(event) {
  if (!event) event = window.event;
  _clientX = event.clientX;
  _clientY = event.clientY;
}
//--------------------------------------------------------------------------------------------------
function initMenu(menu) {
  menu.orgHeight = menu.offsetHeight;
  menu._step = Math.round(menu.orgHeight / 5);
  menu._x = getLeft(menu);
  menu._y = getTop(menu);

  document.body.onmousemove = menuMouseMove;
}
//--------------------------------------------------------------------------------------------------
function doMouseOut(menuId){
  var menu = document.getElementById(menuId);
  menu.overMainMenuItem = 0;
}
//--------------------------------------------------------------------------------------------------
function doShow(menuId) {
  if (document._prevMenu != null && document._prevMenu != menuId) 
    doHide(document._prevMenu);

  document._prevMenu = menuId;

  var menu = document.getElementById(menuId);

  window.clearTimeout(menu.selfHideId);
  menu.selfHideId = window.setTimeout("doHide('" + menuId + "');", 700);
  menu.overMainMenuItem = 1;

  if (menu.style.visibility == "visible") return;

  if (menu.orgHeight == null) {
    initMenu(menu);
  }
  
  window.clearTimeout(menu.timeoutId);

  menu.style.visibility = "visible";
  menu._height = menu._step;
  menu.style.height = menu._height + "px";
  menu.timeoutId = window.setTimeout("showTimeout('" + menuId + "');", 7);
}
//--------------------------------------------------------------------------------------------------
function doHide(menuId) {
  var menu = document.getElementById(menuId);

  if ((_clientX >= menu._x && _clientY >= menu._y 
      && _clientX <= menu._x + menu.offsetWidth 
      && _clientY <= menu._y + menu.offsetHeight) && menuId == document._prevMenu || menu.overMainMenuItem == 1) {
    window.clearTimeout(menu.selfHideId);
    menu.selfHideId = window.setTimeout("doHide('" + menuId + "');", 700);
    return;
  }

  if (menu.style.visibility == "hidden") return;

  if (menu.orgHeight == null) {
    initMenu(menu);
  }
  
  window.clearTimeout(menu.timeoutId);

  menu.timeoutId = window.setTimeout("hideTimeout('" + menuId + "');", 7);
}
//--------------------------------------------------------------------------------------------------


function print_version(){
	var w = window.open('', 'PRINT_VERSION', 'scrollbars=yes,width=710,height=550');
	w.focus();
	var doc = w.document;
	doc.open();
	doc.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
	doc.write('<html xmlns="http://www.w3.org/1999/xhtml">');
	doc.write('<base href="http://sentara.edu/" />');
	doc.write('<title>'+window.document.title+'</title>');
	doc.write('<link href="css/style.css" rel="stylesheet" type="text/css" />');
	doc.write('<!--[if lte ie 6]>');
	doc.write('<link href="css/ie6.css" rel="stylesheet" type="text/css" />');
	doc.write('<![endif]-->');
	
	doc.write('<style type="text/css">'+"\n");
	doc.write('body {background-color: #ffffff; background-image: none;}'+"\n");
	doc.write('#wrapper {width: 675px; margin: 10px;}'+"\n");
	doc.write('#page_content {width: 675px; padding: 0px; background-color: #ffffff; background-image: none;}'+"\n");
	doc.write('#page_content_inner {background-color: #ffffff; background-image: none;}'+"\n");
	doc.write('#right_column {background-color: #ffffff; background-image: none; float: none; padding: 0px;}'+"\n");
	doc.write('a#chat_recruiter, a#admissions_process {display: none;}'+"\n");
	doc.write('.header {background-image: url(/images/logo.gif); background-repeat: no-repeat; text-align: right; font-size: 10px; height: 70px;}'+"\n");
	doc.write('.page_path {text-align: right; background: transparent url(../images/right_column_title.gif) repeat-x scroll center bottom; padding-bottom: 3px;}'+"\n");
	doc.write('.print_title {font-size: 24px; margin-bottom: 15px;}'+"\n");
	doc.write('.footer {text-align: center;  background: transparent url(../images/right_column_title.gif) repeat-x scroll center top; padding-top: 5px;}'+"\n");
	doc.write('#wrapper td, #wrapper th {font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: left;}'+"\n");
	doc.write('</style>');
	/*
	body {background-color: #ffffff; background-image: none;}
	#wrapper {width: 635px; margin: 10px;}
	#page_content {width: 635px; padding: 0px; background-color: #ffffff; background-image: none;}
	#page_content_inner {background-color: #ffffff; background-image: none;}
	#right_column {background-color: #ffffff; background-image: none; float: none; padding: 0px;}
	a#chat_recruiter, a#admissions_process {display: none;}
	*/
	doc.write('</head><body>');

	doc.write('<div id="wrapper">');
	doc.write('<div id="page_content">');
	doc.write('<div id="page_content_inner">');
	
	doc.write('<div class="header">www.sentara.edu<br /><input type="button" value="Print Page" onclick="this.style.display = \'none\';window.print();" name="Print Page" id="butt_submit"/></div>');
	
	var page_way = document.getElementById('page_way');
	var tn = page_way.parentNode;
	tn = tn.lastChild;
	
	var txt = "";
	doc.write('<div class="page_path">');
	var nn = page_way.firstChild;
	while (nn && nn.nodeName.toLowerCase()!="ul")nn = nn.nextSibling;
	if (nn){
		nn = nn.firstChild;
		while (nn){
			if (nn.nodeName.toLowerCase()=="li"){
				var nn2 = nn.firstChild;
				while (nn2.nodeName.toLowerCase()!="a")nn2 = nn2.nextSibling;
				if (nn2){
					if (txt!="")txt += " -> ";
					txt += nn2.innerHTML;
				}
			}
			nn = nn.nextSibling;
		}
	}
	doc.write(txt);
	doc.write('</div>');

	doc.write('<div class="print_title">'+tn.nodeValue+'</div>');

	var html = '<div id="right_column"';
	var n = document.getElementById('right_column');
	html += '>';
	
	html += n.innerHTML;
	html += '</div>';
	
	doc.write(html);
	
	doc.write('<div class="footer">Crossways I - Suite 105, 1441 Crossways Blvd. , Chesapeake, Va. 23320 . Tel: (757) 388-2900 .<br />Your community, not-for-profit health partner.<br />Copyright 2008 Sentara Healthcare.</div>');
	
	doc.write('</div>');
	doc.write('</div>');
	doc.write('</div>');
	doc.write('</body></html>');
	doc.close();
}

function email_page(){
	var title = document.title;
	var url = location.toString();
	var w = window.open('/email_page.php?url='+escape(url), 'EMAIL_PAGE', 'scrollbars=no,width=375,height=300');
}

function open_dvd(){
    var w=window.open('http://www.sentarainteractive.com/sohp/', 'DVD', 'scrollbars=no,width=770,height=550');
    w.focus();
}