// popup generator
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();}
}

// function used on articles contradictions page with dropdown link list 
 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");
   fenster.focus();
  }

// function used on studies page to open study in separate window
 function openStudy(strURL) {
  if (newWin != null && !newWin.closed)
   newWin.close();
  newWin = window.open(strURL,'newWin','height=560,width=640,menubar=yes,location=no,scrollbars=yes,toolbar=no,resizable=no,status=no');
   newWin.focus();
  }
// use this as follows:
//<!-- <a href="my-pop-up-window.htm"
// onclick="openStudy(this.href);return false;"
// target="_blank">This is my link</a> -->



// 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 += 20 : 600;
  var args = 'width='+w+',height='+h+',resizable,scrollbars';
  popdown();
  pop = window.open(url,'',args);
  return (pop) ? false : true;
}

// window.onunload = popdown;
// window.onfocus = popdown;

