
	function openWindow(url, name, pos) {
		
		if (window.screen) {
			var hig, wid, ah, aw;
			
			if(pos == 'right') {
				hig=600; wid=550; ah=0;
			  aw = screen.availWidth - wid - 10;
			}else if (pos == 'center'){
				hig=750; wid=800; ah=100;
			  aw = 150;
			}else{
				return;
			}
			var str = "scrollbars,left=" + aw;
			str += ",screenX=" + aw;
			str += ",top=" + ah;
			str += ",screenY=" + ah;
	
		  str += ",height=" + hig;
		  str += ",innerHeight=" + hig;
		  str += ",width=" + wid;
		  str += ",innerWidth=" + wid;
	
	 		newWin = window.open(url, name, str);
			newWin.focus();
		}			
	}
	
	//============================================================================
	//Navn:     popup_open
	//
	//Formål:   Rutine for å åpne et popup vindu
	//			Setter window.opener i det nye vinduet til kallende vindu
	//
	//Parametre:     
	//           iStrURL	(I)	URL til vindu som skal åpnes
	//           iIntHeight	(I)	Høyden på det nyåpnede vinduet
	//           iIntWidth  (I)	Bredden på det nyåpnede vinduet
	//
	//============================================================================
	
	function popup_open(iStrURL,iIntHeight,iIntWidth, iStrTarget, ilngLeft, ilngTop) {
	  if(!iStrTarget) iStrTarget = "_blank";
	  if(!ilngLeft) ilngLeft = "0";
	  if(!ilngTop) ilngTop = "25";
	  
	  myRemote = open(iStrURL , iStrTarget, 
		"height="+iIntHeight+",width="+iIntWidth+",Left=" + ilngLeft + ",top=" + ilngTop + ",channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,scrollbars=yes,resizable=yes,status=0,toolbar=0", "myWindow");
	  if(myRemote){
		if (myRemote.opener == null) 
		  myRemote.opener = window;
	  }
	}
	
	function popup_open_scroll(iStrURL,iIntHeight,iIntWidth) {
	  iStrTarget = "prodnr";
	  ilngLeft = "0";
	  ilngTop = "25";
		var lngLeft;
		var lngTop;
		
		var screenWidth = screen.width;
		var screenHeight = screen.height;	
		
		lngLeft = (Number(screenWidth) - Number(iIntWidth)) / 2
		lngTop = (Number(screenHeight) - Number(iIntHeight)) / 2
	  
	  myRemote = open(iStrURL , iStrTarget, 
		"height="+iIntHeight+",width="+iIntWidth+",Left=" + lngLeft + ",top=" + lngTop + ",channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,scrollbars=yes,resizable=no,status=0,toolbar=0", "myWindow");
		myRemote.focus();
	  if(myRemote){
		if (myRemote.opener == null) 
		  myRemote.opener = window;
	  }
	}
	
	function makeUID() {
		var uid = new Date();
		return uid.getMilliseconds()
	}
	
	function popup_visbilde(iStrURL){
		var iIntWidth = 900;
		var iIntHeight = 700;

		var lngLeft;
		var lngTop;
		
		var screenWidth = screen.width;
		var screenHeight = screen.height;	
		
		lngLeft = (Number(screenWidth) - Number(iIntWidth)) / 2
		lngTop = (Number(screenHeight) - Number(iIntHeight)) / 2
		
		if ( iStrURL.indexOf('?') == -1 ) {
			iStrURL = iStrURL + "?uid=" + makeUID();
		} else {
			iStrURL = iStrURL + "&uid=" + makeUID();
		}
		popup_open(iStrURL, iIntHeight, iIntWidth, "visbilde" , lngLeft, lngTop);
		
	}

