function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(popups);

function popups() {
	var As = document.getElementsByTagName("a");
	for(var i=0; i< As.length; i++) {
		if(As[i].className=="popup") {
			As[i].onclick = function() {
				popup(this.href,970,600);
				return false;
			}
		}
	}
}	

function popup(url, width, height) {
	theWidth = width;
	theHeight = height;
	theTop = Math.ceil((screen.height-theHeight*1.5)/2);
	theLeft = Math.ceil((screen.width-theWidth)/2);
	winopts = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,copyhistory=0,width="+theWidth+",height="+theHeight+",top="+theTop+",left="+theLeft;
	smallwindow=window.open(url,"Popup",winopts);
	smallwindow.focus();
}
