// Once the page has loaded
window.onload = function() {
	fixPdfLinks();
};


// Alter PDF links to use target attribute instead of Javascript to open in a new window (was causing problems in IE)
function fixPdfLinks() {
	// Find all links on the page
	var node_list = document.getElementsByTagName("a");
	
	for (var i = 0; i < node_list.length; i++) {
		var node = node_list[i];

		if (node.getAttribute("href") != undefined && node.getAttribute("href") != null) {
			if (node.getAttribute("href").indexOf("pdf") > -1) { // Find all PDF links
				node.setAttribute("target", "_blank"); // Set target to open in new window
				if (node.getAttribute("onclick") != undefined && node.getAttribute("onclick") != null)
					node.removeAttribute("onclick"); // Remove onclick action
			}
		}
	}
}