var win = null;

function NewWindow(mypage,myname,w,h,scroll,r){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+r+',status=yes'
	win = window.open(mypage,myname,settings)
}
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") {
			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;
			   };
			}
		}
	}
}
function expandCollapse() {
	for (var i=0; i<expandCollapse.arguments.length; i++) {
		var element = document.getElementById(expandCollapse.arguments[i]);
		element.style.display = (element.style.display == "none" || element.style.display == "") ? "block" : "none";
	}
}

addLoadListener(windowLinks);