<!--
/* <documentation about="ABOUT js/default.js" type="GENERAL">
	<summary>This file is specific javascript file for UCB Internet site. 
		
		Structure of this file:         
		1. 
		2.
		3. 
		4. 
	</summary>
	<namespace>UCBInternet</namespace>
</documentation> */



UCBInternet = {};

/* <documentation about="UCBInternet.init" type="init function">
	<summary>This function containes all calls made to functions used within UCB website.
		It is initialized on page load (Lib.addEvent(window, "load", UCBInternet.init);).	
	</summary>
	<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.init = function() {
	try {
		Lib.debug = true; 
		
		UCBInternet.addButtonHovers();		
		
		UCBInternet.addUtilities();
		UCBInternet.initUtilities();
		
		UCBInternet.addSitemapFunctionality();
		
		UCBInternet.addMenuTabHovers();
		UCBInternet.addTableRowHovers();
		UCBInternet.addListItemHovers();
		UCBInternet.addBlockquoteHovers();
		UCBInternet.addIntroBlockHovers();
		
		UCBInternet.replaceIntroLinks();
		UCBInternet.safariSearch();
		
		//UCBInternet.setHomeVisited(Lib.getCookie("homeVisited"));
		
		Lib.addDefaultTextAttribute(document.getElementById("site-search"));
		Lib.inputAutoClear(document.getElementById("site-search"));
		
		/* <documentation about="UCBInternet.resizeUtilScreen" type="FUNCTION CALL">
			<summary>Calling Lib.addEvent: Add UCBInternet.resizeUtilScreen as eventhandler on window resize event</summary>
		</documentation> */
		Lib.addEvent(window, "resize", UCBInternet.resizeUtilScreen);
		Lib.eventCache.add(window, "resize", UCBInternet.resizeUtilScreen, false); 
		UCBInternet.initContactHeadingsIE();
	}
	catch (ex){ Lib.errHandler(ex); }

}

/* <documentation about="UCBInternet.addUtitlities" type="specific function">
	<summary>This function adds functionality to the utilitymenu</summary>
	<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.addUtilities = function(){
	// semi-opaque screen covers site when utility menus are activated:
	var d = document.createElement('div');
	d.id = "utility-screen";
	document.getElementById("header").appendChild(d);
	var fr = document.createElement('iframe');
	fr.id = 'utility-iframe';
	document.getElementById("header").appendChild(fr);
	
	// text-resize functionality:
    /*
	var textResize = Lib.getElementsByClassName("text-resize","li",document.getElementById("header"))[0];
	var textResizeLink = textResize.getElementsByTagName("a")[0];
	var textResizeBlock = Lib.getElementsByClassName("text-resize-block")[0];
	//textResizeBlock.bigResLeft = "350px";
	//textResizeBlock.smallResLeft = "250px";
	textResizeLink.onclick = function(){UCBInternet.showUtility(textResizeBlock); return false; };
	Lib.eventCache.add(textResizeLink, "onclick", function(){UCBInternet.showUtility(Lib.getElementsByClassName("text-resize-block")[0]); return false;}, false); 	
	
	var resizeClose = Lib.getElementsByClassName("close","a",textResizeBlock)[0];
	resizeClose.onclick = function(){ UCBInternet.hideUtility(textResizeBlock); return false; };
	Lib.eventCache.add(resizeClose, "onclick",function(){ UCBInternet.hideUtility(textResizeBlock); return false; }, false);
	
		//add resize functionality on links
		var resizeLinks = textResizeBlock.getElementsByTagName("a");
		
		//get fontsize for active link
		var fontSize = Lib.getCookie("fontsize");
		if(!fontSize) { fontSize = "medium"; }
		
		for(var i=0; i<resizeLinks.length; i++) {
			if(resizeLinks[i].className == "close") { continue; } //don not use close link
			
			if(resizeLinks[i].id == fontSize + "Font") { resizeLinks[i].className = "active"; }	//set active link on page load
			
			resizeLinks[i].allResizeLinks = resizeLinks;		//take all links with link; to be used in doResizeFont
			resizeLinks[i].textResizeBlock = textResizeBlock;	//take text resize block with link; to be used in doResizeFont
			
			//add doResizeFont on link click event 
			resizeLinks[i].onclick = function() { UCBInternet.doResizeFont(this); return false; };
			Lib.eventCache.add(resizeLinks[i], "onclick", function() { UCBInternet.doResizeFont(this); return false; }, false); 
		}
	*/
	// recommend page functionality:
	/*
	var recommend = Lib.getElementsByClassName("recommend")[0];
	var recommendLink = recommend.getElementsByTagName("a")[0];
	var recommendBlock = Lib.getElementsByClassName("recommend-page-block")[0];
	//recommendBlock.bigResLeft = "220px";
	//recommendBlock.smallResLeft = "110px";
	recommendLink.onclick = function(){UCBInternet.showUtility(recommendBlock); return false; };
	Lib.eventCache.add(recommendLink, "onclick", function(){UCBInternet.showUtility(Lib.getElementsByClassName("recommend-page-block")[0]); return false; }, false); 
	
	var recommendClose = Lib.getElementsByClassName("close","a",recommendBlock)[0];
	recommendClose.onclick = function(){ UCBInternet.hideUtility(recommendBlock); return false; };
	Lib.eventCache.add(recommendClose, "onclick",function(){ UCBInternet.hideUtility(recommendBlock); return false; }, false);		
	*/
}

/* <documentation about="UCBInternet.showUtitlity" type="specific function">
	<summary>This function shows the chosen utility</summary>
	<namespace>UCBInternet</namespace>
	<param type="string" descr="Block that you want to be shown">utilityBlock</param>
</documentation> */
UCBInternet.showUtility = function(utilityBlock){
	UCBInternet.solveIE7SitemapBug();
	var calculatedLeftPos = (Lib.getWindowWidth()-utilityBlock.offsetWidth)/2;
	if(calculatedLeftPos<20) calculatedLeftPos = 20;

	var calculatedTopPos = (Lib.getWindowHeight()-utilityBlock.offsetHeight)/2;
	if(calculatedTopPos<20) calculatedTopPos = 20;
	utilityBlock.style.left = calculatedLeftPos + "px";
	utilityBlock.style.top = calculatedTopPos + "px";
	Lib.showElements(document.getElementById("utility-screen"), document.getElementById("utility-iframe")); 
	UCBInternet.resizeUtilScreen();
}

/* <documentation about="UCBInternet.hideUtitlity" type="specific function">
	<summary>This function hides the chosen utility</summary>
	<namespace>UCBInternet</namespace>
	<param type="string" descr="Block that you want to be hidden">utilityBlock</param>
</documentation> */
UCBInternet.hideUtility = function(utilityBlock){
	UCBInternet.solveIE7SitemapBug();
	utilityBlock.style.left = "-999em";
	Lib.hideElements(document.getElementById("utility-screen"), document.getElementById("utility-iframe")); 
}


/* <documentation about="UCBInternet.initUtilities" type="specific function">
	<summary>This function adds functionality to utility items so the "phone" utitility is returned to its default state</summary>
	<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.initUtilities = function() {
	var phoneListItem = Lib.getElementsByClassName("phone","li",document.getElementById("header"))[0];
	var phoneLink = phoneListItem.getElementsByTagName("a")[0];
	phoneLink.className = "active";
	var utilitiesList = Lib.getElementsByClassName("utilities","ul",document.getElementById("header"))[0];
	var utilitiesItems = utilitiesList.getElementsByTagName("a");
	for(var i=0; i<utilitiesItems.length; i++){
		if(utilitiesItems[i].parentNode.className.indexOf("phone")<0){
			utilitiesItems[i].phoneLink = phoneLink;
			utilitiesItems[i].onmouseover = function(){
				this.phoneLink.className = "inactive";
			}
			Lib.eventCache.add(utilitiesItems[i], "onmouseover",function(){ this.phoneLink.className = "inactive"; }, false);	
			utilitiesItems[i].onmouseout = function(){
				this.phoneLink.className = "active";
			}
			Lib.eventCache.add(utilitiesItems[i], "onmouseout",function(){ this.phoneLink.className = ""; }, false);	
			
		}
	}
}


/* <documentation about="UCBInternet.solveIEySitemapBug" type="specific function">
	<summary>This function solves bug in IE7: relative position of ul.sitemap; interferes with text-resize-block</summary>
	<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.solveIE7SitemapBug = function () {
	if(Lib.getBodyId() != "sitemapPage" || !Lib.ie7) { return; }
	
	var ulSitemap = Lib.getElementsByClassName("sitemap", "ul")[0];
	
	if(ulSitemap.className=="sitemap") { ulSitemap.className = "sitemap static"; }
	else { ulSitemap.className = "sitemap"; }
}

/* <documentation about="UCBInternet.resizeUtilScreen" type="specific function">
	<summary>This function resizes the utility screen when window is resized</summary>
	<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.resizeUtilScreen = function(){
	var allContainerHeight = document.getElementById("all-container").offsetHeight;
	if(document.getElementById("utility-screen")) {
		document.getElementById("utility-screen").style.height = allContainerHeight + "px";
		document.getElementById("utility-iframe").style.height = allContainerHeight + "px";
	}
}

/* <documentation about="UCBInternet.addButtonHovers" type="specific function">
	<summary>This function adds the rollover functionality to submit-buttons</summary>
	<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.addButtonHovers = function(){
	var allButtons = Lib.getElementsByClassName("button");
	for(var i=0; i<allButtons.length; i++){
		if(allButtons[i].type == "image"){
			allButtons[i].onmouseover = function(){
				this.src = this.src.replace(".gif","-ro.gif");
			}
			Lib.eventCache.add(allButtons[i], "onmouseover",function(){ this.src = this.src.replace(".gif","-ro.gif"); }, false);	
			allButtons[i].onmouseout = function(){
				this.src = this.src.replace("-ro.gif",".gif");
			}
			Lib.eventCache.add(allButtons[i], "onmouseout",function(){ this.src = this.src.replace("-ro.gif",".gif"); }, false);	
		}
		if(allButtons[i].type == "submit"){
			allButtons[i].originalClass = allButtons[i].className;
			allButtons[i].onmouseover = function(){
				this.className = this.className+" hover";
			}
			Lib.eventCache.add(allButtons[i], "onmouseover",function(){ this.className = this.className+" hover"; }, false);	
			allButtons[i].onmouseout = function(){
				this.className = this.originalClass;
			}
			Lib.eventCache.add(allButtons[i], "onmouseout",function(){ this.className = this.originalClass; }, false);	
		}
	}
}

/* <documentation about="UCBInternet.addBlockquoteHovers" type="specific function">
	<summary>This function adds the rollover functionality to links in blockquote</summary>
	<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.addBlockquoteHovers = function(){
	if(!document.getElementById("page-content")) return;
	var allBlockquotes = document.getElementById("page-content").getElementsByTagName("blockquote");
	for(var i=0; i<allBlockquotes.length; i++){
		if(!allBlockquotes[i].getElementsByTagName("a")[0]) continue;
		var blockquoteLink = allBlockquotes[i].getElementsByTagName("a")[0];
		if(blockquoteLink.getElementsByTagName("img")[0]){
			blockquoteLink.bqImage = blockquoteLink.getElementsByTagName("img")[0];
			blockquoteLink.onmouseover = function(){
				this.bqImage.src = this.bqImage.src.replace(".gif","-ro.gif");
			}
			Lib.eventCache.add(blockquoteLink, "onmouseover",function(){ this.bqImage.src = this.bqImage.src.replace(".gif","-ro.gif"); }, false);	
			blockquoteLink.onmouseout = function(){
				this.bqImage.src = this.bqImage.src.replace("-ro.gif",".gif");
			}
			Lib.eventCache.add(blockquoteLink, "onmouseout",function(){ this.bqImage.src = this.bqImage.src.replace("-ro.gif",".gif"); }, false);	
		}
	}	
}

/* <documentation about="UCBInternet.addIntroBlockHovers" type="specific function">
	<summary>This function adds the rollover functionality to links in intro-block paragraphs</summary>
	<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.addIntroBlockHovers = function(){
	if(!document.getElementById("page-content")) return;
	var allIntroBlocks = Lib.getElementsByClassName("intro-block");
	for(var i=0; i<allIntroBlocks.length; i++){
		if(!allIntroBlocks[i].getElementsByTagName("p").length>0) continue;
		if(!allIntroBlocks[i].getElementsByTagName("a").length>0) continue;
		var allIntroLinks = allIntroBlocks[i].getElementsByTagName("a");
		for(var n=0; n<allIntroLinks.length; n++){
			if(!allIntroLinks[n].getElementsByTagName("img")[0]) continue;
			allIntroLinks[n].ibImage = allIntroLinks[n].getElementsByTagName("img")[0];
			allIntroLinks[n].onmouseover = function(){
				this.ibImage.src = this.ibImage.src.replace(".gif","-ro.gif");
			}
			Lib.eventCache.add(allIntroLinks[n], "onmouseover",function(){ this.ibImage.src = this.ibImage.src.replace(".gif","-ro.gif"); }, false);	
			allIntroLinks[n].onmouseout = function(){
				this.ibImage.src = this.ibImage.src.replace("-ro.gif",".gif");
			}
			Lib.eventCache.add(allIntroLinks[n], "onmouseout",function(){ this.ibImage.src = this.ibImage.src.replace("-ro.gif",".gif"); }, false);			
		}
	}	
}

/* <documentation about="UCBInternet.addMenuTabHovers" type="specific function">
	<summary>This function adds rollover behaviour to menu tabs</summary>
	<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.addMenuTabHovers = function(){
	var menuArr = new Array;
	if (!Lib.getElementsByClassName("menu")) { return; }
	var menuTabs = Lib.getElementsByClassName("menu");
	for(var i=0; i<menuTabs.length; i++){
		var menuListItems = menuTabs[i].getElementsByTagName("LI");
		for(var j=0; j<menuListItems.length; j++) {
			if (menuListItems[j].className != "current") {
				menuArr[menuArr.length] = new menuTab(this,menuListItems[j]);
			}
		}
	}
}
menuTab = function(addMenuTabHovers, listitem) {
	this.addMenuTabHovers = addMenuTabHovers;
	this.listitem = listitem;
	this.listitem.menuTab = this;
	this.listitem.onmouseover = function() {
		this.className = "active";
		return false;
	}
	this.listitem.onmouseout = function() {
		this.className = "";
		return false;
	}
}

/* <documentation about="UCBInternet.addTablRowHovers" type="specific function">
	<summary>This function adds rollover functionality to tablerows</summary>
	<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.addTableRowHovers = function(){
	var hoverTableRow = function(currentLink){
		var currentRow = currentLink.parentRow;
		if(currentRow.className.indexOf("hovered")<0){
			currentRow.className = "hovered";
		} else {
			currentRow.className = "";
		}
	}
		
	var agendaTables = Lib.getElementsByClassName("agenda-table");
	
	for(var i=0; i<agendaTables.length; i++){
		var agendaRows = agendaTables[i].getElementsByTagName("tr");
		for(var n=0; n<agendaRows.length; n++){
			var rowLinks = agendaRows[n].getElementsByTagName("a");
			for(var q=0; q<rowLinks.length; q++){
				if(rowLinks[q].getElementsByTagName("span")[0] && rowLinks[q].getElementsByTagName("span")[0].className == "title"){
					rowLinks[q].parentRow = agendaRows[n];
					rowLinks[q].onmouseover = function(){
						hoverTableRow(this);
					}
					Lib.eventCache.add(rowLinks[q], "onmouseover", function () {  hoverTableRow(this); }, false);	
					rowLinks[q].onmouseout = function(){
						hoverTableRow(this);
					}
					Lib.eventCache.add(rowLinks[q], "onmouseout", function () {  hoverTableRow(this); }, false);	
				}
			}
		}
	}
}
/* <documentation about="UCBInternet.addListItemHovers" type="specific function">
	<summary>This function adds rollover functionality to list items</summary>
	<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.addListItemHovers = function(){
	var hoverLists = new Array("overview-list");
	
	for(var i=0; i<hoverLists.length; i++){
		var currentLists = Lib.getElementsByClassName(hoverLists[i],"ul",document.getElementById("page-content"));	
		for(var n=0; n<currentLists.length; n++){
			var currentItems = currentLists[n].getElementsByTagName("li");
			for(var q=0; q<currentItems.length; q++){
				var currentLink = currentItems[q].getElementsByTagName("a")[0];
				currentLink.parentListItem = currentItems[q];
				currentLink.onmouseover = function(){
					this.parentListItem.className = "hovered";
				}
				Lib.eventCache.add(currentLink, "onmouseover", function () { this.parentListItem.className = "hovered"; }, false);	
				currentLink.onmouseout = function(){
					this.parentListItem.className = "";
				}
				Lib.eventCache.add(currentLink, "onmouseout", function () { this.parentListItem.className = ""; }, false);	
			}
		}
		
	}
}

/* <documentation about="UCBInternet.replaceIntroLinks" type="specific function">
	<summary>This function replaces the arrow-button in <div class="intro-block"> within the adjacent <li>-tag</summary>
	<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.replaceIntroLinks = function(){
	var introBlocks = Lib.getElementsByClassName("intro-block","div",document.getElementById("page-content"));	
	for(var i=0; i<introBlocks.length; i++){		
		var teaserLink = Lib.getElementsByClassName("teaser-link","a",introBlocks[i])[0];
		if (!teaserLink) {
			continue;
		}
		else {
			var previousElement = Lib.getPreviousElement(teaserLink)
			/*if(previousElement.tagName.toLowerCase() == "p"){
				previousElement.appendChild(teaserLink);
			}*/
			
			if(previousElement){
				if(previousElement.tagName.toLowerCase() == "ul" || previousElement.tagName.toLowerCase() == "ol"){
					var  allListItems = previousElement.getElementsByTagName("li");
					if(allListItems[allListItems.length-1]){

						if(allListItems[allListItems.length-1].getElementsByTagName("p")[0]){
							var itemsParagraph = allListItems[allListItems.length-1].getElementsByTagName("p")[0];
							itemsParagraph.appendChild(teaserLink);
						} else {
							
							allListItems[allListItems.length-1].appendChild(teaserLink);
						}
					}
				}
			}
			teaserLink.img = teaserLink.getElementsByTagName("img")[0];
			teaserLink.onmouseover = function(){
				this.img.src = this.img.src.replace(".gif","-ro.gif");
			}
			Lib.eventCache.add(teaserLink, "onmouseover",function(){ this.img.src.replace(".gif","-ro.gif"); }, false);	
			teaserLink.onmouseout = function(){
				this.img.src = this.img.src.replace("-ro.gif",".gif");
			}
			Lib.eventCache.add(teaserLink, "onmouseout",function(){ this.img.src.replace("-ro.gif",".gif"); }, false);
		}
	}
}

/* <documentation about="UCBInternet.safariSearch" type="specific function">
	<summary>This function changes the search element in the header to a safari proprietary input element</summary>
	<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.safariSearch = function() {
	if (!Lib.safari || !document.getElementById("site-search") || !document.getElementById("site-search-submit")) {
		return;
	}
	else {
		var sSearch = document.getElementById("site-search");
		var sSubmit = document.getElementById("site-search-submit");
		sSearch.type = "search";
		sSearch.parentNode.className = "saf";
		sSubmit.src = sSubmit.src.replace('submit','safari');
		sSubmit.onmouseover = function() {
			this.src = sSubmit.src.replace('.gif','-ro.gif');
		}
		Lib.eventCache.add(sSubmit, "onmouseover",function(){ this.src = sSubmit.src.replace('.gif','-ro.gif'); }, false);	
		sSubmit.onmouseout = function() {
			this.src = sSubmit.src.replace('-ro.gif','.gif');
		}
		Lib.eventCache.add(sSubmit, "onmouseout",function(){ this.src = sSubmit.src.replace('-ro.gif','.gif'); }, false);	
	}
}


/* <documentation about="UCBInternet.doResizeFont" type="specific function">
	<summary>This function is executed when a visitor clicks a "resize font" hyperlink</summary>
	<namespace>UCBInternet</namespace>
	<param type="object" descr="Hyperlink object">hyperlink</param>
</documentation> */
UCBInternet.doResizeFont = function (hyperlink) {
	try {
		//reset active link
		for(var i=0; i<hyperlink.allResizeLinks.length; i++) {
			if(hyperlink.allResizeLinks[i].className != "close") { hyperlink.allResizeLinks[i].className = ""; }
		}
		
		UCBInternet.setFontSize(hyperlink.parentNode.className, true);		//resize font
		hyperlink.className = "active";//set active link
		
		//UCBInternet.hideUtility(hyperlink.textResizeBlock);				//hide utility block	
	} catch (ex){ Lib.errHandler(ex); }
}


/* <documentation about="UCBInternet.setFontSize" type="specific function">
	<summary>This function adds a new stylesheet to the page and if removeStylesheets=true, all font-resize stylesheets are removed</summary>
	<namespace>UCBInternet</namespace>
	<param type="string" descr="Indicates if font is smallest, small, medium, large or largest">status</param>
	<param type="bool descr="if true, all font-resize stylesheets are removed">removeStylesheets</param></strong>
</documentation> */
UCBInternet.setFontSize = function (status, removeStylesheets) {
	try {
		if(!status || status.length==0) { status="medium"; }
		
		//remove all stylesheets for font size
		if(removeStylesheets) { 
			Lib.removeStyleSheet("smallest-size.css");
			Lib.removeStyleSheet("small-size.css");
			Lib.removeStyleSheet("medium-size.css");
			Lib.removeStyleSheet("large-size.css");
			Lib.removeStyleSheet("largest-size.css");
		}
		
		Lib.addStyleSheet("static/css/" + status + "-size.css"); //add resize stylesheet
		
		Lib.setCookie("fontsize", status)
	} catch (ex){ Lib.errHandler(ex); }
}

/* <documentation about="UCBInternet.setHomeVisited" type="specific function">
	<summary>This function sets a cookie when home is visited the first time</summary>
	<namespace>UCBInternet</namespace>
	<param type="string" descr="Checks if user visits home for the first time">status</param>
</documentation> */
UCBInternet.setHomeVisited = function (status) {
	try {
		//if(document.getElementsByTagName("body")[0].className == "home"){ 
			var currStatus = "";
			if(!status || status.length==0) { 
				var expires = new Date();
				var farFarFuture = 60000*60*24*365*10; // this represents about 10 years from now and makes the cookie persistent
				expires.setTime(expires.getTime()+farFarFuture);
				Lib.setCookie("homeVisited", "visited", expires);
			}	
			else { currStatus = "visited"; }			
			
			return currStatus;
		//}
	} catch (ex){ Lib.errHandler(ex); }
}


/* <documentation about="UCBInternet.addSitemapFunctionality" type="specific function">
	<summary>This function adds a folding out functionality to sitemap</summary>
	<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.addSitemapFunctionality = function (){
	try {
		if(Lib.getBodyId() != "sitemapPage") { return; }
		
		//private function: to show/hide sub
		var toggleSitemapSub = function (hyperlink) {
			var li = hyperlink.parentNode.parentNode;
			
			if (li.className == "active") { location.href=hyperlink.href; }
			else {   
				resetSitemapSubs();
				
				li.className = "active";
				var strong = document.createElement("strong");
				strong.innerHTML = hyperlink.innerHTML; 
				hyperlink.innerHTML = ""; 
				hyperlink.appendChild(strong);
				
				var subList = li.getElementsByTagName("ul")[0];
				var currentH2 = li.getElementsByTagName("h2")[0];
				var currentFirstLevelHeigth = currentH2.parentHeight;
				
				// check if height of chosen firstlevel-item has changed; Text could be resized so height of 1st level items has to be re-calculated;

				if(currentH2.currentHeight != currentH2.offsetHeight){
					currentFirstLevelHeigth = firstLevelHeight();
					currentH2.currentHeight = currentH2.offsetHeight;
					currentH2.parentHeight = currentFirstLevelHeigth;
				}
				
				if(currentFirstLevelHeigth < subList.offsetHeight) {
					li.parentNode.style.height = subList.offsetHeight/10 + 4 + "em";
				}
				else { li.parentNode.style.height= "auto"; }
			}					
		}
		
		//private function: to hide sub
		var resetSitemapSubs = function () {
			var activeListItems = Lib.getElementsByClassName("active", "li", ulSitemap);
			for(var i=0; i<activeListItems.length; i++) {
				activeListItems[i].className = "";
				
				var strong = activeListItems[i].getElementsByTagName("strong")[0];
				var hyperlink = strong.parentNode;
				hyperlink.innerHTML = strong.innerHTML;
			}
		}
		
		//private function: to calculate height of 1st level navigation
		var firstLevelHeight = function(){
			var ulSitemap = Lib.getElementsByClassName("sitemap", "ul")[0];
			var firstLevelItems = ulSitemap.getElementsByTagName("h2");
			var currentHeight = 0;
			for(var n=0; n<firstLevelItems.length; n++) {
				currentHeight += firstLevelItems[n].offsetHeight;
			}
			return currentHeight;
		}
		
		var ulSitemap = Lib.getElementsByClassName("sitemap", "ul")[0];
		var h2s = ulSitemap.getElementsByTagName("h2");
		var firstLevelCurrentHeight = firstLevelHeight();
		
		for(var i=0; i<h2s.length; i++) {
			var hyperlink = h2s[i].getElementsByTagName("a")[0];
			h2s[i].currentHeight = h2s[i].offsetHeight;
			h2s[i].parentHeight = firstLevelCurrentHeight;
			
			if(i==0) { toggleSitemapSub(hyperlink); }
			
			hyperlink.onclick = function () {  toggleSitemapSub(this); return false; };
			Lib.eventCache.add(hyperlink, "onclick", function () {  toggleSitemapSub(this); return false; }, false);				
		}
	} catch (ex){ Lib.errHandler(ex); }
}
/* <documentation about="UCBInternet.initContactHeadingsIE" type="specific function">
<summary>This function adds a height to headers in contact-block specific for IE</summary>
<namespace>UCBInternet</namespace>
</documentation> */
UCBInternet.initContactHeadingsIE = function() {
if(!Lib.ie) return;
var contactBlocks = Lib.getElementsByClassName("contact-block","div",document.getElementById("page-content"));
for(var i=0; i<contactBlocks.length; i++){
	var h = contactBlocks[i].getElementsByTagName("h2")[0];
	h.style.height = "72px";
}
}

/* <documentation about="Lib.addStyleSheet('static/css/js-enabled-styles.css')" type="FUNCTION CALL">
	<summary>Add javascript style sheet to hide folds outs</summary>
</documentation> */
Lib.addStyleSheet("static/css/js-enabled-styles.css");

/* <documentation about="setFontSize" type="FUNCTION CALL">
	<summary>Set font size at initailisation of page</summary>
</documentation> */
UCBInternet.setFontSize(Lib.getCookie("fontsize"), false);

/* <documentation about="setFontSize" type="FUNCTION CALL">
	<summary>Set font size at initailisation of page</summary>
</documentation> */
UCBInternet.setFontSize(Lib.getCookie("fontsize"), false);

/* <documentation about="UCBInternet.init" type="FUNCTION CALL">
	<summary>Calling Lib.addEvent: Add UCBInternet.init as eventhandler on window onload event</summary>
</documentation> */
Lib.addEvent(window, "load", UCBInternet.init);
Lib.eventCache.add(window, "load", UCBInternet.init, false); 	

-->

