function NewWindow(mypage,myname,w,h,s,r){
	LeftPos = (screen.width) ? (screen.width-w)/2 : 0;
	TopPos = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPos+',left='+LeftPos+',scrollbars='+s+',resizable='+r+',status=yes';
	win = window.open(mypage,myname,settings);
}
/* init valid popup and external windows */
function windowLinks() {
    if(!document.getElementsByTagName) {
         return;
    }
    var anchors = document.getElementsByTagName('a');
    for (var i = 0; i < anchors.length; i++) {
         var anchor = anchors[i];
         var relIndex = anchor.rel;
		 if (relIndex){
		 var relSplit = relIndex.split('|');
		 /* XHTML compliant target attribute */
		 if (relSplit[0] == 'external') {
            anchor.target = '_blank';
			anchor.className = 'external';
			anchor.title = 'Load in new window: '+ anchor.href;
			/* XHTML compliant popup attribute */
   		} else if (relSplit[0] == 'popup') {
			if (anchor.className == '' && anchor.title == '') {
			  anchor.className = 'popup';
			  anchor.title = 'Link loads in Popup Window';
			}
			anchor.popupWidth = relSplit[1];
			anchor.popupHeight = relSplit[2];
			/* added the ablitity to have resize or scroll */
			anchor.popupScroll = relSplit[3];
			anchor.popupResize = relSplit[4];
	        anchor.onclick = function() {
				NewWindow(this.href,'',this.popupWidth,this.popupHeight,this.popupScroll,this.popupResize);return false;
			   };
			}
		}
	}
}
addLoadListener(windowLinks);