/*	sIFR 2.0.1 Official Add-ons 1.2
	Copyright 2005 Mark Wubben

	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

if(typeof sIFR=="function")(function(){var j=document;var h=j.documentElement;sIFR.removeDecoyClasses=function(){function a(b){if(b&&b.className!=null)b.className=b.className.replace(/\bsIFR-hasFlash\b/,"")}return function(){a(h);a(j.getElementsByTagName("body")[0])}}();sIFR.preferenceManager={storage:{sCookieId:"sifr",set:function(a){var b=new Date();b.setFullYear(b.getFullYear()+3);j.cookie=[this.sCookieId,"=",a,";expires=",b.toGMTString(),";path=/"].join("")},get:function(){var a=j.cookie.match(new RegExp(";?"+this.sCookieId+"=([^;]+);?"));if(a!=null&&a[1]=="false")return false;else return true},reset:function(){var a=new Date();a.setFullYear(a.getFullYear()-1);j.cookie=[this.sCookieId,"=true;expires=",a.toGMTString(),";path=/"].join("")}},disable:function(){this.storage.set(false)},enable:function(){this.storage.set(true)},test:function(){return this.storage.get()}};if(sIFR.preferenceManager.test()==false){sIFR.bIsDisabled=true;sIFR.removeDecoyClasses()}sIFR.rollback=function(){function a(b){var c,d,e,f,g,h;var l=parseSelector(b);var i=l.length-1;var m=false;while(i>=0){c=l[i];l.length--;d=c.parentNode;if(c.getAttribute("sifr")=="true"){h=0;while(h<d.childNodes.length){c=d.childNodes[h];if(c.className=="sIFR-alternate"){e=c;h++;continue}d.removeChild(c)}if(e!=null){f=e.firstChild;while(f!=null){g=f.nextSibling;d.appendChild(e.removeChild(f));f=g}d.removeChild(e)}if(!sIFR.UA.bIsXML&&sIFR.UA.bUseInnerHTMLHack)d.innerHTML+="";d.className=d.className.replace(/\bsIFR\-replaced\b/,"")};m=true;i--}return m}return function(k){named.extract(arguments,{sSelector:function(a){k=a}});if(k==null)k="";else k+=">";sIFR.removeDecoyClasses();sIFR.bHideBrowserText=false;if(a(k+"embed")==false)a(k+"object")}}()})()







/* bespoke hackett navigational functions */
function loopList(thisSection,subElement){
	var secondLevelMenus = new Array();
	for(s=0;s<thisSection.childNodes.length;s++){
		if(thisSection.childNodes[s].nodeName=="UL" || thisSection.childNodes[s].nodeName=="OL"){ // we have a menu block
			//we need a var to check againest at the end of the loop so we know whether the sub menu is open or not
			var childOn = false;
			
			//get all the list items in this set
			var menuBlock = thisSection.childNodes[s];

			//loop through list items in this menuBlock
			for(mb=0;mb<menuBlock.childNodes.length;mb++){
				
				
				//not needed but best to double check we have a list item
				if(menuBlock.childNodes[mb].nodeName=="LI"){
					//get the list item...
					var listItem = menuBlock.childNodes[mb];
					
					
					//get the channel reference from the href
					var thisChannel = listItem.firstChild.attributes["href"].value.substring(listItem.firstChild.attributes["href"].value.indexOf("=")+1);
				
					// check if it matches our page and if so turn it on
					if(thisChannel == thisPage){
						listItem.className="on";
						childOn = true;

					}else{
						// check to see if this has a sub menu
					
						secondLevelMenus.push(listItem)
						
					}
				}
			
			}
			if(childOn) menuBlock.style.display = "block";
			else if(subElement)	menuBlock.style.display = "none";
		}
	}
	return secondLevelMenus;
}

function buildMenu(){
	var LNav = document.getElementById("leftNavigation");
	for(i=0;i<LNav.childNodes.length;i++){
		// each menu section ie Style
		// we now need to loop through this section
	
		//Get this sections children ie sectionHeader and main ul container
		var thisSection = LNav.childNodes[i];
	
	
		var secondLevelMenus = loopList(thisSection,false);
	
		for(slm=0;slm<secondLevelMenus.length;slm++){
		loopList(secondLevelMenus[slm],true)
		}
	}
}
