	
Behaviour.register({
	'#menu' : function(el){
		
		// Auto-active code adapted from
		/***************************************************************\
		
		  ULTIMATE DROP DOWN MENU Version 4.5 by Brothercake
		  http://www.udm4.com/
		
		\***************************************************************/
	
		var yah={index:"index.php"};

		function compareNumbers(a,b)
		{
			return b[0]-a[0];
		};

		function findHere()
		{
			var tree=el;
			if (yah.hasran == 1) return false;
			yah.hasran = 1;
			yah.uri=top.document.location.href.replace('https://','http://');
			yah.uri=yah.uri.replace(yah.index,'');
			yah.uri=yah.uri.replace(/#.*$/,'');
			yah.uri=yah.uri.replace(/,/g,'%2C');
			yah.home=yah.uri.replace(/^(http\:\/\/.+?\/)(.+)$/,'$1');
			yah.matches=[];
			yah.links=tree.getElementsByTagName('a');
			yah.linksLen=yah.links.length;
			for(var i=0; i<yah.linksLen; i++)
			{
				yah.href=yah.links[i].href.replace('https://','http://');
				if(yah.href&&yah.href!='javascript:void'&&!/[a-z]+\:\/\//.test(yah.href))
				{
					yah.matches=[];
					break;
				}
				yah.href=yah.href.replace(yah.index,'');
				yah.href=yah.href.replace(/,/g,'%2C');
				if(yah.href!=''&&yah.href!='javascript:void'&&yah.uri.indexOf(yah.href)!=-1)
				{
					yah.matches[yah.matches.length]=yah.links[i];
				}
			}
			yah.matchesLen=yah.matches.length;
			if(yah.matchesLen < 1) { return false; }
			yah.probs=[];
			for(i=0; i<yah.matchesLen; i++)
			{
				yah.href=yah.matches[i].href.replace('https://','http://');
				yah.hrefLen=yah.href.length;
				yah.probs[i]=[0,yah.href];
				for(var j=0; j<yah.hrefLen; j++)
				{
					if(yah.href.charAt(j)==yah.uri.charAt(j))
					{
						yah.probs[i][0]++;
					}
				}
			}
			yah.probs.sort(compareNumbers);
			yah.href=yah.probs[0][1];
			for(i=0; i<yah.linksLen; i++)
			{
				yah.linkref=yah.links[i].href.replace('https://','http://');
				
				if(yah.linkref==yah.href)
				{
					/*if (yah.uri!=yah.linkref){
						//alert(yah.linkref);
						// this would potentially block correct addresses
						// but it's here to prevent home from being selected if page not found
						continue;
					}*/
					
					applyHereClass(yah.links[i]);
					return true;
				}
			}
			return true;
		};

		function applyHereClass(link)
		{
			link.parentNode.className = link.parentNode.className ? " active" : "active"; 
			if (link.parentNode.parentNode.id != "menu"){
				applyHereClass(link.parentNode.parentNode.firstChild);
			}
		};
		
		findHere();
		
	},
	'#menu li' : function(el){
		el.onmouseover = function(){
			$A(this.parentNode.childNodes).each(
					function(n){ if (n.tagName == 'LI') n.className = n.className.replace(/\bover\b/gi,""); }
				);
				this.className = this.className.className ? " over" : "over";
		};
		el.onmouseout = function(){
			this.className = this.className.replace(/\bover\b/gi,"");
			Behaviour.apply();
		};
	},
	'#menu li.active' : function(el){
			el.className += " over";
	},
	
	// open external links in a new window
	'A' : function(el){
		if (!el.target && (el.href.indexOf(window.location.hostname) == -1 || el.href.indexOf('.pdf') != -1)){
			el.target = "_blank";
		}
	},
	
	// and do the same with image maps
	'AREA' : function(el){
		if (!el.target && el.href.indexOf(window.location.hostname) == -1 || el.href.indexOf('.pdf') != -1){
			el.target = "_blank";
		}
	}
	
});

/** prevent flicker on menu images **/

try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
	

