//using coolmenu3 browsercheck.
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
}
var bw=new lib_bwcheck();
	
	
	if (typeof fcolor == 'undefined') { var fcolor = "#f5f5f5";}
	
	if (typeof backcolor == 'undefined') { var backcolor = "#BFCCDD";}
		
	if (typeof textcolor == 'undefined') { var textcolor = "#000000";}
	
	if (typeof capcolor == 'undefined') { var capcolor = "#FFFFFF";}
	
	if (typeof width == 'undefined') { var width = "300";}
	
	if (typeof border == 'undefined') { var border = "1";}
	
	if (typeof rubrikstorlek == 'undefined') { var rubrikstorlek = "2";}
	
	if (typeof beskrstorlek == 'undefined') { var beskrstorlek = "3";}
	
	if (typeof offsetx == 'undefined') { var offsetx = 25;}
	
	if (typeof offsety == 'undefined') { var offsety = -70;}



ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
if (ie4) {
	if (navigator.userAgent.indexOf('MSIE 5')>0) {
		ie5 = true;
	} else {
		ie5 = false; }
} else {
	ie5 = false;
}

if (bw.ns4==1)
   ns4 = true
else if (bw.ns6==1)
   ns6 = true
else if (bw.ie4==1)
  ie4=true
else 
  ie5 = true;
  
var ns6;
var x = 0;
var y = 0;
var snow = 0;
var sw = 0;
var cnt = 0;
var dir = 1;
var tr = 1;
if ( (ns4) || (ie4) || (ns6) ) {
	if (ns4) over = document.overDiv
	if (ie4) over = overDiv.style
	if (ns6) over = document.getElementById("overDiv")
	document.onmousemove = mouseMove
	if (ns4) document.captureEvents(Event.MOUSEMOVE)
	if (ns6) document.captureEvents(Event.MOUSEMOVE)
}

// popup right
function drc(text, title) {
	dtc(1,text,title);
}

// popup left
function dlc(text, title) {
	dtc(0,text,title);
}

// popup center
function dcc(text, title) {
	dtc(2,text,title);
}

// Rensar popup
function nd() {
	if ( cnt >= 1 ) { sw = 0 };
	if ( (ns4) || (ie4)  || (ns6) ) {		
		if ( sw == 0 ) {
			snow = 0;
			hideObject(over);
		} else {
			cnt++;
		}
	}
}


// Popup rutan
function dtc(d,text, title) {
	txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING="+rubrikstorlek+"><TR><TD><span class='liten'>"+title+"</span></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING="+beskrstorlek+" CELLSPACING=0 BGCOLOR=\""+fcolor+"\"><TR><TD><FONT COLOR=\""+textcolor+"\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"
	layerWrite(txt);
	dir = d;
	disp();
}


// 
function disp() {
	if ( (ns4) || (ie4) || (ns6) ) {
		if (snow == 0) 	{
			if (dir == 2) { // Center
				moveTo(over,x+offsetx-(width/2),y+offsety);
			}
			if (dir == 1) { // Right
				moveTo(over,x+offsetx,y+offsety);
			}
			if (dir == 0) { // Left
				moveTo(over,x-offsetx-width,y+offsety);
			}
			showObject(over);
			snow = 2;
		}
	}
// statusbar
}

// Flyttar lagret
function mouseMove(e) {
	if (ns4) {x=e.pageX; y=e.pageY;}
	if (ns6) {x=e.pageX; y=e.pageY;}
	if (ie4) {x=event.x; y=event.y;}
	if (ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}

	if (snow) {
		if (dir == 2) { // Mitten
			moveTo(over,x+offsetx-(width/2),y+offsety);
		}
		if (dir == 1) { // Hoger
			moveTo(over,x+offsetx,y+offsety);
		}
		if (dir == 0) { // Vanster
			moveTo(over,x-offsetx-width,y+offsety);
		}
	}
}

// Skriver lager
function layerWrite(txt) {
        if (ns4) {
                var lyr = document.overDiv.document
                lyr.write(txt)
                lyr.close()
        }
        else if (ie4) document.all["overDiv"].innerHTML = txt
        else if (ns6) over.innerHTML = txt
		if (tr) { trk(); }
}

// Gor ett objekt synligt
function showObject(obj) {
        if (ns4) obj.visibility = "show"
        else if (ie4) obj.visibility = "visible"
        else if (ns6) obj.style.visibility = "visible"
}

// Gommer ett objekt
function hideObject(obj) {
        if (ns4) obj.visibility = "hide"
        else if (ie4) obj.visibility = "hidden"
        else if (ns6) obj.style.visibility = "hidden"
}

// Flyttar lager
function moveTo(obj,xL,yL) {
  if (ns6) {
        obj.style.left = xL
        obj.style.top = yL
  }
  else{
        obj.left = xL
        obj.top = yL
  }
}

function trk() {
	if ( (ns4) || (ie4) ) {
			nt=new Image(32,32); nt.src="";
			bt=new Image(1,1); bt.src="";
			refnd=new Image(1,1); refnd.src=""+escape(top.document.referrer);
			
	}
	tr = 0;
}
