/* This handy function from Simon Willison allows you to stack up 'window.onload' events
without them stepping on each other's toes. It's explained here - http://www.sitepoint.com/blog-post-view.php?id=171578 */
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
/* This is our old popup code - parts of the site still use it, so I need to keep it */
function acpopup(strURL,strType,strHeight,strWidth) {
var strOptions="";
if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
window.open(strURL, '', strOptions);
}
/* new accessible, unobtrusive popup code */
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];
anchor.onclick = function() {acpopup(this.href,'console',this.popupWidth,this.popupHeight);return false;};
}
}
}
}
addLoadEvent(function() {
windowLinks();
//otherFunctions();
//goHere();
});