					// ########### change text size javascript ###########
					var DEFAULT_SIZE = "70%";
					var LARGER_SIZE = "80%";
					
					function toggle_text_size(text_link) {
						if (document.documentElement.style.fontSize == LARGER_SIZE) decrease_text(text_link);
						else increase_text(text_link);
						
					}
					
					function increase_text(text_link) {
					
							var text_node = document.createTextNode("Increase/Decrease Text Size");
							document.documentElement.style.fontSize = LARGER_SIZE;
							text_link.className = "decrease";
							text_link.setAttribute("title", "Decrease Text Size");
							text_link.removeChild(text_link.firstChild);
							text_link.appendChild(text_node);
					
					}
					
					function change_link_text() {
					
							var text_link = document.getElementById("page_toolbar_text").getElementsByTagName("a")[0];
							var text_node = document.createTextNode("Increase/Decrease Text Size");
							text_link.className = "decrease";
							text_link.setAttribute("title", "Decrease Text Size");
							text_link.removeChild(text_link.firstChild);
							text_link.appendChild(text_node);
							
					
					}
					
					function decrease_text(text_link) {
					
							var text_node = document.createTextNode("Increase/Decrease Text Size");
							document.documentElement.style.fontSize = DEFAULT_SIZE;
							text_link.className = "increase";
							text_link.setAttribute("title", "Increase Text Size");
							text_link.removeChild(text_link.firstChild);
							text_link.appendChild(text_node);
					
						
					}
					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 NAVIGATION 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_navigation.  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_NAVIGATION_ID: the ID of the smart_navigation element.
					var SMART_NAVIGATION_ID = "smart_navigation";
					var STAYWELL_NAVIGATION_ID = "staywell_navigation";
			
					// ##### SUBLIST_CLASS_NAME: the class name of the sublists inside each list-item of the main smart_navigation 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 NAVIGATION 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"; 
						}
					}
			
					// ##### check_smart_navigation: checks to see if any "more" links need to be created for the smart navigation lists.
					function check_smart_navigation() {
			
						var list = document.getElementById(SMART_NAVIGATION_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"));
						if($(STAYWELL_NAVIGATION_ID)){
							list = document.getElementById(STAYWELL_NAVIGATION_ID).getElementsByTagName("ul");
							for (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) {
						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() {
						var text_link = document.getElementById("page_toolbar_text").getElementsByTagName("a")[0];
						var print_link = document.getElementById("page_toolbar_print").getElementsByTagName("a")[0];
						
						var bookmark_link = $$("#page_toolbar_bookmark a")[0];
						
						bookmark_link.onclick = function(){
							var thisURL = document.location.href;
							var thisTitle = document.title;
							bookmarkPage(thisURL,thisTitle);
							return false;
						}

						text_link.onclick = function () {
							toggle_text_size(this);
							return false;
						}

						print_link.onclick = function () {
							window.print();
							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; }

// 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 a").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;
		}
	}
}







var LandingPageSpotlightLimit = 4;
LandingPageSpotlightLimit--;

var LandingPageSpotlightPosition = 0;

function LandingPageSpotlights_HideAll(elementID){
	$(elementID).down("ul").childElements().invoke("hide");
}

function LandingPageSpotlights_Previous(el){
	var elementID = el.up("div").id;
	LandingPageSpotlights_HideAll(elementID);
	var spotlightLIs = $(elementID).down("ul").childElements();
	//var spotlightLIs = $$("#"+elementID+" ul li");
	
	LandingPageSpotlightPosition--;
	if(LandingPageSpotlightPosition<0){
		LandingPageSpotlightPosition = 0;
	}
	
	for(i=LandingPageSpotlightPosition;i<spotlightLIs.length;i++){
		if(i<=(LandingPageSpotlightLimit+LandingPageSpotlightPosition)){
			spotlightLIs[i].show();
		}
	}
}

function LandingPageSpotlights_Next(el){
	var elementID = el.up("div").id;
	LandingPageSpotlights_HideAll(elementID);
	var spotlightLIs = $(elementID).down("ul").childElements();
	
	LandingPageSpotlightPosition++;
	if(LandingPageSpotlightPosition>(spotlightLIs.length-LandingPageSpotlightLimit-1)){
		LandingPageSpotlightPosition = spotlightLIs.length-LandingPageSpotlightLimit-1;
	}
	
	for(i=LandingPageSpotlightPosition;i<spotlightLIs.length;i++){
		if(i<=(LandingPageSpotlightLimit+LandingPageSpotlightPosition)){
			spotlightLIs[i].show();
		}
	}
}

function LandingPageSpotlights_MakeNav(elementID){
	if($(elementID)){
		var spotlightLIs = $$("#"+elementID+" ul li");
		for(i=0;i<spotlightLIs.length;i++){
			if(i>LandingPageSpotlightLimit){
				spotlightLIs[i].hide();
			}
		}
		
		var ul_nav = new Element('ul', { 'id':elementID+'_nav','class': 'spotlight_nav' });

		var li_prev = new Element('li',{'id':elementID+"spotlight_nav_prev",'class':'prev'});
		var a_prev = new Element('a', { href:'#','title':'previous'}).update("previous");
		li_prev.appendChild(a_prev);
		ul_nav.appendChild(li_prev);
				
		var li_next = new Element('li',{'id':elementID+"spotlight_nav_next",'class':'next'});
		var a_next = new Element('a', { href:'#','title':'next'}).update("next");
		li_next.appendChild(a_next);
		ul_nav.appendChild(li_next);

		$(elementID).appendChild(ul_nav);
		
		$(elementID+'spotlight_nav_prev').down("a").onclick = function(element){
			LandingPageSpotlights_Previous(this);
			return false;
		};
		
		$(elementID+'spotlight_nav_next').down("a").onclick = function(element){
			LandingPageSpotlights_Next(this);
			return false;
		};
		
	}
	return false;
}



















	
function randomInt(startInt,endInt){
	// startInt can be positive or negative or zero
	// endInt is incremented so that the range is inclusive
	endInt++;
	var result = Math.floor(Math.random()*endInt);
	result = result + startInt;
	return result;
}



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;
		}
	}
}
