Tree.prototype.ShowHide = ShowHide;
Tree.prototype.HideAll = HideAll;
Tree.prototype.ExpandNode = ExpandNode;

	function Tree(){
		this.browser = window.navigator.appName;	
	}

	function ShowHide(layerId){
		var thisLayer = document.getElementById(layerId);
		
		if(thisLayer.style.display =='none'){
			thisLayer.style.display ='';
		} else {
			thisLayer.style.display ='none';
		}

		return false;
	}

	function HideAll(){
		return false;
	}
	
	function ExpandNode(id){
		if (id !='' && id != null)
		{
				this.ShowHide(id);
		}
	}
/***************************    DISPLAY OBJECT  ****************************/

	var myTree = new Tree();

/**************************************************************************/

/********************************************************/
/* Pull off query string values */
function requestQuerystring(targ){
	prts = location.search.substr(1).split("&");
	for(nn=0;nn<prts.length;nn++){
		if(prts[nn].split("=")[0] == targ){
			return prts[nn].split("=")[1];
		}
	}
}

function mailThisUrl() {
	
	m = "Brigham and Women's Hospital web page of interest";
	t = document.title;
	u = "...." + window.location;

	// the following expression must be all on one line...
	window.location = "mailto:?subject="+m+"&body="+t+u;
}

/**************************************************************************/
// setStyleByClass: given an element type and a class selector,
// style property and value, apply the style.
// args:
//  t - type of tag to check for (e.g., SPAN)
//  c - class name
//  p - CSS property
//  v - value
/**************************************************************************/
function setStyleByClass(t,c,p,v){
	var ie = (document.all) ? true : false;	
	var elements;
	if(t == '*') {
		// '*' not supported by IE/Win 5.5 and below
		elements = (ie) ? document.all : document.getElementsByTagName('*');
	} else {
		elements = document.getElementsByTagName(t);
	}
	for(var i = 0; i < elements.length; i++){
		var node = elements.item(i);
		for(var j = 0; j < node.attributes.length; j++) {
			if(node.attributes.item(j).nodeName == 'class') {
				if(node.attributes.item(j).nodeValue == c) {
					eval('node.style.' + p + " = '" +v + "'");
				}
			}
		}
	}
}

/**************************************************************************/
function adjustFont(fsize)
{
	//fsize is how much more larger we want it
	fsize += '';
		
	//Only modify the middle body content areas font size
	setStyleByClass('td', 'content','fontSize',fsize);
	//promo boxes are like 1px smaller than rest 
	//setStyleByClass('td', 'rightNavBoxText','fontSize',fsize);
	//setStyleByClass('td', 'deptContactContent','fontSize',fsize);
	//setStyleByClass('td', 'deptPromoBoxContent','fontSize',fsize);
	//setStyleByClass('td', 'deptLinksTitle','fontSize',fsize);

}

/**************************************************************************/

	//Function for print page

function Clickheretoprint()
{ 
 //Script for printer friendly page
 //Liz Dones 10/04/2006, updated 08/03/2007
  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      disp_setting+="scrollbars=yes,width=650, height=600, left=150, top=25"; 
    var aReturn=document.getElementById("content").rows;
    var content_vlue = aReturn[0].cells[0].innerHTML;
	var ReturnTitle=document.getElementById("pageTitle").rows;
    var content_subtitle = ReturnTitle[0].cells[0].innerHTML;
	var Url = document.location.href;
    var docprint=window.open("","",disp_setting);
	var d = new Date();
	currentYear = d.getYear();

   docprint.document.open(); 
   docprint.document.write('<html><head><title>Brigham and Women\'s Hospital</title>');
   docprint.document.write('<LINK REL=StyleSheet TYPE=\"text/css\" HREF=\"/styles/PrintStyles.css\" \/>'); 
   docprint.document.write('</head><body>');
   docprint.document.write('<img alt=\"Brigham and Women\'s Hospital logo\" src=\"/siteimages/topBanner/BWH_Logo.jpg\" border=0 \/>');
   docprint.document.write('<div align=right><a href=# onClick=\"self.print();\"><img src=/siteimages/ContentArea/Print.gif border=0 alt=Print-friendly \/></a>');
   docprint.document.write('<a href=\"javascript:self.close()\"><img src=/siteimages/ContentArea/CloseBtn.gif border=0 alt=\"Close Window\" \/></a><\/div>');
   docprint.document.write('<p>');
   docprint.document.write('<table id=contentArea><tr><td width=10></td><td>');       
   docprint.document.write(content_subtitle);
   docprint.document.write(content_vlue);
   docprint.document.write('<p>');
   docprint.document.write('<b>Find this content at:</b>');
   docprint.document.write('<br>');
   docprint.document.write(Url);
   docprint.document.write('<br><a href=\"javascript:self.close()\">Close window</a><hr>');
   docprint.document.write('The Brigham and Women\'s Hospital web site is primarily an educational resource intended to complement, not take the place of, the advice and recommendations you receive from your health care provider. If you have or suspect that you have a health problem, please seek the services of your health care provider.');
   docprint.document.write('<p>');
   docprint.document.write('<center>Copyright &copy; '+ currentYear + ' Brigham and Women\'s Hospital</center>');
   docprint.document.write('');
   docprint.document.write('</td></tr></table>');       
   docprint.document.write('</body></html>'); 
   docprint.document.close(); 
   docprint.focus(); 
}

function PrintBulletin()
{ 
 //Script for printer friendly page
 //Liz Dones 08/03/2007, updated 08/03/2007
  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      disp_setting+="scrollbars=yes,width=650, height=600, left=150, top=25"; 
    var PrintImage = document.getElementById("Print_Image").innerHTML;
    var PrintPageTitle = document.getElementById("Print_Page_Title").innerHTML;
    var content_vlue = document.getElementById("Print_Content").innerHTML;
	var Url = document.location.href;
    var docprint=window.open("","",disp_setting);
	var d = new Date();
	currentYear = d.getYear();

   docprint.document.open(); 
   docprint.document.write('<html><head><title>Brigham and Women\'s Hospital</title>');
   docprint.document.write('<LINK REL=StyleSheet TYPE=\"text/css\" HREF=\"/styles/PrintStyles.css\" \/>'); 
   docprint.document.write('</head><body>');
   docprint.document.write(PrintImage);
   docprint.document.write('<div align=right><a href=# onClick=\"self.print();\"><img src=/siteimages/ContentArea/Print.gif border=0 alt=Print-friendly \/></a>');
   docprint.document.write('<a href=\"javascript:self.close()\"><img src=/siteimages/ContentArea/CloseBtn.gif border=0 alt=\"Close Window\" \/></a><\/div>');
   docprint.document.write('<p>');
   docprint.document.write('<table id=contentArea><tr><td width=10></td><td>');       
   docprint.document.write(PrintPageTitle);
   docprint.document.write(content_vlue);
   docprint.document.write('<p>');
   docprint.document.write('<b>Find this content at:</b>');
   docprint.document.write('<br>');
   docprint.document.write(Url);
   docprint.document.write('<br><a href=\"javascript:self.close()\">Close window</a><hr>');
   docprint.document.write('The Brigham and Women\'s Hospital web site is primarily an educational resource intended to complement, not take the place of, the advice and recommendations you receive from your health care provider. If you have or suspect that you have a health problem, please seek the services of your health care provider.');
   docprint.document.write('<p>');
   docprint.document.write('<center>Copyright &copy; '+ currentYear + ' Brigham and Women\'s Hospital</center>');
   docprint.document.write('');
   docprint.document.write('</td></tr></table>');       
   docprint.document.write('</body></html>'); 
   docprint.document.close(); 
   docprint.focus(); 
}

