// JavaScript Document

/*
(c) Solberg Kommunikation -2003, http://www.solberg.se
Code and Web-design by Alexander Höglind
*/
String.prototype.trim = function() {
return this.replace(/^\s*(\b.*\b|)\s*$/, "$1");
}

//**************CHECK BROWSER AND  FRAMESET -START*******************

if(sType=="main" || sType=="fact" || sType=="content" || sType=="menu" || sType=="top"){
if(!top.isTop){
//top.location =  localPath + "index.html";
}
}

function tellAboutBrowser(sBr){
	var lang="sv";
	sLocation = location.href;
	if(sLocation.indexOf("/sv/")==-1) lang="eng";
	if ( !confirm((lang=="sv")?"Denna sida kanske inte funkar i din browser vill du testa ändå?":"This page might not work in your browser do you want to try anyway?") )
		document.location = localPath + "browser_" + sBr + "_" + lang + ".html";
}


if(sType=="index"){
	if(is_ie){
		if(!is_ie5up){
			tellAboutBrowser("ie");
		}
	}else if(is_nav){
		if(!is_nav6up){
			tellAboutBrowser("ns");
		}else{
			if(is_mac && is_nav6 && !is_nav7up){
				tellAboutBrowser("ns");
			}
		}
	}
}



//**************CHECK BROWSER AND  FRAMESET -END*******************



//**************GLOBAL FUNCTIONS -START *********************
function generateLayer(aId, aPosition, aVisibility, aPosLeft, aPosTop, aWidth, aHeight, aBackgroundColor){
lyr = document.createElement("DIV");
if(aId!=null) 				lyr.id 						=	aId;
if(aPosition!=null)			lyr.style.position 			= 	aPosition;
if(aVisibility!=null) 		lyr.style.visibility 		= 	aVisibility;
if(aPosLeft!=null)			lyr.style.left 				= 	aPosLeft + "px";
if(aPosTop!=null)			lyr.style.top 				= 	aPosTop + "px";
if(aWidth!=null) 			lyr.style.width 			= 	aWidth + "px";
if(aHeight!=null) 			lyr.style.height 			= 	aHeight + "px";
if(aBackgroundColor!=null) 	lyr.style.backgroundColor 	= 	aBackgroundColor;
lyr.style.zIndex = 10;
return lyr
}

function generateImg(aId, aSrc, aWidth, aHeight){
img = document.createElement("IMG");
if(aId)					img.id 		= aId;
if(aSrc)				img.src 	= aSrc;
if(aWidth)				img.width 	= aWidth;
if(aHeight)				img.height 	= aHeight;
return img;
}

function writeLayerStart(sId, sPos, sVis, iLeft, iTop, iWidth, iHeight, sBgColor, iZIndex, aAct, sClass){
var sActions = "";
if( aAct && aAct.length>0 ){
for( var i=0;i<aAct.length;i++ ){
sActions += aAct[i] + "=" + aAct[++i] + " ";
}
}
if ( sClass != "" ) {sClass = "class=\""+sClass+"\"";}
document.write("<DIV id=\""+sId+"\" " + sClass + " "+sActions+" style=\"position:" +sPos+";visibility:"+sVis+ ";left:"+iLeft+"px;top:"+iTop+"px;width:"+iWidth+"px;height:"+iHeight+"px;z-index:"+((iZIndex==null)?10:iZIndex)+";"+((sBgColor==null)?'':'background-color:'+sBgColor)+";\">");
}

function writeLayerEnd(){
document.writeln("</DIV>");
}

function writeSpanStart(){
document.write("<SPAN>");
}

function writeImg(sId, sSrc,iWidth,iHeight){
document.write("<IMG id=\""+sId+"\" src=\""+sSrc+"\" width=\""+iWidth+"\" height=\""+iHeight+"\" border=\"0\">");
}

function writeSpanEnd(){
document.write("</SPAN>");
}

function writeString(sStr){
document.write(sStr);
}

function getEl(sEl){
return document.getElementById(sEl);
}

//************* OPEN BROWSER SCRIPT -START *******************************

function getAbsolutPath(){
	var aUrl	= 	new String(document.location.href);
	var iPos	=	aUrl.indexOf("?");
	if(iPos!=-1)	aUrl	=	aUrl.substring(0, iPos);
	iPos		=	aUrl.indexOf("#");
	if(iPos!=-1)	aUrl	=	aUrl.substring(0,iPos);
	
	var sAbsPath	= 	aUrl.substring(0, aUrl.lastIndexOf("/"));
	//Fix för kvartalsrapporterna som int eär uppdelade i två böcker
	sAbsPath	= 	sAbsPath.substring(0, sAbsPath.lastIndexOf("/"));
	
	var myRels = localPath.split("/");
	
	for(var r=0;r<myRels.length;r++){
		if(myRels[r] == "..")	sAbsPath =	sAbsPath.substring(0,sAbsPath.lastIndexOf("/"));
	}
	return sAbsPath + "/";

}

function getAbsoluteURL(relPath, basePath) {
	var abspath;

	if (basePath == "") {
		basePath = location.href;
		var iPos = basePath.indexOf("?");
		if(iPos!=-1) basePath = basePath.slice(0,iPos);
		basePath = basePath.slice(basePath.indexOf("://")+3, basePath.lastIndexOf("/"));
		basePath = basePath.slice(basePath.indexOf("/"));
	}
	
	if (relPath == "" || relPath == ".") return basePath;
	
	relPath = relPath + "/";
	while( relPath.slice(0,3) == "../" ) {
		if (basePath != "")
			basePath = basePath.slice(0, basePath.lastIndexOf("/"));
		relPath = relPath.slice(3);
	}
	abspath = basePath + "/" + relPath.slice(0, relPath.length-1);
	if ( abspath.slice(abspath.length-1) == "/" ) abspath = abspath.slice(0, abspath.length-1);

	return abspath;
}


function openBrWindow(theURL,theName,props) { //v1.2
	var theDoc 	= 	"" +	document.location;
	var iPos	=	theDoc.indexOf("?");
	if(iPos!=-1)	theDoc = theDoc.substring(0,iPos);
	_link 	= 	theURL;
	
	if ( theURL.indexOf( "http://" ) == -1 ){
		//theURL = getAbsolutPath() + "popup.html?" + theDoc.substring(0,theDoc.lastIndexOf("/")+1) + theURL;
		theURL = getAbsolutPath() + "popup.html?" + getAbsoluteURL(theURL, "");
	} else if ( theURL.indexOf( "http://" ) != 0 ) {
		theURL = getAbsoluteURL(theURL, "");
	}
	
	if(sType=="popup"){
		if(top.isPopupTop){
			theName = theName.replace(/\//g,"").replace(/\:/g,"").replace(/\,/g,"").replace(/\_/g,"").replace(/\=/g,"").replace(/\?/g,"").replace(/\;/g,"").replace(/\&/g,"").replace(/\#/g,"").replace(/\-/g,"").replace(/\./g,"");
			top.openBrWindow(theURL, theName, props);
		}
		return;
	}
	if( theName == "popup" )	{ //xms fix!
		if(_link.indexOf("youareleaving")!= -1 && _link.indexOf("?") != -1){
			_link = _link.substring(0,_link.indexOf("?"));
		}
		_fileName 	= 	_link.substring(_link.lastIndexOf("/")+1,_link.length);
		
		props 		= 	"width=" + _fileName.slice(0, _fileName.indexOf("x")) + ",height=" + _fileName.slice(_fileName.indexOf("x") + 1, _fileName.indexOf("_"))  + ((_fileName.slice(_fileName.indexOf("_") + 1, _fileName.indexOf("_") + 3) == "s_") ? ",scrollbars=yes" : "")  +  ((_fileName.slice(_fileName.indexOf("_") + 1, _fileName.indexOf("_") + 3) == "t_") ? ",menubar=yes" :  ((_fileName.slice(_fileName.indexOf("_") + 1, _fileName.indexOf("_") + 3) == "s_"))? ((_fileName.slice(_fileName.indexOf("_") + 3, _fileName.indexOf("_") + 5) == "t_") ? ",menubar=yes" : ""):""   );
		
		theName 	= 	document.URL.replace(/\//g,"").replace(/\:/g,"").replace(/\,/g,"").replace(/\_/g,"").replace(/\=/g,"").replace(/\?/g,"").replace(/\;/g,"").replace(/\&/g,"").replace(/\#/g,"").replace(/\-/g,"").replace(/\./g,"") + _link.substring(0,_link.indexOf(".html")).replace(/\//g,"").replace(/\:/g,"").replace(/\,/g,"").replace(/\_/g,"").replace(/\=/g,"").replace(/\?/g,"").replace(/\;/g,"").replace(/\&/g,"").replace(/\#/g,"").replace(/\-/g,"").replace(/\./g,"");
		props 		+= 	",status=yes";
	}
	if ( top.isTop) 				top.openBrWindow(theURL,theName,props);
	else if( window.opener )		window.opener.openBrWindow(theURL,theName,props);
	else	tempWindow = window.open(theURL,theName,props);
}

function printDoc(){
window.focus();
window.print();
}

function setStatus(sStr){
top.status = sStr;
}
//************* OPEN BROWSER SCRIPT -END **********************************

//**************GLOBAL FUNCTIONS -END *********************


function keepTheeseFileTypes(theArray,fileTypesArray){
var retArray = new Array();
for(i=0;i<theArray.length;i++){
fileType = theArray[i][0].toLowerCase();
fileType = fileType.substring(fileType.lastIndexOf(".")+1,fileType.length);
for(x=0;x<fileTypesArray.length;x++){
if(fileType == fileTypesArray[x]){
retArray[retArray.length] = theArray[i];
break;
}
}
}
return retArray;
}

var iButtonsPosX	=	0;
var iButtonsPosY	=	0;
var iDropWidth 		=  	207;
var iDropPosX		=	397;
var iDropLength		=	0;


function generateDrops(drops){
if ( (drops[0].length == 0) && (drops[1].length == 0) && (drops[2].length == 0) ) return;
	var dropPropsEng = new Array(
		new Array(566,29,69,15,0,"Facts"),
		new Array(514,29,69,15,1,"Graphs"),
		new Array(458,29,69,15,2,"Tables")
	);//graphs,tables,facts;; //posleft,posTop,width,height,type,name

	var dropPropsSv = new Array(
		new Array(566,29,69,15,0,"Facts"),
		new Array(514,29,69,15,1,"Graphs"),
		new Array(458,29,69,15,2,"Tables")
	);

	var dropProps = dropPropsEng;
	if(lang=="sv") dropProps = dropPropsSv;
	
	iButtonsPosY = dropProps[0][1];
	//"<IMG src=\"" + relPath + "images/transparent.gif\" width=50 height=\""+dropProps[d][3]+" border=0>" +
	var drop;
	var lnk;
	var img;
	var FACTS	= 0;
	var GRAPHS 	= 1;
	var TABLES 	= 2;
	var posX;
	var last=0;
	var whitepix = 20;

	for(var p=0;p<drops.length; p++){
		if(drops[p].length>0) last = p;
	}

	for( var d=0; d<drops.length ; d++ ) {
		//generate the button layers
	
		if(drops[d].length > 0){
			iDropLength++;
			if(!posX){
				posX = (iDropPosX + iDropWidth) - dropProps[d][2];
			}else{
				posX 			= posX - dropProps[d][2];
			}
			//if(last==d) 	posX -= whitepix;
			writeLayerStart		( 	"LButtonDrop" + (iDropLength-1), "absolute", "visible", posX, dropProps[d][1], dropProps[d][2], dropProps[d][3] );
			writeString			(	"<A id=\"AButtonDrop"+(iDropLength-1)+"\"  href=\"#\" selected=false pos=" + (iDropLength-1) + " type=\"button\" onMouseOver=\"showDrop();setStatus('"+dropProps[d][5].replace(/\'/g,"\\\'").replace(/\"/g,"\\\'")+"');\" onMouseOut=\"hideDrop();top.status=''\">");
			//if(last==d)			writeImg	(	("dropextra"), (relPath + "images/whitepixel.gif"), whitepix ,dropProps[d][3]);
			writeString			("<IMG src=\"" + relPath + "images/drop_a_"+dropProps[d][5].toLowerCase() + "_"+ lang+".gif\" width=\""+dropProps[d][2]+"\" height=\""+dropProps[d][3]+"\" border=\"0\">"+
				"</A>");
			writeLayerEnd();
			getEl(	"LButtonDrop" + (iDropLength-1)).firstChild.selected = false;
			//generate the drop content layers
			writeLayerStart( "LDrop" + (iDropLength-1), "absolute", "hidden", iDropPosX , 43, iDropWidth, 100, "#D8E2E7", 21, new Array("onmouseout",  "hideDrop()"));
			var topLineString = "<table cellpadding=0 cellspacing=0 border=0 width="+(iDropWidth-2)+"><tr>";
			switch (d) {
				case 0 :
					topLineString += "<td height=\"1\" width=139 bgcolor=\"#39515A\"></td><td height=\"1\" width=66></td>";
				break;
				case 1 :
					topLineString += "<td height=\"1\" width=70 bgcolor=\"#39515A\"></td><td height=\"1\" width=65></td><td height=\"1\" width=70 bgcolor=\"#39515A\"></td>";
				break;
				case 2 :
					topLineString += "<td width=66 height=\"1\"></td><td height=\"1\" width=139 bgcolor=\"#39515A\"></td>";
				break;
			}
			topLineString += "</tr></table>";
			var bottomLineString = "<table cellpadding=0 cellspacing=0 border=0 width="+iDropWidth+"><tr>";
			bottomLineString += "<td height=\"1\" bgcolor=\"#39515A\"></td>";
			bottomLineString += "</tr></table>";
			var leftLineString = "<table height=\"100\" cellpadding=0 cellspacing=0 border=0 width="+iDropWidth+"><tr><td width=\"1\" bgcolor=\"#39515A\"></td><td valign=top>";
			var rightLineString = "</td><td width=\"1\" bgcolor=\"#39515A\"></td></tr></table>";
			
			var tableString	= leftLineString + topLineString + "<TABLE id=\"LDropTable"+d+"\" border=0 cellpadding=0 cellspacing=0 width="+(iDropWidth-2)+" bgcolor=\"#D8E2E7\">\n\n<TR><TD class=\"smallFont\" height=10 width=14>&nbsp;</TD><TD class=\"smallFont\" height=10 width=181>&nbsp;</TD><TD class=\"smallFont\" height=10 width=14>&nbsp;</TD></TR>\n";
			
			var drop 		= drops[d];
			for( var x=0; x<drop.length; x++) {
				tableString	+=	"<TR><TD class=\"smallFont\" width=\"14\" height=6>&nbsp;</TD><TD width=183>";
				var _loc 	=	document.location.href;
				_loc		=	_loc.substring(0,_loc.lastIndexOf("/"));
				_link 		= 	drop[x][0];
				_fileName 	= 	_link.substring(_link.lastIndexOf("/")+1,_link.length);
				_name 		= 	drop[x][1];
				
				// if d is FACTS then we should not open the link in a new browser
				if( d==FACTS ) {
					//tableString		+= 	"<A  class=\"subMenu\" HREF=\"" + _link + "\"  onMouseOver=\"top.status='" + _name.replace(/\'/g,"\\\'") +"\'; return true\" onMouseOut=\"top.status=''; return true\">"+ _name + "</A><BR>";
					tableString 	+= 	"<A HREF=\"" + _link + "?facturl=" + document.location.href + "\"  onMouseOver=\"top.status='" + _name.replace(/\'/g,"\\\'") +"\'; return false\" onMouseOut=\"top.status=''; return false\" class=\"subMenu\">"+ _name + "</A><BR>";
				}else{
					//if(d==GRAPHS){
					//_opt			=	"width=480,height=350,menubar=1,status=1,resizable=1";
					//}else{
					_opt 			= 	new String( "width=" + _fileName.slice(0, _fileName.indexOf("x")) + ",height=" + _fileName.slice(_fileName.indexOf("x") + 1, _fileName.indexOf("_"))  + ((_fileName.slice(_fileName.indexOf("_") + 1, _fileName.indexOf("_") + 3) == "s_") ? ",scrollbars=1" : "") +  ((_fileName.slice(_fileName.indexOf("_") + 1, _fileName.indexOf("_") + 3) == "t_") ? ",menubar=1" :  ((_fileName.slice(_fileName.indexOf("_") + 1, _fileName.indexOf("_") + 3) == "s_"))? ((_fileName.slice(_fileName.indexOf("_") + 3, _fileName.indexOf("_") + 5) == "t_") ? ",menubar=1" : ",menubar=1"):",menubar=1"   ) + ",status=1");
					//}
					//name of the new browser window
					_alt_name 		= 	document.URL.replace(/\//g,"").replace(/\:/g,"").replace(/\,/g,"").replace(/\_/g,"").replace(/\?/g,"").replace(/\;/g,"").replace(/\&/g,"").replace(/\#/g,"").replace(/\-/g,"").replace(/\./g,"") + drop[x][0].substring(0,drop[x][0].indexOf(".html")).replace(/\//g,"").replace(/\:/g,"").replace(/\,/g,"").replace(/\_/g,"").replace(/\=/g,"").replace(/\?/g,"").replace(/\;/g,"").replace(/\&/g,"").replace(/\#/g,"").replace(/\-/g,"").replace(/\./g,"");
					tableString 	+= 	"<A HREF=\"JavaScript:openBrWindow('" + getAbsolutPath() +"popup.html?" + _loc + "/" + _link +"','" + _alt_name +"','" + _opt +"')\"  onMouseOver=\"setStatus('" + _name.replace(/\'/g,"\\\'").replace(/\"/g,"\\\'") +"\'); return false;\" onMouseOut=\"top.status=''; return false\" class=\"subMenu\">"+ _name + "</A><BR>";
				}
				tableString 		+=	"\n</TD><TD class=\"smallFont\" width=\"14\" height=6>&nbsp;</TD></TR>\n<TR><TD class=\"smallFont\" width=14 height=6>&nbsp;</TD><TD class=\"smallFont\" width=181 height=6>&nbsp;</TD><TD class=\"smallFont\" height=6>&nbsp;</TD></TR>\n";
			}
	
			tableString 				+=	"\n<TR><TD class=\"smallFont\" height=6>&nbsp;</TD><TD class=\"smallFont\" height=6>&nbsp;</TD><TD class=\"smallFont\" height=6>&nbsp;</TD></TR>\n</TABLE>\n";
			writeString(tableString+rightLineString+bottomLineString);
			writeLayerEnd();
			lyr							= getEl("LDrop" + (iDropLength-1));
			var lyrHeight				= getEl("LDropTable"+d).offsetHeight;
			if(lyrHeight > 100){
				lyr.style.height		=	lyrHeight;
			}else{
				var eImageHeader 		=	getEl("LImageHeader");
				if(!eImageHeader){
					var eChild = getFirstChildEl(lyr);
					eChild = getFirstChildEl(eChild);
					lyr.style.height	=	eChild.offsetHeight;
				}
			}
			lyr.type					=	"drop";
			lyr.pos						=	(iDropLength-1);
			if(is_nav6up){
				lyr.type		=	"drop";
				lyr.pos			=	(iDropLength-1);
				lyr.setAttribute("type","drop");
				lyr.setAttribute("pos",(iDropLength-1));
			}
		} else {
			iDropLength++;
			if(!posX){
				posX = (iDropPosX + iDropWidth) - dropProps[d][2];
			}else{
				posX 			= posX - dropProps[d][2];
			}
			//if(last==d) 	posX -= whitepix;
			
			writeLayerStart		( 	"LButtonDrop" + (iDropLength-1), "absolute", "visible", posX, dropProps[d][1], dropProps[d][2], dropProps[d][3] );
			writeString			("<IMG src=\"" + relPath + "images/drop_i_"+dropProps[d][5].toLowerCase() + "_"+ lang+".gif\" width=\""+dropProps[d][2]+"\" height=\""+dropProps[d][3]+"\" border=\"0\">");
			writeLayerEnd();
		}
	}
}

function getFirstChildEl(aNode){
var aChild = null;
for(var c=0;c<aNode.childNodes.length;c++){
aChild = aNode.childNodes[c];
if(aChild.nodeType==1) break;
}
return aChild;
}

var sSelDrop = null;
var sSelButton = null;

function showDrop(){
eEl 	=	event.srcElement;
/*
var eElCheck = eEl;
while(eElCheck.firstChild){
eElCheck = eElCheck.firstChild;
}
if(eElCheck.id == "dropextra"){
return;
}
*/
if(typeof eEl.type != "string") {
eEl		= 	eEl.parentNode;
}
pos 	= 	parseInt(eEl.getAttribute("pos"));
for	( var e=0; e<iDropLength; e++ ) 	{
if	( pos==e)			{
eEl.selected 					= 	true;
eButtLyr 						= 	eEl.parentNode;
eButtLyr.style.backgroundColor 	= 	"#D8E2E7";
eLinkLyr						= 	document.getElementById("LDrop" + pos);
eLinkLyr.style.visibility		=	"visible";
eLinkLyr.selected				=	true;
} 	else 					{
eButt							= 	document.getElementById("AButtonDrop" + e);
if (!eButt) continue;
eButt.selected					=	false;eButtLyr						=	eButt.parentNode;
eButtLyr.style.backgroundColor	=	"#FFFFFF";

eLinkLyr						= 	document.getElementById("LDrop" + e);
eLinkLyr.style.visibility		=	"hidden";
}
}
}


function hideDrop(){
var mousePosX 	= 	((is_nav6)?(event.pageX):(event.clientX + document.body.scrollLeft));
var mousePosY 	= 	((is_nav6)?(event.pageY):(event.clientY + document.body.scrollTop));
var buttons_left= 	document.getElementById("LButtonDrop"+(iDropLength-1)).offsetLeft
menu_left 		= 	iDropPosX + 2;
menu_right 		= 	iDropPosX + iDropWidth - 2;
menu_top 		= 	-5 + iButtonsPosY + 2;

eEl 			=	event.srcElement;
if(typeof eEl.type != "string") {
if(eEl.tagName == "IMG"){
eEl								=	eEl.parentNode;
}else{
while(eEl.tagName!="DIV") {
eEl							= 	eEl.parentNode;
}
}
}else{
//return;
}

type 			= 	eEl.getAttribute("type");
pos 			=	parseInt(eEl.getAttribute("pos"));
eLinkLyr		= 	document.getElementById("LDrop" + pos);
//eDropActLyr		=	document.getElementById("LDropAction" + pos);

if(!eLinkLyr){
return;
}

menu_bottom		= 	eLinkLyr.offsetHeight + eLinkLyr.offsetTop + ((is_ie5up && is_mac)?10:0);

var hide = false;
if	(type == "button")	{
if(mousePosY <= 31 || mousePosY >= menu_bottom || mousePosX < buttons_left || mousePosX >= menu_right){
hide = true;
}else if(mousePosY <= 41)	{
eEl.selected					=	false;
eButtLyr 						= 	eEl.parentNode;
eButtLyr.style.backgroundColor 	= 	"#FFFFFF";
}
}else if(type == "drop")	{
if(mousePosY >= menu_bottom || mousePosX <= menu_left || mousePosX >= menu_right || (mousePosY <= 43 && mousePosX < buttons_left)){
hide = true;
}
}
if(hide){
for(var b=0;b<iDropLength;b++){
eButt 							= document.getElementById("AButtonDrop" + b);
if (!eButt) continue;
eButtLyr						= eButt.parentNode;
eButt.selected 					= false;
eButtLyr.style.backgroundColor	=	"#FFFFFF";
}
eLinkLyr.style.visibility		=	"hidden";
}


}



function getRelPath(aPath){//ie ar00/images
var count 	= aPath.split("/").length-1;
var retStr 	= "";
for(var i=0;i<count;i++){
retStr 	+= "../";
}
return retStr;
}
function getLocalPath(aPath){ //ie ar00/eng/images or ar00/sv/images
var count 	= aPath.split("/").length-2;
var retStr 	= "";
for(var i=0;i<count;i++){
retStr += "../";
}
return retStr;
}

//************* LAYER GENERATION PROPERTIES AND FUNCTIONS -START ********************
var lAll 		= new Array();
function addLayer(eEl)	{
	if(ISPUBL) eEl.parentNode.style.position = "absolute";
	
	var eBeforeEl = null;
	(lAll.length > 0)?		eBeforeEl = lAll[lAll.length-1]		:	eBeforeEl =	null;
	lAll[lAll.length] 	= 	eEl;
	if(eEl.type!="Coords" && eEl.type!="ImageHeader"){
		eEl.id 				= 	eEl.id + lAll.length;
	}

	if(lHeading!=null)	{
		if(ISPUBL) lHeading.parentNode.style.position = "absolute";
		if(eEl.type == "ImageHeader"){
			showLayer 	(eEl, eBeforeEl);
			showLayer 	(lHeading, eEl);
			lAll[lAll.length] = document.getElementById(lHeading.id);
		}else{
			showLayer 				(lHeading, null);
			lAll[lAll.length-1] = 	lHeading;
			lAll[lAll.length] 	= 	eEl;
			showLayer				(eEl, lHeading);
		}
		lHeading 	= null;
	}else{
		showLayer (eEl, eBeforeEl);
	}
	//return eEl.parentNode.id;
}
var lHeading = null;
function addHeading(eEl)	{
lHeading = eEl;
}
function confirmPos(){
if(lHeading!=null){
if(ISPUBL) lHeading.parentNode.style.position = "absolute";
showLayer(lHeading,null);
}
}
function showLayer(eEl, eBeforeEl)	{
	if(eBeforeEl!=null)	{
		var iTop 												= eBeforeEl.parentNode.offsetTop;
		var iLeft 												= eBeforeEl.parentNode.offsetLeft;
		var eChild												= eBeforeEl.childNodes[0];
		
		for(var c=0;c<eBeforeEl.childNodes.length;c++){
			eChild = eBeforeEl.childNodes[c];
			if(eChild.nodeType==1) break;
		}
		
		var iHeight 											= eChild.offsetHeight;
		var tAttr 												= eBeforeEl.attributes["space"];
		var 									iTopOffs 		= 20;
		if (tAttr) 								iTopOffs		= parseInt(tAttr.nodeValue);
		else if (eBeforeEl.space)				iTopOffs 		= parseInt(eBeforeEl.space);
		//if(eEl.id != "SHeading"){
		eEl.parentNode.style.left	= 	eEl.parentNode.offsetLeft + iXOffs + ((is_ie5up && is_mac)?10:0);
		//}
		eEl.parentNode.style.top 								= iTop + iHeight + iTopOffs + ((is_ie5up && is_mac)?15:0);
	}else{
		eEl.parentNode.style.left	= 	eEl.parentNode.offsetLeft + iXOffs + ((is_ie5up && is_mac)?10:0);
	}
	setTimeout("document.getElementById(\"" + new String(eEl.id) + "\").parentNode.style.visibility = \"visible\"",200);
	//eEl.parentNode.style.visibility = "visible";
}
//************* LAYER GENERATION PROPERTIES AND FUNCTIONS -END ********************


//************ FACT FUNCTIONS -START ***************************

function getFactCoordsEditID(sName){
var eSp 	= document.getElementById(sName);
var sSp 	= eSp.innerHTML.toLowerCase();
var iPos 	= sSp.lastIndexOf("contenteditable");
var iPos 	= sSp.substring(0,iPos).lastIndexOf(">");
sSp 		= sSp.substring(iPos,sSp.length);
sSp 		= sSp.substring(sSp.indexOf("id=")+3,sSp.length);
var cChar 	= '';
var iCounter = 0;
while(cChar == '\"' || cChar == '\'' || cChar == ' ' || cChar == '>'){
cChar = sSp.charAt(iCounter++);
}
sSp 		= sSp.substring(iCounter,sSp.length);
cChar 		= '';
iCounter 	= 0;
while(cChar != '\"' && cChar !='\'' && cChar != ' ' && cChar != '>'){
cChar = sSp.charAt(iCounter++);
}
var eSpInner = sSp.substring(0,iCounter);
return eSpInner.toUpperCase().trim();
}
//************ FACT FUNCTIONS -END ***************************


//************ NOTES GENERATION -START ***********************
function generateLinks(aList,aDir){

if(aList.length>0){

var sLoc = document.location.href;

var isDirectors = false;
var dirEng 		= new Array("Board members elected by Annual General Meeting", "Board members designated by employee organisations", "Deputy members of the Board", "Secretary of the Board", "Auditors", "Deputy Auditors");
var dirSv 		= new Array("Styrelseledamöter valda av bolagsstämman", "Styrelseledamöter utsedda av arbetstagarorganistationer", "Styrelsesruppleanter", "Styrelsens sekreterare", "Revisorer", "Revisorsuppleanter");
if(aDir == "directors"){
isDirectors = true;
var dirStrings = dirEng;
if(lang=="sv") dirStrings = dirSv;
}

writeLayerStart("LText", null, "hidden", 69, 76, 493, null, null, 2, null, "brodText");
writeString("<SPAN id=\"SText\" space=\"14\" type=\"Text\">");
writeString("<TABLE border=0 cellpadding=0 cellspacing=0><TR><TD class=\"brodText\">");

var sNumber = "";
for(var n=0;n<aList.length;n++){

if(isDirectors){
if(n<13){
//sNumber = new String((n+1) + ". ");
sNumber = "";
}else{
sNumber = "";
}
switch(n){
case 0:
writeString("<BR>" + dirStrings[0] + "<BR>");
break;
case 10:
writeString("<BR>" + dirStrings[1] + "<BR>");
break;
case 13:
//writeString("<BR>" + dirStrings[2] + "<BR>");
break;
case 15:
writeString("<BR>" + dirStrings[3] + "<BR>");
break;
case 16:
writeString("<BR>" + dirStrings[4] + "<BR>");
break;
case 18:
writeString("<BR>" + dirStrings[5] + "<BR>");
break;
}
}

var _loc 	=	document.location.href;
_loc		=	_loc.substring(0,_loc.lastIndexOf("/"));
_link 		= 	aList[n][0];
_fileName 	= 	_link.substring(_link.lastIndexOf("/")+1,_link.length);
_name 		= 	aList[n][1];
_alt_name 	= 	document.URL.replace(/\//g,"").replace(/\:/g,"").replace(/\,/g,"").replace(/\_/g,"").replace(/\?/g,"").replace(/\;/g,"").replace(/\&/g,"").replace(/\#/g,"").replace(/\-/g,"").replace(/\./g,"") + aList[n][0].substring(0,aList[n][0].indexOf(".html")).replace(/\//g,"").replace(/\:/g,"").replace(/\,/g,"").replace(/\_/g,"").replace(/\=/g,"").replace(/\?/g,"").replace(/\;/g,"").replace(/\&/g,"").replace(/\#/g,"").replace(/\-/g,"").replace(/\./g,"");
_opt 		= 	new String( "width=" + _fileName.slice(0, _fileName.indexOf("x")) + ",height=" + _fileName.slice(_fileName.indexOf("x") + 1, _fileName.indexOf("_"))  + ((_fileName.slice(_fileName.indexOf("_") + 1, _fileName.indexOf("_") + 3) == "s_") ? ",scrollbars=1" : "") +  ((_fileName.slice(_fileName.indexOf("_") + 1, _fileName.indexOf("_") + 3) == "t_") ? ",menubar=1" :  ((_fileName.slice(_fileName.indexOf("_") + 1, _fileName.indexOf("_") + 3) == "s_"))? ((_fileName.slice(_fileName.indexOf("_") + 3, _fileName.indexOf("_") + 5) == "t_") ? ",menubar=1" : ",menubar=1"):",menubar=1"   ) + ",status=1");
writeString("<A HREF=\"JavaScript:openBrWindow('" + getAbsolutPath() +"popup.html?" + _loc + "/" + _link +"','" + _alt_name +"','" + _opt +"')\"  onMouseOver=\"setStatus('" + _name.replace(/\'/g,"\\\'").replace(/\"/g,"\\\'") +"\'); return false;\" onMouseOut=\"top.status=''; return false\">"+ sNumber +  _name + "</A><BR>");
}

if(isDirectors){
writeString("<BR>" + dirStrings[4] + "<BR>");
writeString("PricewaterhouseCoopers AB<BR>");
}

writeString("</TD></TR></TABLE>");
writeString("</SPAN>");
writeLayerEnd();
writeString("<SCRIPT>addLayer(document.getElementById(\"SText\"));</SCRIPT>");
}
}


function generateNotes(aNotes){
var sLoc = document.location.href;
if((sLoc.indexOf("notes")!=-1 && lang=="eng") || (sLoc.indexOf("noter")!=-1 && lang=="sv")){
if(aNotes.length>0){
writeLayerStart("LText", null, "hidden", 69, 76, 493, null, null, 2, null, "brodText");
writeString("<SPAN id=\"SText\" space=\"14\" type=\"Text\">");
writeString("<TABLE border=0 cellpadding=0 cellspacing=0><TR><TD class=\"brodText\">");
for(var n=0;n<aNotes.length;n++){
var _loc 	=	document.location.href;
_loc		=	_loc.substring(0,_loc.lastIndexOf("/"));
_link 		= 	aNotes[n][0];
_fileName 	= 	_link.substring(_link.lastIndexOf("/")+1,_link.length);
_name 		= 	aNotes[n][1];
_alt_name 	= 	document.URL.replace(/\//g,"").replace(/\:/g,"").replace(/\,/g,"").replace(/\_/g,"").replace(/\?/g,"").replace(/\;/g,"").replace(/\&/g,"").replace(/\#/g,"").replace(/\-/g,"").replace(/\./g,"") + aNotes[n][0].substring(0,aNotes[n][0].indexOf(".html")).replace(/\//g,"");
_opt 		= 	new String( "width=" + _fileName.slice(0, _fileName.indexOf("x")) + ",height=" + _fileName.slice(_fileName.indexOf("x") + 1, _fileName.indexOf("_"))  + ((_fileName.slice(_fileName.indexOf("_") + 1, _fileName.indexOf("_") + 3) == "s_") ? ",scrollbars=1" : "") +  ((_fileName.slice(_fileName.indexOf("_") + 1, _fileName.indexOf("_") + 3) == "t_") ? ",menubar=1" :  ((_fileName.slice(_fileName.indexOf("_") + 1, _fileName.indexOf("_") + 3) == "s_"))? ((_fileName.slice(_fileName.indexOf("_") + 3, _fileName.indexOf("_") + 5) == "t_") ? ",menubar=1" : ",menubar=1"):",menubar=1"   ) + ",status=1");
writeString("<A HREF=\"JavaScript:openBrWindow('" + getAbsolutPath() +"popup.html?" + _loc + "/" + _link +"','" + _alt_name +"','" + _opt +"')\"  onMouseOver=\"setStatus('" + _name.replace(/\'/g,"\\\'").replace(/\"/g,"\\\'") +"\'); return false;\" onMouseOut=\"top.status=''; return false\">"+ _name + "</A><BR>");
}
writeString("</TD></TR></TABLE>");
writeString("</SPAN>");
writeLayerEnd();
writeString("<SCRIPT>addLayer(document.getElementById(\"SText\"));</SCRIPT>");
}
}
}

//************ NOTES GENERATION -END *************************

//************ FACT MOVE Print -START************************

function movePrint(){
var ePrint = document.getElementById("LPrint")
if(ePrint.style.position != "absolute") ePrint.style.position = "absolute";
if(ePrint.style.visibility != "visible") ePrint.style.visibility = "visible";
var iDocumentWidth 		=  	(window.innerWidth)?window.innerWidth:document.body.offsetWidth;
if(iDocumentWidth < 149) return;
ePrint.style.left 		=	(iDocumentWidth-61) + "px";
}


//************ FACT MOVE LINES -END************************






