function TJKpopAppPdf(){
  var zA=document.getElementsByTagName('a');
  var zASize=zA.length;
  for (var i=0; i<zASize; i++){
    // This is if the href value contains the string '.pdf' or if the anchor contains the correct 'type' attribute or if the file is stored in a PDF folder
    if (zA[i].getAttribute('href') != null && (zA[i].getAttribute('type')== 'application/pdf' ||
     zA[i].getAttribute('href') .toUpperCase().indexOf('.PDF') >= 0 ||
     zA[i].getAttribute('href') .toUpperCase().indexOf('PDF/') >= 0)){
     // This is to include a title attribute or attach a string to an existing title's value
     zA[i].title+=' (nyt vindue)';
     // This is to include a class or attach one to an existing class' value
     zA[i].className+=zA[i].className?' pdfFile':'pdfFile';
     // This spawns multiple windows, but works fine with popup blockers
     // zA[i].target='_blank';
     // This opens a unique window and brings it in front of the opener each time the user clicks on the link
     zA[i].onclick=function() {newWin=window.open(this.href,'TJKWin','toolbar=no');
     if( window.focus){newWin.focus()} return false;}
     }
  }
}
$(document).ready(function() {
	TJKpopAppPdf();
});
