// popup v0.2 by Romain Laurent
// http://www.romainlaurent.com
function initPopup () {
var tabA = document.getElementsByTagName('a');
var tabAlength = tabA.length;
for(var i = 0 ; i < tabAlength ; i++) {
if (tabA[i].getAttribute('rel') && (tabA[i].getAttribute('rel') == 'popup')) {
tabA[i].onclick = openPopup;
}
}
}
function openPopup () {
var url = this.href;
var dim = this.getAttribute('dim').split(';');
var w = dim[0];
var h = dim[1];
var posX = (screen.width - w) / 2;
var posY = (screen.height - h) / 2;
var n = (this.getAttribute('name') == null)?'name':this.getAttribute('name');
var newwindow = window.open(url, n, 'height=' + h + ',width=' + w + ',top=' + posY + ',left=' + posX + ',scrollbars=1');
if (window.focus) {
newwindow.focus();
}
return false;
}
function launchPopup (url, xname, width, height) {
xtop = (screen.height - height) / 2;
xleft = (screen.width - width) / 2;
var popup = window.open(url,xname,'width='+width+',height='+height+',top='+xtop+',left='+xleft);
if (window.focus) {
popup.focus();
}
return false;
}