    function open_image(bilde,width,height) {
	var scroll="no";
	height = height + 20;
	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;
	window.open("ShowImage.php?image="+bilde,"",attrib);
}

var preloadFlag = false;

function preloadImages()
{
	if (document.images)
	{
		preloadFlag = true;
		m1_over = newImage("images/sound_on-over.gif");
		m2_over = newImage("images/sound_off-over.gif");
	}
}

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];
		}
	}
}

nWin = null;
function OpenWindow(url, w, h){
 if(nWin && !nWin.closed) nWin.close();
 //--------------
 
  if (self.screen) { // for NN4 and IE4
  width = screen.width
  height = screen.height
 }else if (self.java){ // for NN3 with enabled Java
  var jkit = java.awt.Toolkit.getDefaultToolkit();
  var scrsize = jkit.getScreenSize();
  width = scrsize.width;
  height = scrsize.height;
 }
 //--------------
 
 var top = (height - h) / 2;
 var left = (width - w) / 2;
 
  nWin = window.open(url, "OpenWindow", "width="+ w+", height="+h+", location=0,status=0,resizable=0,toolbar=0,scrollbars=1,menubar=0,top="+top+",left="+left+"");
  nWin.focus(); 
}

