// popup generator  - "new window"
var win = null;
function NewWindow(mypage,myname,w,h,scroll) {
 LeftPosition=20;
 TopPosition=10;
/*	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0; */
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
	win = window.open(mypage,myname,settings);
	if(win.window.focus){win.window.focus();}
}

// popup  - "change page"
function changePage()
 {
   var f = document.forms.navigation;
   var uri = f.pages.options[f.pages.selectedIndex].value;
   newPage =
  // These settings describe the pop-up browser
   window.open(uri,"new","height=560,width=640,menubar=yes,location=no,scrollbars=yes,toolbar=no,resizable=no,status=no");
  }

// popup  - "open study in new window"
function openStudy()
  {
   window.open('','new','height=560,width=640,menubar=yes,location=no,scrollbars=yes,toolbar=no,resizable=no,status=no');
  }
  
// Script by Thomas Stich
// http://www.stichpunkt.de/beitrag/popup.html
// use it if you like it
// 
// <a href="html-or.jpg" onclick="return popup(this,123,456)" title="..."
// or
// <a href="html-or.jpg" onclick="return popup(this)" title="..."


var pop = null;

function popdown() {
  if (pop && !pop.closed) pop.close();
}

function popup(obj,w,h) {
  var url = (obj.getAttribute) ? obj.getAttribute('href') : obj.href;
  if (!url) return true;
  w = (w) ? w += 20 : 480;  // 150px*150px is the default size
  h = (h) ? h += 25 : 520;
  var args = 'width='+w+',height='+h+',resizable';
  popdown();
  pop = window.open(url,'',args);
  return (pop) ? false : true;
}

window.onunload = popdown;
window.onfocus = popdown;

