﻿// Menyobjekt1


var	intTabOrder = 1;

function Menu(strName, strTitle, subMenuStartIndex, strLayout, firstLevelX, firstLevelY, useShadow, isTransparent, intTransparencyLevel, subLevelX, subLevelY, intMinWidth)
{
	
	this.name 	= strName;
	this.isCSS 	= false;
	this.isW3C 	= false;
	this.isIE4	= false;
	this.isNN4	= false;
	this.isGecko	= false;
	this.isOpera	= false;
	this.isIE6CSS	= false;
	this.isIE6	= false;
	this.isDHTML	= false;
	
	this.suppressMenus = false;
	this.strLayout	= strLayout;
	this.shadowOffset = 2;
	
	this.hideTimeout= false;
	
	this.firstLevelX = firstLevelX;
	this.firstLevelY = firstLevelY;

	this.subLevelX = subLevelX;
	this.subLevelY = subLevelY;

	this.useShadow = useShadow;
	this.isTransparent = isTransparent;
	this.intTransparencyLevel = intTransparencyLevel;
	
	this.strTitle = strTitle;
	this.subMenuStartIndex = subMenuStartIndex;
	 
	this.intMinWidth = intMinWidth;

	
	this.Items 	= new Array();
}

// Funktion för att ta reda på vad webbläsaren stödjer
Menu.prototype.autoconfig = function()
{
    if(document && document.images)
    {
		
		agent = navigator.userAgent.toLowerCase();

		this.major = parseInt(navigator.appVersion);
		this.minor = parseFloat(navigator.appVersion);
	
		this.isCSS	= (document.body && document.body.style) ? true : false;
        
		this.isW3C	= (this.isCSS && document.getElementById) ? true : false;
		this.isIE4	= (this.isCSS && document.all && readIEVer() >= 4.0) ? true : false;
        this.isNN4	= (document.layers) ? true : false;

		this.isNS = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
		this.isNS6 = (this.isNS && (this.major >= 5));

		this.isGecko	= (this.isCSS && navigator && navigator.product && navigator.product == "Gecko");
		this.isOpera	= (this.isCSS && navigator.userAgent.indexOf( "Opera") != -1 );
		this.isIE6CSS	= (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false;
		this.isIE6	= ( this.isIE6CSS && readIEVer() >= 6.0 );
		this.isDHTML	= this.isCSS && ( this.isIE4 || this.isGecko || this.isOpera );
		
		this.isIEMAC	= (agent.indexOf('msie') != -1) && (navigator.platform == "MacPPC")
        
		if( this.suppressMenus || ( this.isOpera && readOperaVer() < 7 ) || ( this.isGecko && navigator.productSub <= 20011022 ) || ( this.isGecko && navigator.productSub == 20030107 ) )
        {
			// Opera 6.x doesn't seem to like the DHTML...
			// Netscape 6.2 puts the menus in the wrong place...
			// Safari, the menus don't go away... problem in ResetMenu
			this.isDHTML	= false;
        }
    }
}

// Menuitem - objekt

function MenuItem(id, parentId, parentObj, strText, strAction, intOrder, special, imgOver, imgOut)
{
	this.ID				= id;
	this.parentID 		= parentId;
	this.parentObj		= parentObj;
	this.strText		= strText;
	this.intOrder		= intOrder;
	this.strAction		= strAction;
	this.isSeparator	= false;
	this.isCaption		= false;
	this.isVisible		= false;
	this.hasChildren	= false;
	this.isMenuBarItem  = false;
	this.imgOver		= imgOver;
	this.imgOut			= imgOut;
	this.special		= special
}



// Funktion för att lägga till nya objekt i menyn
//Menu.prototype.addItem = function(id, parentId, strText, strAction, imgOver, imgOut, special)
Menu.prototype.addItem = function(id, parentId, strText, strAction, special, imgOver, imgOut)
{
	parentObj = this.Items[parentId] ?  this.Items[parentId] : null;
	
	// Finns det några objekt i den här nivån tidigare?
	var intSiblings = 0;
	if(parentObj)
	{
		for (key in this.Items)
		{
			if( this.Items[key].parentObj == parentObj)
			{
				intSiblings++;
			}
		}
	}
	
	// Lägg till, intSiblings = intOrder
	
	this.Items[id] = new MenuItem(id, parentId, parentObj, strText, strAction, intSiblings, special, imgOver, imgOut);
	
	// Markera att parentObj har children
	if(parentObj)
	{
		parentObj.hasChildren = true;
	}
	
	
}

Menu.prototype.divOver = function()
{
	if (this.isNN4!=true) 
	{
		tmpID = null;
		if(typeof(this.menuID) == "string")
	 	{
			tmpID  = this.menuID;
		}
		else
		{
			tmpID = this.name;
		}
		
		eval("var item = " + tmpID);
		
		if(item.hideTimeout != null)
		{
			clearTimeout(item.hideTimeout);
			item.hideTimeout = false;
		}
		
		
		//window.status += "Over "
	}
}

Menu.prototype.divOut = function()
{
	tmpID = null;
	if(typeof(this.menuID) == "string")
 	{
		tmpID  = this.menuID;
	}
	else
	{
		tmpID = this.name;
	}
	
	eval("var item = " + tmpID);
	
	item.hideTimeout = setTimeout( tmpID + ".hidePopups(null)",300);
	//window.status += "Out "
}

Menu.prototype.hidePopups = function(id)
{
	d = new Date();
	//window.status = "TEST" + d.getTime(); 
	//window.status += " " + this.name;
	for(key in this.Items)
	{
	
		// Pajar sig i netscape...testar den lösning med if(popupElement) istället ett tag
//		if(this.Items[key].isVisible)
//		{
			
			var popupElement = document.getElementById(this.name + "popupElement" + key);
			if(popupElement)
			{
				popupElement.style.visibility = "hidden";
				//popupElement.shadowItem.style.visibility = "hidden";
				//popupElement.opacityItem.style.visibility = "hidden";
				if(this.isIE4 && navigator.platform != "MacPPC")
				{
					var iFrame = document.getElementById(this.name + "iFrameID" + key);
					iFrame.style.visibility = "hidden";
				}

				this.Items[key].isVisible = false;
			}
//		}
	}
	
	
	
	if(id)
	{
		var item = this.Items[id].parentObj;
		while(item && !item.isMenuBarItem)
		{
			var popupElement = document.getElementById(this.name + "popupElement" + item.ID);
			popupElement.style.visibility = "visible";
			if(this.useShadow)
			{
				//popupElement.shadowItem.style.visibility = "visible";
			}
			
			var iFrame = document.getElementById(this.name + "iFrameID" + item.ID);
						
			if(!this.isTransparent)
			{				
//				Where is this one used, it generates a error...
//				iFrame.style.visibility = "visible";
			}
			else
			{
				//popupElement.opacityItem.style.visibility = "visible";
				//popupElement.opacityItem.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+ this.intTransparencyLevel +", style=0); ";
				//popupElement.opacityItem.style.MozOpacity = this.intTransparencyLevel/100;
				
				if(this.IsNS)
				{
					//popupElement.opacityItem.style.mozOpacity = 0.2;
				}
				
			}
			
			item.isVisible = true;
			item = item.parentObj;
		}
	}
}

Menu.prototype.itemOver = function(id, isFirstLevel)
{
	if(this.hideTimeout != null)
	{
		clearTimeout(this.hideTimeout);
		this.hideTimeout = null;
	}

	setTimeout(this.name + ".showPopup("+ id +","+ isFirstLevel +")", 0);
}

Menu.prototype.itemOut = function(id)
{
}

Menu.prototype.setFocus = function(id)
{
}



Menu.prototype.showPopup = function(id, isFirstLevel)
{
	// Är den redan synlig?, då behöver vi inte rendera
	if(this.Items[id].isVisible) return;
	
	
	this.hidePopups(id);
	
	
	// Finns inga childs, behöver vi inte rendera något
	if(!this.Items[id].hasChildren) return;
	
	// Skapa popupElement, eller hämta det om det redan är skapat!
	var popupElement = document.getElementById(this.name + "popupElement" + id);
	if (!popupElement)
	{
		popupElement = this.createPopup(id);
		
		// Kontrollera att bredden är större än intMinWidth
		/*
		if(popupElement.clientWidth < this.intMinWidth)
		{
			
			if(this.isNS)
			{
				popupElement.style.width = (this.intMinWidth + 8) + "px";
				objTable = popupElement.firstChild;
				objTable.style.width = (this.intMinWidth + 8) + "px";
				
			}
			else
			{
				popupElement.style.width = this.intMinWidth + "px";
				objTable = popupElement.firstChild;
				objTable.style.width = this.intMinWidth + "px";
				
			}
		}
		*/
		
	}
	
	
	this.Items[id].isVisible = true;
	var itemPosition = document.getElementById(this.name + "itemID" + id);
	
	var x = null;
	var y = null;
	
	switch(this.strLayout)
	{
		case "horizontal":
			if( isFirstLevel )
			{
					
				x = getAbsoluteLeft(itemPosition);
				y = getAbsoluteBottom(itemPosition);	
				
				x += this.firstLevelX;
				y += this.firstLevelY;	
			}
			else
			{

				y = getAbsoluteTop(itemPosition);
				x = getAbsoluteRight(itemPosition);

				x += this.subLevelX;
				y += this.subLevelY;
			}

		break;
		
		case "vertical":
			y = getAbsoluteTop(itemPosition);
			x = getAbsoluteRight(itemPosition);
			
			
		case "finvertical":
			if( isFirstLevel )
			{
					
				y = getAbsoluteTop(itemPosition);
				x = getAbsoluteRight(itemPosition);
				
				x += this.firstLevelX;
				y += this.firstLevelY;	
			}
			else
			{
				y = getAbsoluteTop(itemPosition);
				x = getAbsoluteRight(itemPosition);
			}
			
		break;
	}

	//Mac korrigering
	if(this.isIEMAC)
	{ 
		x += 6;
		y += 11;
	}
	

	
	
	
	if(navigator.platform == "MacPPC")
	{
	
		
	}
	
	if(this.isNS)
	{
		y -= 1;
		x -= 1;
	}
	
	
	// Visa olika beroendep på vilken browser som används
	
	
	if(this.isIE4 && navigator.platform != "MacPPC")
	{
		
		//if(!document.all[this.name + "iFrameID" + id])
		if(!document.getElementById(this.name + "iFrameID" + id))
		{
			var iFrame;
			iFrame = "<iframe name=\""+ this.name +"iFrameID"+ id +"\" id=\""+ this.name +"iFrameID"+ id +"\" scrolling=\"no\" frameborder=\"0\"></iframe>";
			document.body.insertAdjacentHTML("beforeEnd", iFrame);
		}

		iFrame = document.getElementById(this.name + "iFrameID" + id);
	
		iFrame.style.zIndex 	= 100;
		iFrame.style.position	= "absolute";
		iFrame.style.top 		= y + "px";
		iFrame.style.left 		= x + "px";
		if(this.isTransparent)
		{
			iFrame.style.visibility = "hidden";
		}
		else
		{
			iFrame.style.visibility = "visible";
		}
		iFrame.height = popupElement.clientHeight + 2 + "px";
		iFrame.width = popupElement.clientWidth + 2 + "px";	
	}
	
	
	/*
	popupElement.shadowItem.style.left 		= (x + this.shadowOffset) + "px";
	popupElement.shadowItem.style.top		= (y + this.shadowOffset) + "px";
	popupElement.shadowItem.style.width		= popupElement.offsetWidth + "px";
	popupElement.shadowItem.style.height	= popupElement.offsetHeight+ "px";
	popupElement.shadowItem.style.zIndex 	= 1101;
	
	popupElement.opacityItem.style.left 	= x + "px";
	popupElement.opacityItem.style.top		= y + "px";
	popupElement.opacityItem.style.width	= popupElement.offsetWidth + "px";
	popupElement.opacityItem.style.height	= popupElement.offsetHeight+ "px";
	popupElement.opacityItem.style.zIndex 	= 1100;
	
	if(this.useShadow)
	{
		popupElement.shadowItem.style.visibility= "visible";
	}
	
	if(this.isTransparent)
	{
		popupElement.opacityItem.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+ this.intTransparencyLevel +", style=0); ";
		popupElement.opacityItem.style.MozOpacity = this.intTransparencyLevel/100;
		popupElement.opacityItem.style.visibility = "visible";
	}
	
	*/
	
	//alert("x=" + x + " y=" + y);
	popupElement.style.position = "absolute";
	popupElement.style.left 		= x + "px";
	popupElement.style.top			= y + "px";
	popupElement.style.visibility 	= "visible";
	popupElement.style.zIndex		= 1102;
	
	return false;
}

Menu.prototype.createPopup = function(id)
{
	var strSubMenu = "";
	
	strSubMenu += "<table cellpadding=0 cellspacing=0 border=0 class=\"subMenu\">";
	
	
	for(key in this.Items)
	{
		if(this.Items[key].parentID == id)
		{
			strSubMenu += "<tr><td class=\"subMenuItem\" onMouseOver=\"this.className='subMenuItemOver';\" onMouseOut=\"this.className='subMenuItem';\" onClick=\"this.className='subMenuItem'\">";
			
			
			
			if(this.Items[key].strAction=="")
			{
				strSubMenu += "<div id=\""+this.name+"itemID"+ key +"\" onMouseOver=\""+ this.name +".itemOver("+ key +",false)\">";
				strSubMenu += "<table cellpadding=0 cellspacing=0 border=0 width=100%><tr>";
				strSubMenu += "<td>"; //<td nowrap>
				strSubMenu += "<span class=\"subMenuFont\">";
				strSubMenu += this.Items[key].strText;
				strSubMenu += "</span>";

				if(this.Items[key].hasChildren)
				{
					strSubMenu += "<span class=\"subMenuFont\">";
					strSubMenu += " ";
					strSubMenu += "</span>";
				}
				
				strSubMenu += "</td>";
				strSubMenu += "</tr></table>";
				strSubMenu += "</div>";
				
			}
			else
			{
				strSubMenu += "<div id=\""+this.name+"itemID"+ key +"\" onMouseOver=\""+ this.name +".itemOver("+ key +",false)\" onClick=\"top.location.href='"+ this.Items[key].strAction +"'; "+this.name +".hidePopups(null); \" >";
				strSubMenu += "<table cellpadding=0 cellspacing=0 border=0 width=100%><tr>";
				strSubMenu += "<td>"; //<td nowrap>
				//strSubMenu += "<a href=\""+ this.Items[key].strAction +"\" class=\"subMenuFontLink\">";
				//strSubMenu += "<a name=\"a\" class=\"subMenuFontLink\">";
				strSubMenu += "<span class=\"subMenuFontLink\">";
				strSubMenu += this.Items[key].strText;
				strSubMenu += "</span>";
				//strSubMenu += "</a>";
			
				if(this.Items[key].hasChildren)
				{
					strSubMenu += "<a href=\""+ this.Items[key].strAction +"\" class=\"subMenuFontLink\"><span class=\"subMenuFontLink\">";
					strSubMenu += " ";
					strSubMenu += "</span></a>";
				}
				
				strSubMenu += "</td>";
				strSubMenu += "</tr></table>";
				strSubMenu += "</div>";
			}

			
			strSubMenu += "</td></tr>";
		}
	}
	strSubMenu += "</table>";
	
	
	
			
	var documentItem = document.createElement("div");
	documentItem.menuID = this.name;
	documentItem.className			= "subMenuDiv";

	documentItem.onmouseover		= this.divOver;
	documentItem.onmouseout			= this.divOut;
	documentItem.setAttribute("id", this.name + "popupElement" + id);
	
	documentItem.innerHTML = strSubMenu;

	//var shadowItem = document.createElement("div");
	//var opacityItem = document.createElement("div");
	//shadowItem.className = "subMenuShadowDiv";
	//opacityItem.className = "subMenuOpacityDiv";
	
	
	
	//documentItem.shadowItem = shadowItem;
	//documentItem.opacityItem = opacityItem;
	
	document.body.appendChild(documentItem);
	//document.body.appendChild(shadowItem);
	//document.body.appendChild(opacityItem);
	//alert(documentItem.innerHTML);
	return documentItem;
}

Menu.prototype.render = function(rootID)
{

if (!this.isNN4==true)
{

	strMenuBarTop = "";
	strMenuBarTop += "<div id='subMenuDiv' onMouseOver='"+ this.name +".divOver()' onMouseOut='"+ this.name +".divOut()'>"
	strMenuBarTop += "<table class=\"menubar\" cellpadding=0 cellspacing=0 border=0>";
	
	switch(this.strLayout)
	{
		case "vertical":
			for( key in this.Items )
			{
				if( this.Items[key].parentObj == this.Items[rootID])
				{
					strMenuBar += "<tr>";
					strMenuBar += "<td class=\"menubarMenuItemVertical\">";
					strMenuBar += "<div id=\""+ this.name +"itemID"+ key +"\" onMouseOver=\""+ this.name +".itemOver("+ key +", true);\">";
					
					strMenuBar += "<table id=\"tableID"+ key +"\" cellpadding=0 cellspacing=0 border=0 width=100%><tr><td>";
					
					strMenuBar += this.Items[key].strText;
					strMenuBar += "</td></tr></table>";

					strMenuBar += "</div>";
					strMenuBar += "</td>";
					strMenuBar += "</tr>";
					
					if( this.Items[key].parentObj )
					{
						this.Items[key].parentObj.isMenuBarItem = true;
					}
				}
			}
			strMenuBar = strMenuBarTop + strMenuBar;

			break;


		case "horizontal":
			
			var strTitleBar = "";
			var strMenuBar = "";
			var strSearchField = "";
			intCols = 0
			strMenuBar += "<tr>";
			intTotalCols = 0;
//			intTabOrder = 1;
			
			for( key in this.Items )
			{
				if( this.Items[key].parentObj == this.Items[rootID])
				{
					intTotalCols++;
				}
			}
			
			
			for( key in this.Items )
			{

				
				
				if( this.Items[key].parentObj == this.Items[rootID])
				{
					intCols++;
					
					leftBorder = "0px;";
					topBorder = "0px;";
					bottomBorder = "0px;";
					rightBorder = "0px;";
					
					if(this.strTitle != "")
					{
						if(intCols == (this.subMenuStartIndex+1))
						{
							leftBorder = "border-left:1px solid #FFFFFF;";
							bottomBorder = "border-bottom:1px solid #FFFFFF;";
						}
					
						if(intCols > (this.subMenuStartIndex+1))
						{
							bottomBorder = "border-bottom:1px solid #FFFFFF;";
						}
					
					
						if(intCols == (intTotalCols))
						{
							rightBorder = "border-right:1px solid #FFFFFF;";
						}
					}
					
					strMenuBar += "<td><img vspace=0 hspace=0 src=\"/styles/www.folkhogskola.nu/images/menu/imgMenuDotts.gif\" border=\"0\" alt=\"\"></td>";
					strMenuBar += "<td class=\"menubarMenuItemHorizontal\" style=\""+ leftBorder + bottomBorder+ topBorder+ rightBorder+ " vertical-align:top; \">";
					
					if( this.Items[key].special != null)
				{
				        switch(this.Items[key].special)
				        {
				            case "lyssna":
						        strMenuBar += "<div tabIndex="+ intTabOrder++ +"  id=\""+ this.name +"itemID"+ key +"\" onKeyDown=\" if(event.keyCode==13) {top.location.href='"+ this.Items[key].strAction +"'}\"  onMouseOver=\""+ this.name +".itemOver("+ key +", true);\" onClick=\"top.location.href='"+ this.Items[key].strAction +"'\" >";  
            					strMenuBar += "<table  width='100%' cellpadding=0 cellspacing=0 border=0><tr><td style=\"height:50px;width:81px;vertical-align:top;text-align:center;\" class=\"menubarFontTop\" onMouseOver=\"this.className='menubarFontTopOver';document.getElementById('linktop" + this.Items[key].ID + "').className='menubarFontTopOver';document.getElementById('linktop" + key + "').src=\'" + this.Items[key].imgOver + "\';document.getElementById('lyssnaLink').className='menubarFontTopOver';\" onMouseOut=\"this.className='menubarFontTop';document.getElementById('linktop" + this.Items[key].ID + "').className='menubarFontTop';document.getElementById('linktop" + key + "').src=\'" + this.Items[key].imgOut + "\';document.getElementById('lyssnaLink').className='menubarFontTop';\">";
    						    strMenuBar += "<a href=\"" + this.Items[key].strAction  + "\" id=\"lyssnaLink\" class=\"menubarFontTop\"><img id=\"linktop" + key + "\" alt=\"Markera gärna texten du vill lyssna på innan du klickar på denna funktion!\" vspace=0 hspace=0 border=\"0\" src=\"" + this.Items[key].imgOut + "\" onmouseover=\"document.getElementById('linktop" + key + "').src=\'" + this.Items[key].imgOver + "\'\" onmouseout=\"document.getElementById('linktop" + key + "').src=\'" + this.Items[key].imgOut + "\'\" />";						  
        						strMenuBar += "&nbsp;<span class=\"lyssnaSpan\">LYSSNA</span></a></td></tr></table>"
	        					strMenuBar += "</div>";
				                break;
				            case "print":
						        strMenuBar += "<div tabIndex="+ intTabOrder++ +"  id=\""+ this.name +"itemID"+ key +"\" onKeyDown=\" if(event.keyCode==13) {top.location.href='"+ this.Items[key].strAction +"'}\"  onMouseOver=\""+ this.name +".itemOver("+ key +", true);\" onClick=\"top.location.href='"+ this.Items[key].strAction +"'\" >";  
            					strMenuBar += "<table  width='100%' cellpadding=0 cellspacing=0 border=0><tr><td style=\"height:50px;width:81px;vertical-align:top;text-align:center;\" class=\"menubarFontTop\" onMouseOver=\"this.className='menubarFontTopOver';document.getElementById('linktop" + this.Items[key].ID + "').className='menubarFontTopOver';document.getElementById('linktop" + key + "').src=\'" + this.Items[key].imgOver + "\';document.getElementById('printLink').className='menubarFontTopOver';\" onMouseOut=\"this.className='menubarFontTop';document.getElementById('linktop" + this.Items[key].ID + "').className='menubarFontTop';document.getElementById('linktop" + key + "').src=\'" + this.Items[key].imgOut + "\';document.getElementById('printLink').className='menubarFontTop';\">";
    						    strMenuBar += "<a href=\"" + this.Items[key].strAction  + "\" id=\"printLink\" class=\"menubarFontTop\"><img id=\"linktop" + key + "\" alt=\"" + this.Items[key].strText + "\" vspace=0 hspace=0 border=\"0\" src=\"" + this.Items[key].imgOut + "\" onmouseover=\"document.getElementById('linktop" + key + "').src=\'" + this.Items[key].imgOver + "\'\" onmouseout=\"document.getElementById('linktop" + key + "').src=\'" + this.Items[key].imgOut + "\'\" />";						  
        						strMenuBar += "&nbsp;<span class=\"lyssnaSpan\">SKRIV UT</span></a></td></tr></table>"
	        					strMenuBar += "</div>";
				                break;
				            default:
						        //alert("-[" + this.Items[key].special + "]-");
						        //strTMP = strMenuBar
						        //strMenuBar += "<div tabIndex="+ intTabOrder++ +"  id=\""+ this.name +"itemID"+ key +"\" onKeyDown=\" if(event.keyCode==13) {top.location.href='"+ this.Items[key].strAction +"'}\"  onMouseOver=\""+ this.name +".itemOver("+ key +", true);\" onClick=\"top.location.href='"+ this.Items[key].strAction +"'\" >";  
						        //strMenuBar += "<table  width='100%' cellpadding=0 cellspacing=0 border=0><tr><td nowrap height='50' width='81' align='center' valign='top' class=\"menubarFontTop\" onMouseOver=\"this.className='menubarFontTopOver';document.getElementById('linktop" + this.Items[key].ID + "').className='menubarFontTopOver';\" onMouseOut=\"this.className='menubarFontTop';document.getElementById('linktop" + this.Items[key].ID + "').className='menubarFontTop';\">";

						        strMenuBar += "<div id=\""+ this.name +"itemID"+ key +"\" onMouseOver=\""+ this.name +".itemOver("+ key +", true);this.className='menubarFontTopOver';overSpecial();\" onMouseOut=\"this.className='menubarFontTop';notOverSpecial();\">";
						        strMenuBar += "<table cellpadding=0 cellspacing=0 style='width:81px;height:50px;border:0px;vertical-align:top;'><tr><td align=\"center\">";				
						        strMenuBar += "<div class=\"menubarFontHorizontal\">";
        						
						        //javascript:fnResizeSize(12) 
						        //style=\"float: right;\"
						        //style=\"position: relative;\"
						        
						        var anchorStart = new Array();
				                if(navigator.appName == 'Netscape' && parseFloat(navigator.appVersion) <= 5)
				                {
					                anchorStart[0] = '<a href=\"javascript:setFontSize(1.0);void(0);\">';
					                anchorStart[1] = '<a href=\"javascript:setFontSize(1.5);void(0);\">';
					                anchorStart[2] = '<a href=\"javascript:setFontSize(2.0);void(0);\">';
				                }
				                else
				                {
					                anchorStart[0] = '<a href=\"javascript:void(0);\">';
					                anchorStart[1] = '<a href=\"javascript:void(0);\">';
					                anchorStart[2] = '<a href=\"javascript:void(0);\">';
				                }
						        			
						        strMenuBar += "<div tabindex=\"6\" onclick=\"javascript:setFontSize(1.0)\" style=\"float: left;margin-left:25px;display:inline;\">" + anchorStart[0] + "<IMG id=\"si10\" style=\"vertical-align:middle;border:0px;\" SRC=/styles/www.folkhogskola.nu/IMAGES/A10.GIF alt=\"Normal\"></a></div>";
						        strMenuBar += "<div tabindex=\"6\" onclick=\"javascript:setFontSize(1.5)\" style=\"float: left;display:inline;\">" + anchorStart[1] + "<IMG id=\"si14\" style=\"vertical-align:middle;border:0px;\" SRC=/styles/www.folkhogskola.nu/IMAGES/A14.GIF alt=\"Stor\"></a></div>";
						        strMenuBar += "<div tabindex=\"6\" onclick=\"javascript:setFontSize(2.0)\" style=\"float: left;padding-right:6px;display:inline;\">" + anchorStart[2] + "<IMG id=\"si18\" style=\"vertical-align:middle;border:0px;\" SRC=/styles/www.folkhogskola.nu/IMAGES/A18.GIF alt=\"St&ouml;rre\"></a></div>";

        						
						        strMenuBar += "<br /><IMG SRC=/styles/www.folkhogskola.nu/images/menu/SPACER.GIF WIDTH=50 HEIGHT=1 alt=\"\"> <br />";
						        strMenuBar += "</div></td></tr></table></div>";
						        //strMenuBar += "</td></tr></table></div>";
						        break;
					    }
				}
				else{//EXTRA
					
					if(this.Items[key].strAction=="")
					{


						strMenuBar += "<div id=\""+ this.name +"itemID"+ key +"\" onMouseOver="+ this.name +".itemOver("+ key +", true);\">";
						strMenuBar += "<table cellpadding=0 cellspacing=0 border='0' ><tr><td>"; //<td nowrap>";


						//Finns det en imgOut eller ej!
						if (typeof this.Items[key].imgOut != 'undefined')  {
			
						  //Skriv ut normal bilden
						  if (typeof this.Items[key].imgOver != 'undefined')  {
						    strMenuBar += "<img vspace=0 hspace=0 border=\"0\" src=\"" 
										+ this.Items[key].imgOut + "\" onmouseover=\"this.src=\'" + this.Items[key].imgOver + "\'\" onmouseout=\"this.src=\'" + this.Items[key].imgOut + "\'\">";						  
						  } 
						  else  {
						  	strMenuBar += "<img border=\"0\" src=\"" + this.Items[key].imgOut + "\">"
						  }
						} else  {
						  strMenuBar += "<span class=\"menubarFontHorizontal\">";
						  strMenuBar += this.Items[key].strText.toUpperCase() + '&nbsp;&nbsp;';
						  strMenuBar += "</span>";
						}

						strMenuBar += "</td></tr></table>"
						strMenuBar += "</div>";


					}
					else
					{

						strMenuBar += "<div tabIndex="+ intTabOrder++ +"  id=\""+ this.name +"itemID"+ key +"\" onKeyDown=\" if(event.keyCode==13) {top.location.href='"+ this.Items[key].strAction +"'}\"  onMouseOver=\""+ this.name +".itemOver("+ key +", true);\" onClick=\"top.location.href='"+ this.Items[key].strAction +"'\" >";  
						
						
						//Funkar.. strMenuBar += "<table cellpadding=0 cellspacing=0 border=0><tr><td nowrap height='50' width='81' align='center' valign='top' class=\"menubarFontHorizontal\" onMouseOver=\"style.backgroundColor='#FFFFFF';style.color='#f05a22';\" onmouseout=\"style.backgroundColor='#f05a22';style.color='#FFFFFF';\">";
						//strMenuBar += "<table cellpadding=0 cellspacing=0 border=0><tr><td nowrap height='50' width='81' align='center' valign='top' class=\"menubarFontTop\" onMouseOver=\"this.className='menubarFontTopOver';linktop" + this.Items[key].ID + ".className='menubarFontTopOver';\" onMouseOut=\"this.className='menubarFontTop';linktop" + this.Items[key].ID + ".className='menubarFontTop';\">";
						strMenuBar += "<table  width='100%' cellpadding=0 cellspacing=0 border=0><tr><td style=\"vertical-align:top;width:81px;height:51px;text-align:center;\" class=\"menubarFontTop\" onMouseOver=\"this.className='menubarFontTopOver';document.getElementById('linktop" + this.Items[key].ID + "').className='menubarFontTopOver';\" onMouseOut=\"this.className='menubarFontTop';document.getElementById('linktop" + this.Items[key].ID + "').className='menubarFontTop';\">";
                                                                                                     //<td>
						//Finns det en imgOut eller ej!
						if (typeof this.Items[key].imgOut != 'undefined')  {

						  //Skriv ut normal bilden
						  if (typeof this.Items[key].imgOver != 'undefined')  {
						    strMenuBar += "<img id=\"linktop" + key + "\" alt=\"" + this.Items[key].strText + "\" vspace=0 hspace=0 border=\"0\" src=\"" 
										+ this.Items[key].imgOut + "\" onmouseover=\"document.getElementById('linktop" + key + "').src=\'" + this.Items[key].imgOver + "\'\" onmouseout=\"document.getElementById('linktop" + key + "').src=\'" + this.Items[key].imgOut + "\'\">";						  
						  } else  {
						  	strMenuBar += "<img border=\"0\" src=\"" + this.Items[key].imgOut + "\">"
						  }
						} else  {
						  //strMenuBar += "<span class=\"menubarFontHorizontal\">";
						  strMenuBar += "<a class='menubarFontTop' id='linktop" + this.Items[key].ID + "' href=" + this.Items[key].strAction + ">" + this.Items[key].strText.toUpperCase() + "</a>";
						  //strMenuBar += this.Items[key].strText.toUpperCase() + '&nbsp;&nbsp;';
						  //strMenuBar += "</span>"; //Utan bild...
						}

						strMenuBar += "</td></tr></table>"
						strMenuBar += "</div>";
						

					
					}
}//EXTRA

					strMenuBar += "</td>";
					
					var F;
//			F = document.dbgForm;
			//F.dbg.value = strMenuBar;
//alert(strMenuBar);
					if( this.Items[key].parentObj )
					{
						this.Items[key].parentObj.isMenuBarItem = true;	
					}
				}
			
		}


			strMenuBar += "<td style=\"border-right: 1px none #FFFFFF; padding:0px; margin:0px;\" class=\"menubarMenuItemHorizontal\" width=1 align=left><span class=\"menubarFontHorizontal\"></span></td>"; // utfyllnad
			strMenuBar += "</tr>";
			
			if(this.strTitle != "")
			{
				
				intCols2 = intCols - this.subMenuStartIndex - 2;
				intCols3 = 2;
				
				strTitleBar += "<tr>";
				strTitleBar += "<td colspan=" + this.subMenuStartIndex +" class=\"menubarMenuItemHorizontal\"></td>";
				strTitleBar += "<td style=\"border-left:1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-right:1px solid #FFFFFF; border-bottom:1px solid #FFFFFF\" colspan=\""+ intCols2 +"\" class=\"menubarMenuItemHorizontal\"><span class=\"menubarFontHorizontal\">"+ this.strTitle.toUpperCase() +"</span></td>"
				strTitleBar += "<td colspan=\""+ intCols3 +"\" style=\"border-bottom:1px solid #FFFFFF;\">&nbsp;</td>";
				strTitleBar += "</tr>";
			}
			
			
			strMenuBar = strMenuBarTop + strTitleBar + strMenuBar;
			
			
			var F;
			F = document.dbgForm;
			//F.dbg.value = strMenuBar;
		
			break;
			
			
		case "finvertical":

			var strTitleBar = "";
			var strMenuBar = "";
			var strSearchField = "";
			intCols = 0
			strMenuBar += "<tr>";
			intTotalCols = 0;
			for( key in this.Items )
			{			
				if( this.Items[key].parentObj == this.Items[rootID])
				{
					intTotalCols++;					
				}
			}
			
			
			for( key in this.Items )
			{
				if( this.Items[key].parentObj == this.Items[rootID])
				{
					intCols++;
					
					leftBorder = "";
					topBorder = "";
					bottomBorder = "";
					rightBorder = "";
					
					if(this.strTitle != "")
					{
						if(intCols == (this.subMenuStartIndex+1))
						{
							leftBorder = "border-left:1px solid #FFFFFF;";
							bottomBorder = "border-bottom:1px solid #FFFFFF;";
						}

						if(intCols > (this.subMenuStartIndex+1))
						{
							bottomBorder = "border-bottom:1px solid #FFFFFF;";
						}

						if(intCols == (intTotalCols))
						{
							rightBorder = "border-right:1px solid #FFFFFF;";
						}
					}
					
					strMenuBar += "<tr>";
					strMenuBar += "<td class=\"menubarMenuItemVertical\" style=\""+ leftBorder + bottomBorder + topBorder + rightBorder+ "\" >";


					if(this.Items[key].strAction=="")
					{
						strMenuBar += "<div id=\""+ this.name +"itemID"+ key +"\" onMouseOver=\""+ this.name +".itemOver("+ key +", true);\">";
						strMenuBar += "<table cellpadding=0 cellspacing=0 border=0><tr><td>"; //<td nowrap>


						//Finns det en imgOut eller ej!
						if (typeof this.Items[key].imgOut != 'undefined')  {
			
						  //Skriv ut normal bilden
						  if (typeof this.Items[key].imgOver != 'undefined')  {
						    strMenuBar += "<img vspace=0 hspace=0 border=\"0\" src=\""
										+ this.Items[key].imgOut + "\" onmouseover=\"this.src=\'" + this.Items[key].imgOver + "\'\" onmouseout=\"this.src=\'" + this.Items[key].imgOut + "\'\">";						  
						  } else  {
						  	strMenuBar += "<img border=\"0\" src=\"" + this.Items[key].imgOut + "\">"
						  }
						} else  {
						  strMenuBar += "<span class=\"menubarFontHorizontal\">";
						  strMenuBar += this.Items[key].strText.toUpperCase() + '&nbsp;&nbsp;';
						  strMenuBar += "</span>";
						}

						strMenuBar += "</td></tr><tr><td style=\"font-size:1px;\"><img style=\"vertical-align:top;border:0px;\"hspace=0 vspace=0 src=\"/styles/www.folkhogskola.nu/images/menu/imgMenuDividerDotts.gif alt=\"\" width=\"220\" height= \"1\" /></td></tr><tr><td><img src=\"/styles/www.folkhogskola.nu/images/menu/spacer.gif\" width=\"1\" height=\"15\" alt=\"\" /></td></tr></table>"
						strMenuBar += "</div>";
					}
					else
					{
						strMenuBar += "<div tabIndex="+ intTabOrder++ +" id=\""+ this.name +"itemID"+ key +"\" onKeyDown=\" if(event.keyCode==13) {top.location.href='"+ this.Items[key].strAction +"'} \" onMouseOver=\""+ this.name +".itemOver("+ key +", true);\" onClick=\"top.location.href='"+ this.Items[key].strAction +"'\" >";  
						strMenuBar += "<table style=\"width:100%;border:0px;\" cellpadding=0 cellspacing=0><tr><td style=\"vertical-align:middle;\" class=\"menubarFontLeft\" onMouseOver=\"this.className='menubarFontLeftOver';document.getElementById('link" + this.Items[key].ID + "').className='menubarFontLeftOver';document.getElementById('img" + this.Items[key].ID + "').src='/styles/www.folkhogskola.nu/images/menu/imgLeftMenu_Over.gif';\" onMouseOut=\"this.className='menubarFontLeft';document.getElementById('img" + this.Items[key].ID + "').src='/styles/www.folkhogskola.nu/images/menu/imgLeftMenu.gif';document.getElementById('link" + this.Items[key].ID + "').className='menubarFontLeft';\" alt=\"\">";
					                                                                                                    //nowrap
						//Finns det en imgOut eller ej!
						if (typeof this.Items[key].imgOut != 'undefined')  {
			
						  //Skriv ut normal bilden
						  if (typeof this.Items[key].imgOver != 'undefined')  {
						    strMenuBar += "<img alt=\"" + this.Items[key].strText + "\" vspace=0 hspace=0 border=\"0\" src=\"" 
										+ this.Items[key].imgOut + "\" onmouseover=\"this.src=\'" + this.Items[key].imgOver + "\'\" onmouseout=\"this.src=\'" + this.Items[key].imgOut + "\'\">";						  
						  } else  {
						  	strMenuBar += "<img border=\"0\" src=\"" + this.Items[key].imgOut + "\">"
						  }
						} else  {
						  /*strMenuBar += "<span class=\"menubarFontHorizontal\">";
						  strMenuBar += this.Items[key].strText.toUpperCase() + '&nbsp;&nbsp;';
						  strMenuBar += "</span>";*/
						  
						  /*
						  //
						  */
						  //strMenuBar += "<span class=\"subMenuFontLink\">";						  
						//  strMenuBar += this.Items[key].strText + '&nbsp;&nbsp;';						 
						  //strMenuBar += "<a href=" + this.Items[key].strAction + " onBlur=\""+ this.name +".itemOver(" + key + ", true)\" onFocus=\""+ this.name +".itemOver("+ key +", true);\" >" + this.Items[key].strText + "&nbsp;&nbsp;" + "</a>";
						  
						  strMenuBar += "<img alt='' id='img" + this.Items[key].ID + "' src=\"/styles/www.folkhogskola.nu/images/menu/imgLeftMenu.gif\" border='0' alt=\"\"><a class='menubarFontLeft' id='link" + this.Items[key].ID + "' href=" + this.Items[key].strAction + ">"
						  strMenuBar += "" + this.Items[key].strText+ "</a>";
						  //onkeydown='handleKeyPress(event, key,  \"" + this.Items[key].strAction + "\")'
						//  strMenuBar += "</span>";
						}
					
						strMenuBar += "</td></tr><tr><td style=\"font-size:1px;\"><img hspace=0 vspace=0 style=\"vertical-align:top;border:0px;\" src=\"/styles/www.folkhogskola.nu/images/menu/imgMenuDividerDotts.gif\" width=\"220\" height=\"1\" alt=\"\" /></td></tr><tr><td><img src=\"/styles/www.folkhogskola.nu/images/menu/spacer.gif\" width=\"1\" height=\"15\" alt=\"\" /></td></tr></table>"
						strMenuBar += "</div>";
					}
					
					strMenuBar += "</td>";
					strMenuBar += "</tr>";
					if( this.Items[key].parentObj )
					{
						this.Items[key].parentObj.isMenuBarItem = true;	
					}
				}
			}


			strMenuBar += "<td style=\"border-right: 1px none #FFFFFF; padding:0px; margin:0px;\" class=\"menubarMenuItemVertical\" width=100% align=left><span class=\"menubarFontHorizontal\"></span></td>"; // utfyllnad
			strMenuBar += "</tr>";
			
			
			
			strMenuBar = strMenuBarTop + strMenuBar;
			
			/**/

			break;
	}

	strMenuBar += "</table>";
	strMenuBar += "</div>";

	strMenu = "<table cellpadding=0 cellspacing=0 border=0><tr style=\"vertical-align:bottom;\"><td style=\"padding:1px; padding-right:5px;\">"+ strMenuBar +"</td></tr></table>";
	
	

} else  {
//NS4
	strMenu = "";
    	strMenuBar = "";
    
	switch(this.strLayout)  
	{
		case "horizontal":
			for( key in this.Items )
			{
				if( this.Items[key].parentObj == this.Items[rootID])
				{
					strMenuBar += "<td class=\"menubarMenuItemHorizontal\" >";
						
					if(this.Items[key].strAction=="")
					{
						strMenuBar += "<div id=\""+ this.name +"itemID"+ key +"\" onMouseOver=\""+ this.name +".itemOver("+ key +", true);\">";
						strMenuBar += "<table cellpadding=0 cellspacing=0 border=0><tr><td>"; //<td nowrap>


						//Finns det en imgOut eller ej!
						if (typeof this.Items[key].imgOut != 'undefined')  {
			
						  //Skriv ut normal bilden
						  if (typeof this.Items[key].imgOver != 'undefined')  {
						    strMenuBar += "<img vspace=0 hspace=0 border=\"0\" src=\"" 
										+ this.Items[key].imgOut + "\" onmouseover=\"this.src=\'" + this.Items[key].imgOver + "\'\" onmouseout=\"this.src=\'" + this.Items[key].imgOut + "\'\">";						  
						  } else  {
						  	strMenuBar += "<img border=\"0\" src=\"" + this.Items[key].imgOut + "\">"
						  }
						} else  {
						  strMenuBar += "<span class=\"menubarFontHorizontal\">";
						  strMenuBar += this.Items[key].strText.toUpperCase() + '&nbsp;&nbsp;';
						  strMenuBar += "</span>";
						}

						strMenuBar += "</td></tr></table>"
						strMenuBar += "</div>";
					}
					else
					{
						strMenuBar += "<div id=\""+ this.name +"itemID"+ key +"\" onMouseOver=\""+ this.name +".itemOver("+ key +", true);\" onClick=\"top.location.href='"+ this.Items[key].strAction +"'\" >";  
						strMenuBar += "<table cellpadding=0 cellspacing=0 border=0><tr><td>"; //<td nowrap>
						strMenuBar += "<img vspace=0 hspace=0 src=\"/styles/www.folkhogskola.nu/images/menu/imgMenuDotts.gif\" border=\"0\" alt=\"\">";

						//Finns det en imgOut eller ej!
						if (typeof this.Items[key].imgOut != 'undefined')  {
			
						  //Skriv ut normal bilden
						  if (typeof this.Items[key].imgOver != 'undefined')  {
						    strMenuBar += "<a href=\"Javascript:top.location.href='"+ this.Items[key].strAction +"'\" "
						    strMenuBar += "onmouseover=\"" + "document.img" + this.name + key + ".src='" + this.Items[key].imgOver + "'\" onmouseout=\"" + "document.img" + this.name + key + ".src='" + this.Items[key].imgOut + "'\"><img id=\"" + "img" + this.name + key + "\" name=\"" + "img" + this.name + key + "\" vspace=0 hspace=0 border=\"0\" src=\"" 
										+ this.Items[key].imgOut + "\" onmouseover=\"this.src=\'" + this.Items[key].imgOver + "\'\" onmouseout=\"this.src=\'" + this.Items[key].imgOut + "\'\"></a>";						  
						  } else  {
						  	strMenuBar += "<img border=\"0\" src=\"" + this.Items[key].imgOut + "\">"
						  }
						} else  {
						  strMenuBar += "<span class=\"menubarFontHorizontal\">";
						  strMenuBar += this.Items[key].strText.toUpperCase() + '&nbsp;&nbsp;';
						  strMenuBar += "</span>";
						}

						strMenuBar += "</td></tr></table>"
						strMenuBar += "</div>";
					}
					
					strMenuBar += "</td>";
				}
			}
			strMenu = "<table border=\"0\"><tr>" + strMenuBar + "<snabeldrake /></td><td>&nbsp;</td></tr></table>";

			break; 

		case "finvertical":
			for( key in this.Items )
			{
				if( this.Items[key].parentObj == this.Items[rootID])
				{
				
					if(this.Items[key].strAction=="")
					{
						strMenuBar += "<div id=\""+ this.name +"itemID"+ key +"\" onMouseOver=\""+ this.name +".itemOver("+ key +", true);\">";
						strMenuBar += "<table cellpadding=0 cellspacing=0 border=0><tr><td>"; //<td nowrap>


						//Finns det en imgOut eller ej!
						if (typeof this.Items[key].imgOut != 'undefined')  {
			
						  //Skriv ut normal bilden
						  if (typeof this.Items[key].imgOver != 'undefined')  {
						    strMenuBar += "<img vspace=0 hspace=0 border=\"0\" src=\"" 
										+ this.Items[key].imgOut + "\" onmouseover=\"this.src=\'" + this.Items[key].imgOver + "\'\" onmouseout=\"this.src=\'" + this.Items[key].imgOut + "\'\">";						  
						  } else  {
						  	strMenuBar += "<img border=\"0\" src=\"" + this.Items[key].imgOut + "\">"
						  }
						} else  {
						  strMenuBar += "<span class=\"menubarFontHorizontal\">";
						  strMenuBar += this.Items[key].strText.toUpperCase() + '&nbsp;&nbsp;';
						  strMenuBar += "</span>";
						}

						strMenuBar += "</td></tr><tr><td style=\"font-size:1px;\"><img hspace=0 vspace=0 style=\"vertical-align:top;border:0px;\" src=\"/styles/www.folkhogskola.nu/images/menu/imgMenuDividerDotts.gif\" width=\"220\" height= \"1\" alt=\"\" /></td></tr><tr><td><img src=\"/styles/www.folkhogskola.nu/images/menu/spacer.gif\" width=\"1\" height=\"15\" alt=\"\" /></td></tr></table>"
						strMenuBar += "</div>";
					}
					else
					{
						strMenuBar += "<div id=\""+ this.name +"itemID"+ key +"\" onMouseOver=\""+ this.name +".itemOver("+ key +", true);\" onClick=\"top.location.href='"+ this.Items[key].strAction +"'\" >";  
						strMenuBar += "<table cellpadding=0 cellspacing=0 border=0><tr><td>"; //<td nowrap>
					
						//Finns det en imgOut eller ej!
						if (typeof this.Items[key].imgOut != 'undefined')  {
			
						  //Skriv ut normal bilden
						  if (typeof this.Items[key].imgOver != 'undefined')  {
						    strMenuBar += "<a href=\"Javascript:top.location.href='"+ this.Items[key].strAction +"'\" "
						    strMenuBar += "onmouseover=\"" + "document.img" + this.name + key + ".src='" + this.Items[key].imgOver + "'\" onmouseout=\"" + "document.img" + this.name + key + ".src='" + this.Items[key].imgOut + "'\"><img id=\"" + "img" + this.name + key + "\" name=\"" + "img" + this.name + key + "\" vspace=0 hspace=0 border=\"0\" src=\"" 
										+ this.Items[key].imgOut + "\" onmouseover=\"this.src=\'" + this.Items[key].imgOver + "\'\" onmouseout=\"this.src=\'" + this.Items[key].imgOut + "\'\"></a>";						  
						  } else  {
						  	strMenuBar += "<img border=\"0\" src=\"" + this.Items[key].imgOut + "\">"
						  }
						} else  {
						  strMenuBar += "<span class=\"menubarFontHorizontal\">";
						  strMenuBar += this.Items[key].strText.toUpperCase() + '&nbsp;&nbsp;';
						  strMenuBar += "</span>";
						}
					
						strMenuBar += "</td></tr><tr><td style=\"font-size:1px;\"><img hspace=0 vspace=0 style=\"vertical-align:top;border:0px;\" src=\"/styles/www.folkhogskola.nu/images/menu/imgMenuDividerDotts.gif\" width=\"220\" height=\"1\" alt=\"\" /></td></tr><tr><td><img src=\"/styles/www.folkhogskola.nu/images/menu/spacer.gif\" width=\"1\" height=\"15\" alt=\"\" /></td></tr></table>"
						strMenuBar += "</div>";
					}

				}
			}
			strMenu = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td>" + strMenuBar + "</td></tr></table>";
			break;
	}


}

//document.getElementById("dbgaj").value = strMenu;

	//alert(this.strLayout);
	//alert(strMenu);
	
	

	document.write( strMenu );
}





// Help functions
//////////////////////////////////////////////////////////7



function readIEVer()
{
	var agent	= navigator.userAgent;
	var offset	= agent.indexOf( "MSIE" );
	if( offset < 0 )
	{
		return 0;
	}
	return parseFloat( agent.substring( offset + 5, agent.indexOf( ";", offset ) ) );
}

function readOperaVer()
{
	var agent	= navigator.userAgent;
	var offset	= agent.indexOf( "Opera" );
	if( offset < 0 )
	{
		return 0;
	}
	return parseFloat( agent.substring( offset + 6 ) );
}

// Seek nested NN4 layer from string name
function seekLayer(doc, name) 
{
    var theObj;
    for (var i = 0; i < doc.layers.length; i++)
    {
        if (doc.layers[i].name == name)
		{
            theObj = doc.layers[i];
            break;
        }

        // dive into nested layers if necessary
        if (doc.layers[i].document.layers.length > 0)
		{
            theObj = seekLayer(document.layers[i].document, name);
        }
    }
    return theObj;
}

function getAbsoluteLeft(o) {                                                        
	// Get an object left position from the upper left viewport corner                      
	// Tested with relative and nested objects                                              
	
	oLeft = o.offsetLeft           // Get left position from the parent object             
	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent    // Get parent object reference                          
		oLeft += oParent.offsetLeft  // Add parent left position                             
		o = oParent                                                                         
	}                                                                                       
	// Return left postion                                                                  
	return oLeft                                                                            
}                                                                                

function getAbsoluteRight(o) {                                                        
	// Get an object left position from the upper left viewport corner                      
	// Tested with relative and nested objects                                              
	
	oRight = o.offsetLeft + o.offsetWidth;           // Get left position from the parent object             
	
	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent // Get parent object reference                          
		
		oRight += oParent.offsetLeft  // Add parent left position                             
		o = oParent                                                                         
	}                                                                                       
	// Return left postion                                                                  
	
	return oRight                                                                            
}                                                                                
            
            
            
function getAbsoluteBottom(o) {                                                        
	// Get an object left position from the upper left viewport corner                      
	// Tested with relative and nested objects                                              
	
	oBottom = o.offsetTop + o.offsetHeight; // Get left position from the parent object             
	
	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent    // Get parent object reference                          
		
		oBottom += oParent.offsetTop // Add parent left position                             
		o = oParent                                                                         
	}                                                                                       
	// Return left postion                                                                  
	return oBottom                                                       
}                                                                                          

function getAbsoluteTop(o) {
	// Get an object left position from the upper left viewport corner                      
	// Tested with relative and nested objects                                              
	
	oTop = o.offsetTop; // Get left position from the parent object             
	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent    // Get parent object reference                          
		oTop += oParent.offsetTop // Add parent left position                             
		o = oParent                                                                         
	}                                                                                       
	// Return left postion                                                                  
	
	return oTop
}   


function onSearch()
{
	top.location.href = "/search.asp?strCriteria=" + strCriteria.value;
}

function handleKeyPress(e, thisObj) {	

alert ('Found: ' + thisObj.ID);
/*		
	for( key in this.Items )
	{
		alert ('Found: ' + this.Items[key].parentId + ' ' + parentId);
		if( this.Items[key].parentId == parentId)
		{
			alert ('Found: ' + this.Items[key].ID);
		}
	}*/
  alert("You pressed: " + String.fromCharCode(e.which) + " " + e.keyCode + " " + key + " " + strAction);
  
}

function notOverSpecial()
{	
	
	document.getElementById('si10').src='/styles/www.folkhogskola.nu/images/a10.gif'
	document.getElementById('si14').src='/styles/www.folkhogskola.nu/images/a14.gif'
	document.getElementById('si18').src='/styles/www.folkhogskola.nu/images/a18.gif'
	
	//document.getElementById('linktop-1').src='/styles/www.folkhogskola.nu/images/imglyssna.gif'
	

}

function overSpecial()
{	
	document.getElementById('si10').src='/styles/www.folkhogskola.nu/images/a10_over.gif'
	document.getElementById('si14').src='/styles/www.folkhogskola.nu/images/a14_over.gif'
    document.getElementById('si18').src='/styles/www.folkhogskola.nu/images/a18_over.gif'
}



function notOverSpecial2()
{	
	document.getElementById('linktop-1').src='/styles/www.folkhogskola.nu/images/imglyssna.gif'
    //document.getElementById('imageMenuTag-1').src='/styles/www.folkhogskola.nu/images/imglyssna.gif'
}
function overSpecial2()
{	
	document.getElementById('linktop-1').src='/styles/www.folkhogskola.nu/images/imglyssna_over2.gif'
    //document.getElementById('imageMenuTag-1').src='/styles/www.folkhogskola.nu/images/imglyssna_over2.gif'
}
