    function open_image(bilde,width,height, type) {
	var scroll="no";
	if (height > (screen.height-80)){
		fromtop = 0;
		height = screen.height-80;
		scroll = "yes";
	}else{
		fromtop = Math.round((screen.height-height)/2);
	}
	if (width > screen.width-13){
		fromleft = 0;
		width = screen.width-13;
		if (scroll = "no"){
			scroll = "yes";
			if ((height + 16) > (screen.height-80))
				height = screen.height-80;
			else
				height = height + 16;
		}
	}else{
		fromleft = Math.round((screen.width-width)/2);
		if (scroll == "yes")
			width = width + 16
	}
	attrib = "width="+width+",height="+height+",left="+fromleft+",top="+fromtop+",scrollbars="+scroll;
	if (type == 1){
		window.open(bilde,"",attrib);
	}else{
		window.open("ShowImage.php?image="+bilde,"",attrib);
	}
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;}}
function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];}}}
var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		lasit1_over = newImage("images/lasit-over.gif");
		lasit2_over = newImage("images/lasit-over.gif");
		lasit3_over = newImage("images/lasit-over.gif");
		preloadFlag = true;}}

var navShown=false;
var navFade=null;
var NNN=(document.layers)?true:false;
var NIE=(document.all)?true:false;
var nameShown = "";

function getReal(xy){
NS4=(document.layers);IE4=(document.all);
if(IE4){
Pos=(xy=="x")?this.offsetLeft:this.offsetTop;
tmpEl=this.offsetParent;
while(tmpEl!=null){
Pos+=(xy=="x")?tmpEl.offsetLeft:tmpEl.offsetTop;
tmpEl=tmpEl.offsetParent;
}
}else{
Pos=eval("this."+xy);
}
return Pos;
}

function hideNav()
{
        if (navFade) {
                clearTimeout(navFade);
                navFade=null
        }
        if(navShown) {
                if (NNN){
                        document.layers["id"+nameShown].visibility="hide";
                }else if (NIE){
                        document.all["id"+nameShown].style.visibility="hidden";
                }
        }
        navShown=false;
        nameShown="";
        return true;
}

function showNav(name,X,Y)
        {
        if (navFade) {
                clearTimeout(navFade);
                navFade=null
        }
        if(nameShown!=name)
        {
                X+=Math.round(((NNN)?window.innerWidth-16:((NIE)?document.body.clientWidth:0))/2)-400;
                if (navShown) hideNav();
                if (NNN) {
                        document.layers["id"+name].top=Y;
                        //lft_eval='lft=document.layers["i_'+name+'"].X';
                        //eval(lft_eval);
                        //alert(lft);

document.layers["id"+name].left=document.images["i_"+name].x;
                        document.layers["id"+name].visibility="show";
                }else if (NIE){
                        document.all["m"+name].getReal=getReal;
                        document.all["id"+name].style.top=Y;
                        document.all["id"+name].style.left=document.all["m"+name].getReal("x");
                        document.all["id"+name].style.visibility="visible";
                }
                nameShown = name;
        }
        if(NNN)
                navFade=setTimeout("hideNav();",400);
        navShown=true;
        return true;
}
function closeNav()
{
        navFade=setTimeout("hideNav();",400);
//        hideNav();
        return true;
}
function mouse_up (e)
{
        closeNav();
        return true;
}
if (NNN) {
        window.onmouseup=mouse_up;
        window.captureEvents(Event.MOUSEUP);
}
