/* This is our current popup function - parts of the site still use it, so I need to keep it */

function acpopup(strURL,winName,strHeight,strWidth) {
    var strOptions="";
    strOptions="toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,height="+strHeight+",width="+strWidth;
    newwindow = window.open(strURL, 'win'+winName, strOptions);
    if (window.focus) {newwindow.focus()}
}

/* new accessible, unobtrusive popup code */

function windowLinks() {                      // create a new function called windowLink(); 
    if(!document.getElementsByTagName) {      // Only run the function on browsers that
         return;                              // understand 'getElementsByTagName' - new browsers
    }
	
    var anchors = document.getElementsByTagName("a"); // grab all links and pop them in an array called 'anchors'
    for (var i = 0; i < anchors.length; i++) {        // start a loop to work our way through 
         var anchor = anchors[i];                     // grab the next link & copy it to 'anchor' for working
         var relIndex = anchor.rel;                   // get the value of it's 'REL' attribute
		 if (relIndex){                               // does it have a value for REL?...
		 var relSplit = relIndex.split(":"); 
		 /* if it does, look for ':' to use to split the value into an 
		 array - relSplit[0], relSplit[1], relSplit[2], etc . If it doesn't 
		 find any ':', the whole value gets transferred to relSplit[0] */
		 linkType = relSplit[0];

        if (linkType != "" ) { /*add a class name for all anchors*/
            anchor.className += " "+linkType; 
        }
        
        if (linkType == "external" ) {            
            anchor.target = "_blank";              
			anchor.title = "Load in new window: "+ anchor.href;
		
		} else if (linkType == "media") {
            anchor.title = "Loads in a Popup Window";
            //anchor.popupWidth = relSplit[2];            // set the popup's width
            //anchor.popupHeight = eval(relSplit[1])+30;           // set the popup's height
            anchor.onclick = function() {
                //acpopup(this.href,'media',this.popupHeight,this.popupWidth);
                acpopup(this.href,'media','400','400');
                return false;
                };
		                        
        } else if (linkType == "close") {
            anchor.title = "Close this Window";
            anchor.onclick = function() {
                window.close();
                };
        }
    }
    }
} 

addLoadListener(windowLinks);

  