/**************************************/
/*                                    */
/*  PDF Javascript Opener             */
/*  by Qian Qin                       */
/*  www.qianqin.de                    */
/*                                    */
/*  checks document for links to      */
/*  PDF-files and opens them in new   */
/*  windows without using target      */
/*  attribute, which is not allowed   */
/*  in W3C strict environments.       */
/*                                    */
/**************************************/


function q_addLoadEvent(func) { 
    var oldonload = window.onload; 
    if (typeof window.onload != 'function') { 
        window.onload = func; 
    } else { 
        window.onload = function() { 
            if (oldonload) { 
                oldonload(); 
            } 
            func(); 
        } 
    } 
} 

q_addLoadEvent(q_PDFOpenerInit); 

function q_PDFOpenerInit(){
    for(var i=0;i<document.getElementsByTagName("a").length;i++) {
        var url = String(document.getElementsByTagName("a")[i]);
        var isLinkToPDF = url.match(/[^\/]+.pdf$/);
        if(isLinkToPDF!=null) {
            document.getElementsByTagName("a")[i].onclick = q_openPDF;
        }
    }
}

function q_openPDF() {
    window.open(this.href);
    return false;
}