// 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;

  var suche = url.indexOf('?');
  if (suche == -1) {
  	url = url + '?popup=true';
  } else {
   	url = url + '&popup=true';
  }

  w = (w) ? w += 20 : 600;
  h = (h) ? h += 25 : 400;
  var args = 'width='+w+',height='+h+',resizable,scrollbars';
  popdown();
  pop = window.open(url + '', '',args);
  return (pop) ? false : true;
}

function openInParent(obj) {
	var url = (obj.getAttribute) ? obj.getAttribute('href') : obj.href;
	if (!url) return true;

	opener.location = url;

	return false;
}

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