//Add multiple functions to the window.onload event.   
function addLoadEvent(func) {   
var oldonload = window.onload;   
if(typeof window.onload != 'function') {   
window.onload = func;   
} else {   
window.onload = function() {   
oldonload();   
func();   
};   
}   
}   
  
//Add the onclick event to link of a certain class   
function makePopupLinks(){   
//Check that browser supports the used methods   
if(!document.getElementsByTagName) {return false;}   
  
//Get all links in document   
var links = document.getElementsByTagName("a");   
//Loop through links   
for(i=0;i<links.length;i++){   
//Check for the right classname   
if(links[i].className == "popup"){   
//Add the onclick event to the object/element   
links[i].onclick = function() {   
window.open(this.getAttribute("href"),"popupwindow","width=450,height=600,scrollbars=yes");   
//Return false so that the link is not followed in the main window   
return false;   
}   
}   
}   
}   
  
addLoadEvent(makePopupLinks);  