if (	window['sMenuName'] + "" == "" || window['sMenuName'] + "" == "undefined" || sMenuName + "" == ""|| sMenuName + "" == "undefined" )
{	
	sMenuName = 'oCMenu'
}

function cm_checkScrolled(obj)
{
	if(bw.ns4 || bw.ns6) obj.scrolledY=obj.win.pageYOffset
	else obj.scrolledY=obj.win.document.body.scrollTop
	if(obj.scrolledY!=obj.lastScrolled)
	{	if(!obj.useframes)
		{	self.status=obj.scrolledY
			if(obj.scrolledY>119)
			{	for(i=0;i<obj.l[0].num;i++)	{	var sobj=obj.l[0].o[i].oBorder; sobj.moveY(obj.scrolledY)}
				if(obj.usebar) obj.oBar.moveY(obj.scrolledY)}
			else
			{	for(i=0;i<obj.l[0].num;i++){	var sobj=obj.l[0].o[i].oBorder;sobj.moveY(obj.fromtop)}
				if(obj.usebar) obj.oBar.moveY(obj.fromtop)}	}
		obj.lastScrolled=obj.scrolledY;page.y=obj.scrolledY;page.y2=page.y2orig+obj.scrolledY
		if(!obj.useframes || bw.ie)
		{ 	clearTimeout(obj.tim); obj.isover=0; obj.hideSubs(1,0)}
	}
	if((bw.ns4 || bw.ns6) && !obj.useframes) setTimeout("cm_checkScrolled("+obj.name+")",200)
}

function lib_bwcheck(){ //Browsercheck (needed)
/*
	this.ver=navigator.appVersion; this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.dom)
	return this
*/	
	this.ver=navigator.appVersion; this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie7=(this.ver.indexOf("MSIE 7.0")>-1 && this.dom)?1:0; //tkj
	this.ie4=(document.all && !this.dom)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6 || this.ie7 //tkj
	this.mac=this.agent.indexOf("Mac")>-1
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.opera6=this.agent.indexOf("Opera 8.51")>-1//Opera
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.dom || this.ie7 || this.opera6) //tkj
	//alert(this.bw)
	return this
	
}
var bw=new lib_bwcheck() //Making browsercheck object
var mDebugging=2 
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
var beenClicked = 0                              //Detects if the menuChoise has been clicked.
var activeLayer = ""                             //Holds the menuChoiseLayer so that we know which layer that has been clicked
var resetActiveLayer = "0"                       //Remember the last menuLayer that was clicked so that we can change back to original color


function onClk(id,nestref, sLink) 
{ 
	// added by hendrik
	id = 'div' + sMenuName + id
	
	// no link
	if ( sLink.indexOf('none') > -1 ) return
	
	// This function handles the OnClick event on a menu item.
	if (ns4) 
    {
		beenClicked = 1
		var lyr = (nestref)? eval('document.'+nestref+'.document.'+id):document.layers[id]
		lyr.bgColor = colorAfterClicked
		if (resetActiveLayer != "0") 
			resetActiveLayer.document.bgColor = colorNormal
	}
	else 
		if (ie4) 
		{
			beenClicked = 1
			activeLayer = document.all[id]
			document.all[id].style.backgroundColor = colorAfterClicked
			document.all[id].style.color = fontColorAfterClicked        
			if (resetActiveLayer != "0") resetActiveLayer.style.backgroundColor = colorNormal
			if (resetActiveLayer != "0") resetActiveLayer.style.color = fontColorNormal       
		}
		resetActiveLayer = activeLayer
}

var oDelay
function onMOv(id,nestref, sName, sDescr, sLink) 
{
	// added by hendrik
	id = 'div' + sMenuName + id
	
	// Define the "over layer". 	
	if ( ns4 ) {	overLayer = document.layers[nestref].document.layers[id]}
	else if ( ie4) {	overLayer = document.all[id]}
	// no link
	if ( sLink.indexOf('none') > -1 ) 
	{	document.all[id].style.backgroundColor = colorNormal
		document.all[id].style.cursor = 'Default'	}
}

function onMOut(id,nestref, sLink) 
{ 
	// added by hendrik
	id = 'div' + sMenuName + id
	
	// no link
	if ( sLink.indexOf('none') > -1 ) return

	// This function handles the OnMouseOut event on a menu item.
	if (ns4) 
	{
		if (beenClicked=="1" || activeLayer==document.layers[nestref].document.layers[id])
		{
			activeLayer = document.layers[nestref].document.layers[id]
			var lyr = (nestref)? eval('document.'+nestref+'.document.'+id):document.layers[id]
			lyr.document.bgColor = colorAfterClicked
			beenClicked = "0"
		}
	}
	else 
	if (ie4) 
	{
		if (beenClicked=="1" || activeLayer==document.all[id])
        {
			document.all[id].style.backgroundColor = colorAfterClicked
			document.all[id].style.color = fontColorAfterClicked
			activeLayer = document.all[id]
			beenClicked = "0"	}
		if ( activeLayer != overLayer && overLayer != document.all[id]){	overLayer.style.backgroundColor = colorNormal}
    }
}


function setStartValues(nCatID)
{
    // Define the active layer.
    if ( ns4 && nCatID != '' ) activeLayer = document.layers[vCat[nCatID] +'b'].document.layers[vCat[nCatID]]
    if ( ie4 && nCatID != '' ) activeLayer = document.all[vCat[nCatID]]

    // Define the over layer
    overLayer = null

    // Set the colors for the active layer
    if (ie4 && activeLayer ) 
	{ 
		activeLayer.style.backgroundColor = colorAfterClicked
		activeLayer.style.color = fontColorAfterClicked
	}
    if (ns4 && activeLayer.document ) {	activeLayer.document.bgColor =  colorAfterClicked}

}



	window[sMenuName]=new makeCoolMenu(sMenuName) 
	window[sMenuName].useclick=0	
	window[sMenuName].useNS4links=1 
	window[sMenuName].checkselect=0
	window[sMenuName].offlineUrl="file:///C|/Inetpub/wwwroot/granitt/scripts/"
	window[sMenuName].onlineUrl="http://www.granitt.no/scripts/"
	window[sMenuName].pagecheck=1
	window[sMenuName].checkscroll=1
	window[sMenuName].resizecheck=1 
	window[sMenuName].wait=1000 
	window[sMenuName].menuplacement=0
	window[sMenuName].barwidth="menu" 
	window[sMenuName].barheight="menu" 
	window[sMenuName].barx="menu" 
	window[sMenuName].bary="menu"
	window[sMenuName].barinheritborder=0 
	window[sMenuName].usebar=1
	window[sMenuName].barcolor="#ffffff" 	
	for ( i = 0; i<10; i++)
	{
		window[sMenuName].level[i]=new Array() 
		window[sMenuName].level[i].NS4font="verdana,arial,helvetica"
		window[sMenuName].level[i].NS4fontSize="1"
		window[sMenuName].level[i].NS4fontColor="black"
		window[sMenuName].level[i].border=1 		
		window[sMenuName].level[i].bgcoloroff=colorNormalSub
		window[sMenuName].level[i].bgcoloron=colorHoverSub 
		window[sMenuName].level[i].textcolor=fontColorNormalSub 
		window[sMenuName].level[i].hovercolor=fontColorHoverSub 
		// overwritten for i=0 in menusettings2.js
		// all parameters can be overwritten there.
		window[sMenuName].level[i].style="font-family:verdana,arial,helvetica; font-size:10px; font-weight:bold"		
		window[sMenuName].level[i].align="right"					
		window[sMenuName].level[i].offsetX=-6
		window[sMenuName].level[i].offsetY=3
	}
	window[sMenuName].level[0].bgcoloroff=colorNormal
	window[sMenuName].level[0].bgcoloron=colorAfterClicked
	window[sMenuName].level[0].textcolor= fontColorNormal
	window[sMenuName].level[0].hovercolor=fontColorHover
	window[sMenuName].level[0].style="font-family:verdana,arial,helvetica; font-size:11px; font-weight:bold"
