<!--
/* This script copyrighted 2000 to Marcus Fridholm.
   You may use it freely as long as you do not delete this copyright notice.
   contacts: marcus@widham.se url: www.widham.se
   This script is provided as is, suggestions and feedback are welcome however. */ 
        
var ns=(document.layers);
var ie=(document.all);
var future=((document.getElementById) && (!navigator.userAgent.indexOf('Opera') != -1));
var old=(parseInt(navigator.appVersion) <=3);

function makeCss(){
	this.textColor = "#FFFFFF";
	this.textHover = "#537C42";
	this.menuFont = "Verdana, Arial, Geneva, Helvetica, sans-serif";
	this.menuFontSize = '8';
	this.writeCss = writeCss;
}

var myCss = new makeCss( );

function makeMenu(idref,labelText, itemZ){
	this.idref = idref;
	this.labelText = labelText;
	this.itemZ = itemZ;

	this.posTop = '0';
	this.posLeft = '0';

	this.itemWidth = '100';
	this.itemHeight = '20';
	
	this.addMenuItem = addMenuItem;
	this.writeMenu = writeMenu;
	this.showMenu = showMenu;
	this.hideMenu = hideMenu;
	this.items = new Array( );
	this.subTarget = new Array( );
	this.subUrl = new Array( );
}

function addMenuItem(subLabel,subUrl,subTarget){
	this.items[this.items.length] = subLabel;
	this.subUrl[this.subUrl.length] = subUrl;
	this.subTarget[this.subTarget.length] = subTarget;
}

function writeMenu( ){
	var myHtmlRef = "";
	var subHeight = eval((parseInt(this.itemHeight)*parseInt(this.items.length))+10);
	if (ns){
		myHtmlRef += "<layer class=\'menyRubrik\' id=\'"+this.idref;
		myHtmlRef +="\' left=\'"+this.posLeft;
		myHtmlRef +="\' top=\'"+this.posTop;
		myHtmlRef +="\' width=\'"+this.itemWidth;
		myHtmlRef +="\' height=\'"+this.itemHeight;
		myHtmlRef +="\' bgColor=\'"+myCss.bgColor;
		myHtmlRef +="\' z-index=\'"+this.itemZ;
		myHtmlRef +="\' onMouseOver=\'showMenu(\"sub"+this.idref+"\")\'";
		myHtmlRef +=" onMouseOut=\'hideMenu(\"sub"+this.idref+"\")\'>";
		myHtmlRef +="<font color=\'"+myCss.textColor+"\'>";
		myHtmlRef +="&nbsp;"+this.labelText+"</font>";
		myHtmlRef +='</layer>';
		myHtmlRef += "<layer class=\'item\' id=\'sub"+this.idref;
		myHtmlRef +="\' left=\'"+this.posLeft;
		myHtmlRef +="\' top=\'"+eval(parseInt(this.posTop)+parseInt(this.itemHeight));
		myHtmlRef +="\' width=\'"+this.itemWidth;
		myHtmlRef +="\' height=\'"+subHeight;
		myHtmlRef +="\' bgColor=\'"+myCss.bgColor;
		myHtmlRef +="\' visibility=\'hide\'";
		myHtmlRef +=" z-index=\'"+eval(this.itemZ+1)+"\'";
		myHtmlRef +=" onMouseOver=\'showMenu(\"sub"+this.idref+"\")\'";
		myHtmlRef +=" onMouseOut=\'hideMenu(\"sub"+this.idref+"\")\'>";

		for (var i=0; i<this.items.length; i++) {
 		myHtmlRef += "&nbsp;";
		myHtmlRef += "<a class=\'item\' href=\'"+this.subUrl[i]+"\' target=\'"+this.subTarget[i]+"\'>";
		myHtmlRef += "<font color=\'"+myCss.textColor+"\' face=\'"+myCss.menuFont+"\'>";
		myHtmlRef += this.items[i]+"</font></a><br>";
		}
		myHtmlRef += "</layer>";
				
	}else if( ie || future ){
		myHtmlRef += "<div id=\'"+this.idref;
		myHtmlRef +="\' class=\'menyRubrik\' style=\'position: absolute;";
		myHtmlRef +=" left: "+this.posLeft+";";
		myHtmlRef +=" top: "+this.posTop+";";
		myHtmlRef +=" width: "+this.itemWidth+";";
		myHtmlRef +=" height: "+this.itemHeight+";";
		myHtmlRef +=" z-index: "+this.itemZ+";\'";
		myHtmlRef +=" onMouseOver=\'showMenu(\"sub"+this.idref+"\")\'";
		myHtmlRef +=" onMouseOut=\'hideMenu(\"sub"+this.idref+"\")\'>";
		myHtmlRef +="&nbsp;"+this.labelText;
		myHtmlRef +="</div>";
		myHtmlRef += "<div  class=\'item\' id=\'sub"+this.idref;
		myHtmlRef +="\' style=\'position: absolute;";
		myHtmlRef +=" left: "+this.posLeft+";";
		myHtmlRef +=" top: "+eval(parseInt(this.posTop)+parseInt(this.itemHeight))+";";
		myHtmlRef +=" width: "+this.itemWidth+";";
		myHtmlRef +=" height: "+subHeight+";";
		myHtmlRef +=" background-color: "+myCss.bgColor+";";
		myHtmlRef +=" visibility: hidden;";
		myHtmlRef +=" z-index: "+eval(this.itemZ+1)+";\'";
		myHtmlRef +=" onMouseOver=\'showMenu(\"sub"+this.idref+"\")\'";
		myHtmlRef +=" onMouseOut=\'hideMenu(\"sub"+this.idref+"\")\'>";
		myHtmlRef +="<span style=\'height: 4px; font-size: 2pt;\'>&nbsp;</span>";

		for (var i=0; i<this.items.length; i++) {
		
 		myHtmlRef += "<a href=\'"+this.subUrl[i]+"\' class=\'item\' target=\'"+this.subTarget[i]+"\'>";
		myHtmlRef += "<span style=\'width:"+this.itemWidth+"\'>&nbsp;"
		myHtmlRef += this.items[i]+"</span></a><br>";
            }
		myHtmlRef += "</div>";
		
	}

         document.write(myHtmlRef);
}

function showMenu(lyr){
	if (ns) eval("document.layers['"+lyr+"'].visibility='show'");
	if (ie) eval(lyr+".style.visibility='visible'");
	if (future) eval("document.getElementById('"+lyr+"').style.visibility='visible'");
}

function hideMenu(lyr){
	if (ns) eval("document.layers['"+lyr+"'].visibility='hide'");
	if (ie) eval(lyr+".style.visibility='hidden'");
	if (future) eval("document.getElementById('"+lyr+"').style.visibility='hidden'");
}

function writeCss(){
var newCss = "<style type='text/css'> \n";
	newCss += "<!-- \n";
	newCss += "A.item { \n";
	newCss += "font-family: "+myCss.menuFont+";\n"; 
	newCss += "font-size: "+eval(parseInt(this.menuFontSize))+"pt; \n"; 
	newCss += "font-weight: normal; \n"; 
	newCss += "color: "+this.textColor+"; \n";
	newCss += "background-color: "+this.bgColor+"; \n"; 
	newCss += "text-decoration: none; \n";
	if (ie || future) newCss += "cursor: hand \n";
	newCss += "} \n";
	newCss += ".menyRubrik { \n"; 
	newCss += "font-family: "+this.menuFont+"; \n"; 
	newCss += "font-size: "+this.menuFontSize+"pt; \n"; 
	newCss += "font-weight: bold; \n"; 
	newCss += "color: "+this.textColor+"; \n";
	newCss += "background-color: "+this.bgColor+"; \n";
	if (ie || future) newCss += "cursor: hand \n";
	newCss += "} \n";
	newCss += "A.item:link { \n";  
	newCss += "text-decoration: none \n";
	newCss += "} \n";
	newCss += "span.item:visited { \n";  
	newCss += "text-decoration: none \n";
	newCss += "} \n";
	newCss += "A.item:hover { \n"; 
	newCss += "text-decoration: none ; \n"; 
	newCss += "color: "+this.textHover+"; \n";
	newCss += "background-color: "+this.bgHover+"; \n";
	newCss += "} \n";
	newCss += "--> \n";
	newCss += "</style> \n";

document.write(newCss);
}

// -->
