// This function intercepts all PDF clicks and clicks for sites external to the DCA, they are then launched in a new window. function dcaPop(){ // v1.0 | www.TJKDesign.com var e = document; if (e){ var a=e.getElementsByTagName("a"); for (var i=0;i= 0) { if(a[i].title) { a[i].title += " please note this document will open in a new window"; } else { a[i].title += "PDF document please note this document will open in a new window"; } var rand = Math.round((Math.random() * 10000)); a[i].onclick=function(){newWin=window.open(this.href,rand);if(window.focus){newWin.focus()} return false;} a[i].onkeypress=function(){newWin=window.open(this.href,rand);if(window.focus){newWin.focus()} return false;} } // now test for external web links, also disclude any DCA links else if (a[i].getAttribute('href') != null && a[i].getAttribute('href').indexOf("http://www") >= 0 && a[i].getAttribute('href').indexOf("dca.gov.uk") == -1 && a[i].getAttribute('href').indexOf("foi.gov.uk") == -1){ a[i].title += " please note this site will open in a new window"; var rand = Math.round((Math.random() * 10000)); a[i].onclick=function(){newWin=window.open(this.href,rand);if(window.focus){newWin.focus()} return false;} a[i].onkeypress=function(){newWin=window.open(this.href,rand);if(window.focus){newWin.focus()} return false;} } } // end for } // end if } function highlightButton() { if(document.getElementById("leftDiv")) { var page = window.location.href; var navElements = document.getElementById("leftDiv").getElementsByTagName("a"); var tmpPaths = page.split("/"); var currentPath = ""; for(i=0; i<= navElements.length-1; i++) { if(page.indexOf(navElements[i].href) >= 0) { navElements[i].style.fontWeight = "bold"; break; } } } } window.onload = function() { dcaPop(); highlightButton(); }