window.onload = function() {
	if (!document.getElementsByTagName) {						// check to see that the browser supports the getElementsByTagName method, if not, exit the loop
		return false; 
	} 
	var popuplinks = document.getElementsByTagName("a");		// create an array of objects of each link in the document
	for (var i=0; i < popuplinks.length; i++) {					// loop through each of these links (anchor tags)
		if (popuplinks[i].getAttribute("class") == "popup") {	// if the link has a class of "popup"...	
			popuplinks[i].onclick = function() {				// add an onclick event on the fly to pass the href attribute of the link to our second function, openPopUp	
				openPopUp(this.getAttribute("href"));	
				return false; 	
			} 	
		}
	} 
} 

function openPopUp(linkURL) {
	window.open(linkURL,'popup','width=400,height=200')
}