/*
#################  eHA.js  version 3.3
#################
#################  If updating version number, please update eHA object at end of file.
#################  As of version 3.3, this file includes others.  see includeScripts string and
#################  eHA object at end of file
#################
*/

					// ########### change text size javascript ###########
					var DEFAULT_SIZE = "100%";
					var LARGER_SIZE = "110%";
					
					function toggle_text_size() {
						if ($("content_body").style.fontSize == LARGER_SIZE) decrease_text();
						else increase_text();
						
					}

					
					function change_link_text() {
						if($$(".page_toolbar_text a")){
							$$(".page_toolbar_text a").each(function(element){
								element.removeClassName("increase").addClassName("decrease");
								element.setAttribute("title","Decrease Text Size");
								element.removeChild(element.firstChild);
								element.update("Increase/Decrease Text Size");
							});
						}
					}

										
					function increase_text() {
						if($$(".page_toolbar_text a")){
							$$(".page_toolbar_text a").each(function(element){
								element.removeClassName("increase").addClassName("decrease");
								element.setAttribute("title","Decrease Text Size");
								element.removeChild(element.firstChild);
								element.update("Increase/Decrease Text Size");
							});
						}
						$("content_body").style.fontSize = LARGER_SIZE;
					}
					
					
					function decrease_text() {
						if($$(".page_toolbar_text a")){
							$$(".page_toolbar_text a").each(function(element){
								element.removeClassName("decrease").addClassName("increase");
								element.setAttribute("title","Increase Text Size");
								element.removeChild(element.firstChild);
								element.update("Increase/Decrease Text Size");
							});
						}
						$("content_body").style.fontSize = DEFAULT_SIZE;
					}
					
					function check_text_size() {
						var cookie = get_cookie("text_size");
						var current_text_size = cookie ? cookie : get_default_text_size();
						return set_current_text_size(current_text_size);
					}
					
					
					function text_size_unload() {
						var current_text_size = get_current_text_size();
						make_cookie("text_size", current_text_size);
					}

					addUnloadEvent(text_size_unload);
					
					function set_current_text_size(current_text_size) {
						if (current_text_size == LARGER_SIZE) {
							document.documentElement.style.fontSize = LARGER_SIZE;
							return true;
						}
						return false;
					}
					
					function get_default_text_size() { return DEFAULT_SIZE; }
					
					function get_current_text_size() {
					
						if (document.documentElement.style.fontSize == LARGER_SIZE) return LARGER_SIZE;
						else return DEFAULT_SIZE;
						
					}
					
					function make_cookie(name, val) {
  						var expires = "";
  						document.cookie = name+"="+val+expires+"; path=/";
					}
					
					function get_cookie(name) {
					
						var n = name + "=";
						var cookieArray = document.cookie.split(';');
					
						for( var h = 0; h < cookieArray.length; h++ ) {
					
							var c = cookieArray[h];
					
							while (c.charAt(0)==' ') c = c.substring(1,c.length);
					
							if (c.indexOf(n) == 0) return c.substring(n.length,c.length);
					
						}
					
						return null;

					}


					// ##### END CHANGE TEXT SIZE JAVASCRIPT ##########################

					// ##### FUNCTION: addUnloadEvent
					// #####  PURPOSE: appends a function to the window.unonload event handler 
					function addUnloadEvent(func) {
						var oldonunload = window.onunload;
						if (typeof window.onunload != 'function') {
							window.onunload = func;
						} else {
							window.onunload = function() {
								if (oldonunload) {
									oldonunload();
								}
								func();
							}
						}
					}

					// ##### FUNCTION: addLoadEvent
					// #####  PURPOSE: appends a function to the window.onload event handler 
					function addLoadEvent(func) {
						var oldonload = window.onload;
						if (typeof window.onload != 'function') {
							window.onload = func;
						} else {
							window.onload = function() {
								if (oldonload) {
									oldonload();
								}
								func();
							}
						}
					}
			
			
					// ######################################################################
					// ##### SMART NavigationSiteMap VARIABLE DECLARATIONS
			
					// ##### ALLOW_REFRESH: set to true for back-button compatibility.  set to false for fastest response time. ##### 
					var ALLOW_REFRESH = true;
			
					// ##### VISIBILITY_CLASS_NAME: the class for the list items that will be shown by default.  This class is
					// ##### predefined by smart_NavigationSiteMap.  It is also used within the css.
					var VISIBILITY_CLASS_NAME = "show";
			
					// ##### MORE_LINK_LASS_NAME: the class of the list item which the user clicks on to show all the links.
					var MORE_LINK_CLASS_NAME = "more";
			
					// ##### MORE_LINK_TEXT: the text displayed for the "more" links.
					var MORE_LINK_TEXT = "More ...";
			
					// ##### BACK_LINK_CLASS_NAME: the class of the anchor tag which the user click on to return back to the main content.
					var BACK_LINK_CLASS_NAME = "back";
			
					// ##### BACK_LINK_TEXT: the text displayed for the "back" link.
					var BACK_LINK_TEXT = "Back";
			
					// ##### CONTENT_MAIN_ID: the ID of the parent node to the content body.
					var CONTENT_MAIN_ID = "content_main";
			
					// ##### CONTENT_BODY_ID: the ID of the actual content which is displayed on the page.
					var CONTENT_BODY_ID = "content_body";
			
					// ##### SMART_NavigationSiteMap_ID: the ID of the smart_NavigationSiteMap element.
					var SMART_NavigationSiteMap_ID = "smart_NavigationSiteMap";
			
					// ##### SUBLIST_CLASS_NAME: the class name of the sublists inside each list-item of the main smart_NavigationSiteMap list.
					var SUBLIST_CLASS_NAME= "sub";
			
					// ##### VISIBLE_SMART_CLASS_NAME: the class name of the element which holds the visible smart nav links for the current "more" section.
					var VISIBLE_SMART_CLASS_NAME = "visible_smart";
			
			
					// ######################################################################
					// ##### SMART NavigationSiteMap FUNCTION DECLARATIONS
			
					// ##### show_content_body: displays the content body area of the page.
					function show_content_body() { 
						document.getElementById(CONTENT_BODY_ID).style.display = "block"; 
						var graph_wrapper = document.getElementById('content_graph_wrapper');
						if (graph_wrapper != null) {
							graph_wrapper.style.display = "block"; 
						}
					}
			
					// ##### hide_content_body: hides the content body area of the page.
					function hide_content_body() { 
						document.getElementById(CONTENT_BODY_ID).style.display = "none"; 
						var graph_wrapper = document.getElementById('content_graph_wrapper');
						if (graph_wrapper != null) {
							graph_wrapper.style.display = "none"; 
						}
					}
			
					function check_smart_navigation(smart_id){
						if($(smart_id)){
							if($$("#"+smart_id+" ul li a").length){
								$(smart_id).show();
								return true;
							}else{
								$(smart_id).hide();
								return false;
							}
						}
						return false;
					}
					
					// ##### check_smart_NavigationSiteMap: checks to see if any "more" links need to be created for the smart NavigationSiteMap lists.
					function check_smart_NavigationSiteMap() {
			
						var list = document.getElementById(SMART_NavigationSiteMap_ID).getElementsByTagName("ul");
						for (var i = 0; i < list.length; i++) if (list[i].className == SUBLIST_CLASS_NAME) create_more_link(list[i], list[i].parentNode.getAttribute("id"));
			
					}
			
					// ##### remove_visible_links: deletes any elements within the main content area that were created by a "more" link.
					function remove_visible_links() { 
			
						var divs = document.getElementById(CONTENT_MAIN_ID).getElementsByTagName("div");
						for (var i = 0; i < divs.length; i++) if (divs[i].className == VISIBLE_SMART_CLASS_NAME) document.getElementById(CONTENT_MAIN_ID).removeChild(divs[i]); 
					
					}
			
					// ##### create_more_link: checks for hidden links in a list, creates the a more link at the end of a list of hidden links.
					function create_more_link(sublist, category_id) {
			
						var has_hidden_links = false;
						var items = sublist.getElementsByTagName("li");
			
						// ##### Assume that any links without the VISIBILITY_CLASS_NAME are hidden.
						// ##### if any links without the visibility class name are found, then assume
						// ##### that a more link is required.
						for (var i = 0; i < items.length; i++) {
							if (items[i].className != VISIBILITY_CLASS_NAME) {
								has_hidden_links = true;
							}
						}
			
						// ##### if there are any hidden links,
						// ##### create a new list-item for the more link.
						if (has_hidden_links) {
			
							var more_link = document.createElement("a");
							var more_text = document.createTextNode(MORE_LINK_TEXT);
			
							// ##### create the URL for the more link
							var more_link_href = build_more_link(category_id);
							more_link.setAttribute("href", more_link_href);
			
							// ##### GLOBAL BEHAVIOR SWITCH #####
							// ##### if ALLOW_REFRESH is false, NO back-button functionality
							if (ALLOW_REFRESH == false) more_link.onclick = function() {
									hide_content_body();
									remove_visible_links();
									show_more(category_id);
									return false;
							}
			
							// ##### Add the text inside the anchor tag.
							more_link.appendChild(more_text);
			
							// ##### create the list item parent for the anchor tag.
							var more_list_item = document.createElement("li");
							more_list_item.appendChild(more_link);
							more_list_item.className = MORE_LINK_CLASS_NAME;
			
							// ##### attach the more link list item to the end of the list.
							sublist.appendChild(more_list_item);
						}
			
					}
			
					// ##### show_more: displays a duplicate list of links in the main content area
					// ##### includes creation of the back anchor tag which is used to revert back to the original document state.
					function show_more(category_id) {
			
						// ##### create dynamic visible id
						var visible_id = category_id + "_visible";
			
						// ##### create a duplicate set of related links.
						var links = document.getElementById(category_id).getElementsByTagName("ul")[0].cloneNode(true);
			
						// ##### remove the existing "more" link from the clone.
						links.removeChild(links.lastChild);
			
						// ##### create the division which will be used to house the duplicate list.
						var visible_smart = document.createElement("div");
						visible_smart.setAttribute("id", visible_id);
						visible_smart.appendChild(links);
						visible_smart.className = VISIBLE_SMART_CLASS_NAME;
			
						// ##### create the back link
						var back_link = document.createElement("a");
						var back_text = document.createTextNode(BACK_LINK_TEXT);
						back_link.appendChild(back_text);
						back_link.className = BACK_LINK_CLASS_NAME;
						var back_link_href = build_back_link(category_id);
						back_link.setAttribute("href", back_link_href);
			
						// ##### GLOBAL BEHAVIOR SWITCH #####
						// ##### if ALLOW_REFRESH is false, NO back-button functionality
						if (ALLOW_REFRESH == false) back_link.onclick = function() {
								remove_visible_links();
								show_content_body();
								return false;
						}
			
						// ##### attach the back link just below the duplicate list inside the housing division.
						visible_smart.appendChild(back_link);
			
						// ##### attach the housing division to the bottom of the main content area.
						document.getElementById(CONTENT_MAIN_ID).appendChild(visible_smart);

						var content_divisions = document.getElementById(CONTENT_MAIN_ID).getElementsByTagName("div");

						for (var i = 0; i < content_divisions.length; i++) {
							if (content_divisions[i].className == "content_sub") {
								document.getElementById(CONTENT_MAIN_ID).appendChild(visible_smart);
								document.getElementById(CONTENT_MAIN_ID).appendChild(content_divisions[i]);
								i = content_divisions.length;
							}
						}

						
					}
			
					// ##### check_query: parse the current query string and search for the "more" parameter.
					// ##### if found, perform basic functions for displaying the more links.
					function check_query() {
			
						// ##### grab the query string (everything from "?...." in the URL)
						var searchString = document.location.search;
			
						// ##### strip off the leading '?'
						searchString = searchString.substring(1);
						var nvPairs = searchString.split("&");
			
						// ##### Loop through all name=value pairs
						for (i = 0; i < nvPairs.length; i++) {
			
							// ##### split up the pairs and assign variables
							var nvPair = nvPairs[i].split("=");
							var name = nvPair[0];
							var value = nvPair[1];
			
							// ##### look for the pair with the name == "more"
							if (name == "more") {
			
								// ##### perform basic functions for displaying the
								// ##### more links.
								hide_content_body();
								remove_visible_links();
								show_more(value);
								
								// ##### end the loop
								i = nvPairs.length;
							}
						}
					}
			
					// ##### rebuild_original_query: takes in a query string
					// ##### returns query string without: "more=...."
					// ##### WORKS FOR BOTH STATIC AND DYNAMIC PUBLISHING
					function rebuild_original_query(existingQuery) {
			
						// ##### initialize original query place holder.
						var original_query = "";
			
						if (existingQuery == "") return original_query;
						else {
			
							// ##### remove question mark.
							existingQuery = existingQuery.substring(1);
			
							// ##### split up query string into name=value pairs
							var nvPairs = existingQuery.split("&");
			
							// ##### Rebuild the query string WITHOUT more parameter.
							for (i = 0; i < nvPairs.length; i++) {
			
								// ##### split the pair and assign the variables.
								var nvPair = nvPairs[i].split("=");
								var name = nvPair[0];
								var value = nvPair[1];
			
								// ##### exclude "more" parameter in the rebuild.
								if (name != "more") {
									original_query += name+"="+value+"&";
								}
							}
						
							// ##### return original query without trailing ampersand.
							if (original_query != "") return "?" + original_query.substring(0, original_query.length-1);
							else return "";
			
						}
			
					}
			
					// ##### build_back_link: returns the original link to the document without "more" query string parameters.
					// ##### WORKS FOR BOTH STATIC AND DYNAMIC PUBLISHING
					function build_back_link() {
			
						// ##### create place holder for final url
						var myURL = "";
			
						// ##### split the URL in half at the question mark
						var splitURL = document.URL.split("?");
			
						// ##### if no question mark, this means there's no query string to worry about.
						// ##### so, set the final url to the current url.
						if (splitURL.length == 1) myURL = document.URL;
						else {
			
							// ##### grab the original query, minus any pre-existing "more" parameters.
							var myQuery = rebuild_original_query(document.location.search);
							
							// ##### set up the rest of the URL including the any sort of original query string.
							myURL = splitURL[0] + myQuery;
			
						}
			
						return myURL;
					}
			
					// ##### build_more_link: returns the more link including dynamic query string with "more" parameter.
					// ##### WORKS FOR BOTH STATIC AND DYNAMIC PUBLISHING
					function build_more_link(more) {
			
						// ##### create place holder for final url
						var myURL = "";
			
						// ##### split the URL in half at the question mark
						var splitURL = document.URL.split("?");
			
						// ##### if no question mark, the length of the split array will be one.
						// ##### this means there's no query string to worry about.
						// ##### so, set the final url to the current url and append a small query string to invoke the more link.
						if (splitURL.length == 1) myURL = document.URL+"?more="+more;
						else {
			
							// ##### grab the original query, minus any pre-existing "more" parameters.
							var myQuery = rebuild_original_query(document.location.search);
			
							// ##### set up the rest of the URL.
							myURL = splitURL[0];
			
							// ##### If there still isn't any query string, append the single parameter
							// ##### (The only time this would happen is if the original URL ended in only a question mark.)
							if (myQuery == "") myURL += "?more="+more;
			
							// ##### append the query string to the url, including the additional parameter
							else myURL += myQuery+"&more="+more;
			
						}
			
						// ##### return the final url
						return myURL;
					}
			

					function popupEmailWindow(pagename, pageurl, sitename) {
    						top.thisWin= window.open("/EmailPage/email_this_page.jsp?siteName=" + escape(sitename) + "&pageDisplayName=" + pagename + "&pageURL=" + escape(pageurl),"thisPage","scrollbars=1,resizable=1,menubar=0,toolbar=0,width=640,height=500");
    						if(!top.thisWin.closed) top.thisWin.focus();
					}

					function popUp(URL, x, y) {
						if(!x){
							x = 660;
						}
						if(!y){
							y = 400;
						}
						day = new Date();
						id = day.getTime();
						options = "toolbar=no, scrollbars=no, location=no, statusbar=no, menubar=no, resizable=no, width=" + x + ", height=" + y + ", left=570, top=150";
						window.open(URL, id, options);
					}

					function eHA_escapeSingleQuote(strVal) {
						sRetVal = new String(strVal);
						sRetVal = sRetVal.replace(/'/g,"\\'");
						return sRetVal;
					}

					function eHA_escapeDoubleQuote(strVal) {
						sRetVal = new String(strVal);
						sRetVal = sRetVal.replace(/\"/g,/\\"/);
						return sRetVal;
					}

					function clearField(theField, defaultText) {
						if (theField.value == defaultText) {
							theField.value = "";
						}
					}

					function revertField(theField, defaultText) {
						if (theField.value == "") {
							theField.value = defaultText;
						}
					}

					function returnPageURL() {
						// alert(document.location.href);
						return document.location.href
					}

		
					// used with greystone newsletters.
					function rotateNodes() {
		         			var x = document.getElementsByTagName("div");
         					var i;
         					for (i = 0; i < x.length; i++) {
		            			    if (x[i].className == "news_online_section") {
        	      				       var theNodeInQuestion = x[i];
	            				    }
						}
		
	        				if (theNodeInQuestion != null) {
							theNodeInQuestion.parentNode.parentNode.appendChild(theNodeInQuestion);
        					}
						
					}

					function bookmarkPage(bookmarkURL,bookmarkTitle){
						try{
							window.external.AddFavorite(bookmarkURL, bookmarkTitle);
						}catch(e){
							alert("To bookmark this page please type Ctrl+D on your keyboard.");
						}
					}

					
					function page_toolbar(){
						if($$(".page_toolbar_text a")){
							$$(".page_toolbar_text a").each(function(element){
								element.onclick = function(){
									toggle_text_size();
									return false;
								}
							});
						}
						
						if($$(".page_toolbar_print a")){
							$$(".page_toolbar_print a").each(function(element){
								element.onclick = function(){
									window.print();
									return false;
								}
							});
						}

						if($$(".page_toolbar_bookmark a")){
							$$(".page_toolbar_bookmark a").each(function(element){
								element.onclick = function(){
									var thisURL = document.location.href;
									var thisTitle = document.title;
									bookmarkPage(thisURL,thisTitle);
									return false;
								}
							});
						}
					}

					
					
/* ##### GLOBAL VARIABLES ##### */
var SPOTLIGHT_RANDOM = false;
var SPOTLIGHT_NEXT_LINK_CLASSNAME = "next";
var SPOTLIGHT_NEXT_LINK_TEXTNODE = "Next";
var SPOTLIGHT_PREV_LINK_CLASSNAME = "previous";
var SPOTLIGHT_PREV_LINK_TEXTNODE = "Previous";
var SPOTLIGHT_VISIBLE_CLASSNAME = "visible_spotlight";
var SPOTLIGHT_HIDDEN_CLASSNAME = "hidden_spotlight";
var SPOTLIGHT_NAV_CLASSNAME = "spotlight_nav";

function hide_node(e) { e.className = SPOTLIGHT_HIDDEN_CLASSNAME; }
function show_node(e) { e.className = SPOTLIGHT_VISIBLE_CLASSNAME; }

// function setup_arrows(spotlight_id) {

// 	var spotlight_nav_id = spotlight_id+"_nav";
// 	var content_spotlight = document.getElementById(spotlight_id);
// 	var content_spotlight_nav = document.createElement("ul");
// 	var next = document.createElement("li");
// 	var prev = document.createElement("li"); 
// 	var next_link = document.createElement("a");
// 	var prev_link = document.createElement("a");
// 	var next_text = document.createTextNode(SPOTLIGHT_NEXT_LINK_TEXTNODE);
// 	var prev_text = document.createTextNode(SPOTLIGHT_PREV_LINK_TEXTNODE);
// 	
// 	prev_link.appendChild(prev_text);
// 	prev.appendChild(prev_link);

// 	next_link.appendChild(next_text);
// 	next.appendChild(next_link);

// 	content_spotlight_nav.appendChild(next);
// 	content_spotlight_nav.appendChild(prev);
// 	content_spotlight_nav.setAttribute("id", spotlight_nav_id);
// 	content_spotlight_nav.className = SPOTLIGHT_NAV_CLASSNAME;

// 	next_link.className = SPOTLIGHT_NEXT_LINK_CLASSNAME;
// 	next_link.setAttribute("href", '#');

// 	prev_link.className = SPOTLIGHT_PREV_LINK_CLASSNAME;
// 	prev_link.setAttribute("href", '#');
// 	
// 	next_link.onclick = function() {
// 		go_forward(spotlight_id);
// 		return false;
// 	}
// 	
// 	prev_link.onclick = function() {
// 		go_backward(spotlight_id);
// 		return false;
// 	}
// 	
// 	hide_spotlights(content_spotlight);
// 	content_spotlight.appendChild(content_spotlight_nav);
// 						
//}


// required prototype
function setup_arrows(spotlight_id){
	var numSpotlights = $$("#"+spotlight_id+" ul li").length;
	
	var ul = new Element('ul', { 'id':spotlight_id+'_nav','class': 'spotlight_nav' });
	
	for(i=0;i<numSpotlights;i++){
		var li = new Element('li',{'id':"spotlight_nav_"+(i+1)});
		var a = new Element('a', { href:'#'}).update(i+1);
		li.appendChild(a);
		ul.appendChild(li);
	}
	
	$$("#"+spotlight_id+" ul li h4 a").each(function(element){
		var moreLink = new Element('a',{ 'class':'spotlight_more_link', href:element.href });
		moreLink.update("more");
		element.up("li").appendChild(moreLink);
	});
	
	
	hide_spotlights($(spotlight_id),false);
	$(spotlight_id).appendChild(ul);
	$("spotlight_nav_1").addClassName("sel");
	$$("#"+spotlight_id+" .spotlight_nav li").each(function(element){
		element.onclick = function(){
			hide_spotlights($(spotlight_id),true);
			show_spotlight(element.id.replace("nav_",""));
			
			clearTimeout(theInterval);
			start_intervals();
			
			return false;
		}
	});
	
}

function show_spotlight(this_spotlight_id){
	show_node($(this_spotlight_id));
	select_button(this_spotlight_id.replace("_","_nav_"));
}

function select_button(button_id){
	var buttons = $(button_id).up("ul").getElementsByTagName("li");
	for(i=0;i<buttons.length;i++){
		buttons[i].removeClassName("sel");
	}
	$(button_id).addClassName("sel");
}


function hide_spotlights(e,no_show) {

	var spotlights = e.down("ul").getElementsByTagName("li");

	if ((spotlights != null) && (spotlights.length > 0)) {

		for (var i = 0; i < spotlights.length; i++){
			spotlights[i].id = "spotlight_"+(i+1);
			hide_node(spotlights[i]);
		}
		if (SPOTLIGHT_RANDOM) var current_spotlight = get_rand_node(spotlights[0]);
		else var current_spotlight = spotlights[0];

		if(no_show==false){
			show_node(current_spotlight);
		}
	
	}

}
	
function get_visible_spotlight(spotlight_id) {

	var result = false;
	var content_spotlight = document.getElementById(spotlight_id);
	var spotlights = content_spotlight.getElementsByTagName("ul")[0].getElementsByTagName("li");

	if ((spotlights != null) && (spotlights.length > 0)) {

		for (var i = 0; i < spotlights.length; i++) {
			var spotlight = spotlights[i];
			if (spotlight.className == "visible_spotlight") {
				var result = spotlight;
				i = spotlights.length+1;
			}
		}

		if (result) return result;
		return spotlights[0];
	
	} 

	return false;

}

function get_next_node(e) {

	if (SPOTLIGHT_RANDOM) return get_rand_node(e);

	var spotlights = e.parentNode.getElementsByTagName("li");

	if ((spotlights != null) && (spotlights.length > 0)){
		for (var i = 0; i < spotlights.length; i++){
			if (spotlights[i] == e) {
				if (i == spotlights.length-1) i = -1;
				var result = spotlights[i+1]; 
				i = spotlights.length+1;
			}
		}
	
	}else{
		var result = e.parentNode.firstChild;
	}
	
	return result;

}

function get_prev_node(e) {

	if (SPOTLIGHT_RANDOM) return get_rand_node(e);

	var spotlights = e.parentNode.getElementsByTagName("li");

	if ((spotlights != null) && (spotlights.length > 0)){
		for (var i = spotlights.length-1; i >= 0; i--){
			if (spotlights[i] == e) { 
				if (i == 0) i = spotlights.length;
				return spotlights[i-1]; 
			}
		}
	}
	return e.parentNode.firstChild;

}

function get_rand_node(e) {

	var result = e;
	var spotlights = e.parentNode.getElementsByTagName("li");

	if ((spotlights != null) && (spotlights.length > 0)) {

		while (result == e) {
			var ran_unrounded = Math.random() * spotlights.length;
			var random_node = Math.floor(ran_unrounded);
			result = spotlights[random_node];
		}

		return result;

	}
						
	return false;

}

function go_forward(spotlight_id) {
	var current_node = get_visible_spotlight(spotlight_id);
	hide_node(current_node);
	show_node(get_next_node(current_node));
	if($(spotlight_id).down(".spotlight_nav .sel").next("li")){
		$(spotlight_id).down(".spotlight_nav .sel").next("li").addClassName("sel");
		$(spotlight_id).down(".spotlight_nav .sel").removeClassName("sel");
	}else{
		$(spotlight_id).down(".spotlight_nav li").addClassName("sel");
		$(spotlight_id).down(".spotlight_nav .sel").next("li.sel").removeClassName("sel");
	}
}

function go_backward(spotlight_id) {
	var current_node = get_visible_spotlight(spotlight_id);
	hide_node(current_node);
	show_node(get_prev_node(current_node));
	if($(spotlight_id).down(".spotlight_nav .sel").previous("li")){
		$(spotlight_id).down(".spotlight_nav .sel").previous("li").addClassName("sel")
		$(spotlight_id).down(".spotlight_nav .sel").next("li").removeClassName("sel");
	}else{
		$(spotlight_id).down(".spotlight_nav li:last-child").addClassName("sel")
		$(spotlight_id).down(".spotlight_nav .sel").removeClassName("sel");
	}
}
var theInterval = '';
var all_interval_expressions = '';
function start_intervals() {
	theInterval = window.setInterval(all_interval_expressions, 10000); 
}
addLoadEvent(start_intervals);



/*##############################################
############ js for dropdown Lists  ############
############ 11/21/2008 (bug 536)   ############
################################################
*/

addLoadEvent(dropdownEvents);

var dropdownHeight = 250;

function dropdownEvents(){
	$$(".dropdown_list_wrapper h4").each(function(element){
		element.onclick = function(){
			dropdownRelease();
			if(element.offsetTop+dropdownHeight-document.viewport.getScrollOffsets().top+220>document.viewport.getDimensions().height){
				element.next("ul").style.top = "auto";
				element.next("ul").style.bottom = "15px";
			}else{
				element.next("ul").style.top = "15px";
				element.next("ul").style.bottom = "auto";
			}
			element.next("ul").addClassName("sel");
			element.up(".dropdown_list_wrapper").style.position = "relative";
			if(element.next("ul").offsetHeight>dropdownHeight){
				element.next("ul").style.height = dropdownHeight+"px";
			}
		}
	});
}

function dropdownRelease(){
	$$(".dropdown_list_wrapper ul").invoke("removeClassName","sel");
	$$(".dropdown_list_wrapper").each(function(element){
		element.style.position = "static";
	});
}

function dropdownClickHandler(e){
	var releaseLists = true;
	if(Event.element(e).up(".dropdown_list_wrapper")){
		releaseLists = false;
	}
	if(releaseLists){
		dropdownRelease();
	}
}


function createNewsButtons(featured_news_id){
	if($(featured_news_id)){
		var newsButtonUL = new Element('ul', { 'class': 'featured_news_nav' });
		var i = 1;
		var newsLIs = $$("#"+featured_news_id+" ul li h3").each(function(element){
			element.up("li").id = "featured_news_"+i;
			var thisLI = new Element('li', { 'id':"featured_news_nav_"+i });
			var thisA = new Element('a', { href:'#' });
			thisA.update(element.innerHTML);
			i++;
			thisLI.appendChild(thisA);
			newsButtonUL.appendChild(thisLI);
		});
		
		$$(".featured_news")[0].insertBefore(newsButtonUL,$$(".featured_news ul")[0]);
		
		$$("#"+featured_news_id+" .featured_news_nav a").each(function(element){
			element.onclick = function(){
				clearNewsSelect(featured_news_id);
				this.up("li").addClassName("sel");
				$(this.up("li").id.replace("_nav_","_")).addClassName("sel");
				return false;
			}
		});
		
		var firstLI = $$("#"+featured_news_id+" .featured_news_nav li")[0];
		firstLI.addClassName("sel");
		$(firstLI.id.replace("_nav_","_")).addClassName("sel");
	}
}

function clearNewsSelect(featured_news_id){
	$$("#"+featured_news_id+" ul li").invoke("removeClassName","sel");
}










function setup_location_page(){
	// to kill error
}





function Calendar_filter(event_category){
	if(event_category=="null"){
		$$("#calendar table div.event").each(function(element){
			element.show();
		});
	}else{
		$$("#calendar table div.event").each(function(element){
			if(event_category.indexOf(":")!=-1){
				if(element.hasClassName("event_category_"+event_category.replace(/ /g,"_"))){
					element.show();
				}else{
					element.hide();
				}
			}else{
				var showThisEvent = false;
				// this event_category is a "parent" category
				$w(element.className).each(function(thisClass){
					if(thisClass.indexOf(event_category.replace(/ /g,"_"))!=-1){
						showThisEvent = true;
					}
				});
				if(showThisEvent){
					element.show();
				}else{
					element.hide();
				}
			}
		});
	}
}



function Calendar_addCalendarToolsEvents(){
	if($('calendar_tools')){
		$('event_filter').onchange = function(){
			Calendar_filter(this.options[this.options.selectedIndex].value);
			return false;
		}
	}
}









// include additional scripts (copied from scriptaculous.js)

var eHA = {
  Version: '3.3',
  require: function(libraryName) {
    // inserting via DOM fails in Safari 2.0, so brute force approach
    document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
  },
  REQUIRED_PROTOTYPE: '1.6.0',
  load: function() {
    function convertVersionString(versionString){
      var r = versionString.split('.');
      return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
    }
 
    if((typeof Prototype=='undefined') || 
       (typeof Element == 'undefined') || 
       (typeof Element.Methods=='undefined') ||
       (convertVersionString(Prototype.Version) < 
        convertVersionString(eHA.REQUIRED_PROTOTYPE)))
       throw("eHA requires the Prototype JavaScript framework >= " +
        eHA.REQUIRED_PROTOTYPE);
    
    $A(document.getElementsByTagName("script")).findAll( function(s) {
      return (s.src && s.src.match(/eHA\.js(\?.*)?$/))
    }).each( function(s) {
      var path = s.src.replace(/eHA\.js(\?.*)?$/,'');
      var includes = s.src.match(/\?.*load=([a-z,]*)/);
      (includes ? includes[1] : includeScripts).split(',').each(
       function(include) { eHA.require(path+include+'.js') });
    });
  }
}

var includeScripts = "physician,NMH,jquery-1.3.2.min,jquery.jBreadCrumb,jquery.easing.1.3";


eHA.load();





