function doPopUp(e) {
	var t = "standard";
	var w = "520";
	var h = "720";

	attribs = this.rel.split(" ");
	if (attribs[1]!=null) {t = attribs[1];}
	if (attribs[2]!=null) {w = attribs[2];}
	if (attribs[3]!=null) {h = attribs[3];}

	if(t == "standard") {
		window.open(this.href);
	} else {
		window.open(this.href, 'PopUp', 'scrollbars=no,toolbar=no,status=no,menubar=no,width=' + w + ',height=' + h);
	}

	if (window.event) {
		window.event.returnValue = false;
		window.event.cancelBubble = true;
	} 

	else if (e) {
		e.stopPropagation();
		e.preventDefault();
	}
}

function externalLinks() {
	if (!document.getElementsByTagName)
		return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		if (anchors[i].rel.indexOf("popup")!=-1) {
			anchors[i].onclick = doPopUp;
		}
	}
}

window.onload = externalLinks;
