/**
 * Transforms alls link in the current page that contain the given class name
 * so that they pop up in a new window
 *
 * @param string class_name
 */
function links_in_new_window() {
	
	var class_name = 'new_window';
	
	// get all the links in the document
	var links = document.getElementsByTagName('a');
	
	// make the regex
	re = new RegExp('\\b' + class_name + '\\b', "i");
	
	// iterate through the contents of the links array
	for (x = 0; x < links.length; x++) {
		var link = links[x];	
		
		// if the class_name matches, make the link open in a new window
		if (link.className.search(re) != -1) {
			link.target = "_blank";
			
		}		
	}
}

Event.observe(window, 'load', links_in_new_window, false);