// Function to parse all anchor tags, and automatically make those that have a class of 'newWin' open in a new window
var parsePopups = function() {
	if (console.info) { console.info("Parsing popup links") }
	var x = document.getElementsByTagName("a");
	//console.log("Found "+x.length+" links on this page");
	for (var i=0; i<x.length; i++) {
		if (x[i].className.indexOf('newWin') > -1) {
			// This anchor is a 'popup' class
			x[i].onclick = function() {
				return winPop(this.href)
			}
			//console.debug("Changed link to "+x[i].href);
			if (console.count) { console.count("Links change to popups:") }
		}
	}
}
dojo.addOnLoad(parsePopups); // Use dojo to initialize

var winPop = function(url) {
	newWin = window.open(url, 'crescendo_pop'); // Pop a new window
	if (window.focus) { newWin.focus() } // Focus on it if possible
	return false; // Keep from following standard href of link
}
