// Mac IE Float fix
// <!--
function fixmacie(classname){  
	/* I'm assuming the containers are div */  
	var divs=document.getElementsByTagName("DIV"); 

	/* Loop through all the div's */  
	for(var d=0; d < divs.length;d++){ 
		/* Compare class names and insert clearing div*/ 
		(divs[d].className==classname)?divs[d].innerHTML+= "<div class='cb'> </div>":""; 
	} 
} 

function init(){ 
	/* Check if the browser is IE5 Mac */  
	if( navigator.appVersion.indexOf('Mac')!=-1 && document.all){ 
		/* Pass the class name of the container to fixmacie */  
		fixmacie("floatcontainer"); 
	} 
}
// !-->
// End of Mac IE Float fix

// ----------------------------------------------------------------

// 'external' to '_blank' target fix
// <!--
function externalLinks() {
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") &&
        anchor.getAttribute("rel") == "external")
      anchor.target = "_blank";
    }
}
// -->
// End of 'external' to '_blank' target fix

// ----------------------------------------------------------------

// IE Background png fix
// <!--
function alphaBackgrounds(){
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
	for (i=0; i<document.all.length; i++){
		var bg = document.all[i].currentStyle.backgroundImage;
		if (itsAllGood && bg){
			if (bg.match(/\.png/i) != null){
				var mypng = bg.substring(5,bg.length-2);
				document.all[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mypng+"', sizingMethod='image')";
				document.all[i].style.backgroundImage = "url(/images/interface/blank.gif)";
			}
		}
	}
}
// -->
// End of IE Background png fix

// ----------------------------------------------------------------


// Nemea menu
function checkState(path,link){  
	var listItem = document.getElementsByTagName("A");

	/* Loop through all the li's */  
	for(var li=0; li < listItem.length;li++){ 
		/* Compare class names and insert clearing div*/ 
		var thisA = listItem[li];

		if(path == thisA.href || link == thisA.href){
			// Dont change style for left-column research module or press-centre module
			if(thisA.href.indexOf('/knowledge/research-papers') == -1 || (thisA.href.indexOf('/knowledge/research-papers') >= 0 && thisA.id != 'research-a')){
				if(thisA.href.indexOf('/press-centre') == -1 || (thisA.href.indexOf('/press-centre') >= 0 && thisA.id != 'press-a' && thisA.id != 'press-a2')){

					thisA.style.display = 'block';
					thisA.style.background = '#fff url(/images/interface/nav_on.gif) no-repeat 0 0.2em';
					thisA.style.fontWeight = 'bold';
					
					thisA.style.marginLeft = '-15px';
					thisA.style.paddingLeft = '15px';
				}
			}
		}
	} 
}


// Fire all events onload
function multipleOnload(){
	init();
	externalLinks();
	// Fix for pc ie transparent bg's
	if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
		alphaBackgrounds();
	}
}