
			// Hub JavaScript Code



//function to retrieve Elements by a given class name

function getElementsByClass(searchClass,node,tag) {

  var classElements = new Array();

  if (node == null)

    node = document;

  if (tag == null)

    tag = '*';

  var els = node.getElementsByTagName(tag);

  var elsLen = els.length;

  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");

  for (i = 0, j = 0; i < elsLen; i++) {

    if (pattern.test(els[i].className) ) {

      classElements[j] = els[i];

      j++;

    }

  }

  return classElements;

}


//function to set style display to none or to nothing depend current state, for a given class name

function change(classname){

for (var i=0; i < getElementsByClass(classname).length; i++){

	var contractElement = getElementsByClass(classname)[i]

	if (contractElement.style.display=="none"){

		contractElement.style.display='';

		}

	else {

		contractElement.style.display="none";

		}

	}

}


//function to set style display to none or to nothing depend current state, for a given class name

function showHideSummary(){

for (var i=0; i < getElementsByClass('summary').length; i++){

	var contractElement = getElementsByClass('summary')[i]

	if (contractElement.style.display=="none"){

		contractElement.style.display='';

		}

	else {

		contractElement.style.display="none";

		}

	}

}



//function to set style display to none or to block depend current state, for a given id name


function showhide(id) {


	var showhideElement = document.getElementById(id)


	if (showhideElement.style.display=='none'){

		showhideElement.style.display='block';

		}


	else {

		showhideElement.style.display='none';

		}

}


//function to implement the topic navigation

//Mark Price 5/8/2008

function tabClick(selectedTab){


//If the print or hi-vis stylesheet is being used don't implement tabbing

var linkTags = document.getElementsByTagName("link")

for (i=0; i < linkTags.length; i++) {

	if(linkTags[i].getAttribute("rel").indexOf("stylesheet") > -1){

		if (linkTags[i].getAttribute("title") == "Hub Print Stylesheet" || linkTags[i].getAttribute("title") == "Hub Hi-Vis Stylesheet") {

			if(selectedTab == "0"){

				//the page has just loaded so link to the content not a tab

				window.location.hash=("skiptocontent"); 

			   }

			else{

				//otherwise the user has clicked a link so jump to that one

				window.location.hash=("linkContent" + selectedTab); 

			   }

			return;

		}

	}

}

if (selectedTab == "0"){

	//the page has just loaded so display tab 1

	selectedTab = "2"

	}

//loop through each of the available topic tabs on the page	

i = 1

var tabContentElement = document.getElementById("tabContent" + i)

var tab_li_Element = document.getElementById("tab_li_" + i)

var tab_ahref_Element = document.getElementById("tab_ahref_" + i) 

<!-- switch the tabs on if javascript is enabled (i.e. if this function is called) -->

var tabULElement = document.getElementById("topic-navigation-ul")

tabULElement.className="withtabs"


while(tabContentElement != undefined){

	if(i == selectedTab){

		//this is the tab the user has just selected so style the tab as 'seleted' and display the actual content

		tab_li_Element.className='current'

		tab_ahref_Element.className='current'

		tabContentElement.style.display=''

				var divRelatedGraphs = document.getElementById("related-graphs")

				var divContactDetails = document.getElementById("contact-details")


				if(i == 1){

					//They've selected "Overview" so show the related stuff at the bottom of the page

					if(divRelatedGraphs != undefined){

						divRelatedGraphs.style.display=''

						}

					if(divContactDetails != undefined){

						divContactDetails.style.display=''

						}

					}

				else{

					//They've not selectd "Overview so hide the related stuff at the bottom of the page

					if(divRelatedGraphs != undefined){

						divRelatedGraphs.style.display='none'

						}

					if(divContactDetails != undefined){

						divContactDetails.style.display='none'

						}

					}

		}

	else{

		//this is one of the unselected tabs so style the tab as 'unselected and hide the content from the user

		tab_li_Element.className=''

		tab_ahref_Element.className=''

		tabContentElement.style.display='none'

		}


	<!-- switch the back-to-top links off if javascript is enabled -->

	var backToTopHotspotElement = document.getElementById("back-to-top" + i)

	backToTopHotspotElement.style.display='none'


	i = i + 1

	var tabContentElement = document.getElementById("tabContent" + i)

	var tab_li_Element = document.getElementById("tab_li_" + i)

	var tab_ahref_Element = document.getElementById("tab_ahref_" + i)

	}

}


//function to implement the graph navigation

//Mark Price 5/8/2008

function graphTabClick(selectedTab){

//If the print stylesheet is being used don't implement tabbing

var linkTags = document.getElementsByTagName("link")

for (i=0; i < linkTags.length; i++) {

	if(linkTags[i].getAttribute("rel").indexOf("stylesheet") > -1){

		if (linkTags[i].getAttribute("title") == "Hub Print Stylesheet" || linkTags[i].getAttribute("title") == "Hub Hi-Vis Stylesheet") {

			return;

		}

	}

}


//loop through each of the available graph tabs on the page

i = 1

var tabContentElement = document.getElementById("graphTabContent" + i)

var tab_li_Element = document.getElementById("graph_tab_li_" + i)

var tab_ahref_Element = document.getElementById("graph_tab_ahref_" + i) 

<!-- switch the tabs on if javascript is enabled (i.e. if this function is called) -->

var tabULElement = document.getElementById("graph-navigation-ul")


while(tabContentElement != undefined){

	tabULElement.className="withtabs"

	if(i == selectedTab){

		//this is the tab the user has just selected so style the tab as 'seleted' and display the actual content

		tab_li_Element.className='current'

		tab_ahref_Element.className='current'		

		tabContentElement.style.display=''

		}

	else{

		//this is one of the unselected tabs so style the tab as 'unselected and hide the content from the user

		tab_li_Element.className=''

		tab_ahref_Element.className=''		

		tabContentElement.style.display='none'

		}

	i = i + 1

	var tabContentElement = document.getElementById("graphTabContent" + i)

	var tab_li_Element = document.getElementById("graph_tab_li_" + i)

	var tab_ahref_Element = document.getElementById("graph_tab_ahref_" + i)

	}

}


//function to implement the topic glossary filter

//Mark Price 5/8/2008

function glossaryClick(selectedTab){


//If the print stylesheet is being used don't implement tabbing

var linkTags = document.getElementsByTagName("link")

for (i=0; i < linkTags.length; i++) {

	if(linkTags[i].getAttribute("rel").indexOf("stylesheet") > -1){

		if (linkTags[i].getAttribute("title") == "Hub Print Stylesheet" || linkTags[i].getAttribute("title") == "Hub Hi-Vis Stylesheet") {

			return;

		}

	}

}

	//Loop through all the glossary entry li tags switching them on or off

	var liTags = document.getElementsByTagName("li");

	for (i=0; i<liTags.length; i++) {

		var str=liTags[i].className

		if(str.indexOf("glossarySet") > -1){

			if (liTags[i].className=="glossarySet" + selectedTab) {

				liTags[i].style.display="";

				}

			else{					

				liTags[i].style.display="none";

			}

		}															

	}

	//now style the navigation letters

	i = 1

	var tab_li_Element = document.getElementById("glossaryNav" + i)

	while(tab_li_Element != undefined){

		if(i == selectedTab){

			//this is the tab the user has just selected so style the tab as 'seleted' and display the actual content

			tab_li_Element.className='current'

			}

		else{

			//this is one of the unselected tabs so style the tab as 'unselected and hide the content from the user

			tab_li_Element.className=''

			}

		i = i + 1

		var tab_li_Element = document.getElementById("glossaryNav" + i)

	}

}

function makeTreesC() {

    if (!document.createElement) return;


    uls = document.getElementsByTagName("ul");

    for (uli=0;uli<uls.length;uli++) {

        ul = uls[uli];

        if (ul.nodeName == "UL" && ul.className == "aqtree3clickable") {

            processULELC(ul);

        }

    }

}


function processULELC(ul) {

    if (!ul.childNodes || ul.childNodes.length == 0) return;

    // Iterate LIs

    for (var itemi=0;itemi<ul.childNodes.length;itemi++) {

        var item = ul.childNodes[itemi];

        if (item.nodeName == "LI") {

            // Iterate things in this LI

            var a;

            var subul;

	    subul = "";

            for (var sitemi=0;sitemi<item.childNodes.length;sitemi++) {

                var sitem = item.childNodes[sitemi];

                switch (sitem.nodeName) {

                    case "A": a = sitem; break;

                    case "UL": subul = sitem; 

                 //              processULELC(subul);

                               break;

                }

            }

            if (subul) {

                associateELC(a,subul);

            } else {

                a.parentNode.className = "aq3bullet";

            }

        }

    }

}


function associateELC(a,ul) {

    if (a.parentNode.className.indexOf('aq3open') == -1)

      a.parentNode.className = 'aq3closed';

     var formatvalue = getQueryVariable("format"); 

     if(formatvalue!='print')

     {

   	a.href = "javascript:return false;";



   	  a.onclick = function () {

        this.parentNode.className = (this.parentNode.className=='aq3open') ? "aq3closed" : "aq3open";

  			return false;

    }    

}   


}


function addEvent(obj, evType, fn){

  if (obj.addEventListener){

    obj.addEventListener(evType, fn, false);

    return true;

  } else if (obj.attachEvent){

	var r = obj.attachEvent("on"+evType, fn);

    return r;

  } else {

	return false;

  }

}



function getQueryVariable(variable) 

{ 

var query = window.location.search.substring(1); 

var vars = query.split("&"); 

for (var i=0;i<vars.length;i++) 

{ 

var pair = vars[i].split("="); 

if (pair[0] == variable) 

{ 

return pair[1]; 

} 

} 

} 



			function newImage(arg) {

				if (document.images) {

					rslt = new Image();

					rslt.src = arg;

					return rslt;

				}

			}


			function changeImages() {

				if (document.images) {

					for (var i=0; i < changeImages.arguments.length; i+=2) {

						document[changeImages.arguments[i]].src = changeImages.arguments[i+1];

					}

				}

			}


			function changeOut() {

				if (document.images) {

					for (var i=0; i < changeOut.arguments.length; i+=3) {

						document[changeOut.arguments[i]].src = changeOut.arguments[i+1];

						if (document.getElementById) {

						   var nodeObj = document.getElementById(changeOut.arguments[i+2])

								nodeObj.style.border='2px solid white';

						}

					}

				}

			}


			function changeOver() {

				if (document.images) {

					for (var i=0; i < changeOver.arguments.length; i+=3) {

						document[changeOver.arguments[i]].src = changeOver.arguments[i+1];

						if (document.getElementById) {

						   var nodeObj = document.getElementById(changeOver.arguments[i+2])

								nodeObj.style.border='2px solid #015D83';

						}

					}

				}

			}


		