resExt.addEventHandler(window,"resize",function() {
    try {
        if ( document.getElementById("pdfFrame") ) {
            if ( window.innerHeight ) {
                document.getElementById("pdfFrame").style.height = window.innerHeight + "px";
            } else {
                document.getElementById("pdfFrame").style.height = document.body.clientHeight + "px";
            }
            document.getElementById("text_inner").style.height = pdfFrame.style.height;
        }//if
    } catch(e) {}
});


resExt.addEventHandler(window,"load",function() {
    var anchors = document.getElementsByTagName("a");
    for ( var c = 0; c < anchors.length; c++ ) {
        if ( /^open:/.test(anchors[c].innerHTML) ) {
            var number = document.getElementsByTagName("span").length;
            var span = document.createElement("span");
                span.className="pdfFile";
                span.id = "pdfFile" + number;
                span.style.display = "block";
                span.style.position = "relative";
                span.style.width = "750px";
            
            var pdfFrame = document.createElement("iframe");
                pdfFrame.style.position = "relative";
                pdfFrame.style.width = "750px";
                pdfFrame.style.border = "solid 1px #EDEDED";
                pdfFrame.style.position = "absolute";
                pdfFrame.style.top = "15px";
                pdfFrame.style.left = "0px";

                try {
                    if ( window.innerHeight ) {
                        pdfFrame.style.height = window.innerHeight + "px";
                        span.style.height = (window.innerHeight + 15) + "px";
                    } else {
                        pdfFrame.style.height = document.body.clientHeight + "px";
                        span.style.height = (document.body.clientHeight + 15) + "px"; 
                    }
//		    document.getElementById("text_inner").style.border = "solid 1px #ff0000";
                    document.getElementById("text_inner").style.height = (document.getElementById("text_inner").offsetHeight + parseInt(pdfFrame.style.height) + 19) + "px";
		    if ( resExt.isIE() ) document.getElementById("text_inner").style.paddingTop = "19px";
                } catch(e) { }

                pdfFrame.src = anchors[c].href;
                pdfFrame.id = "pdfFrame" + number;


            var anchor = anchors[c].parentNode.replaceChild(span,anchors[c]);
                anchor.innerHTML = anchor.innerHTML.replace(/^open:/,"Download: ");
                anchor.innerHTML = anchor.innerHTML.replace(/(\(|\))/g,"");
                anchor.style.display = "block";
                anchor.style.position = "absolute";
                anchor.style.top = "0px";
                anchor.style.right = "0px";
                anchor.style.height = "15px";
                anchor.style.backgroundColor = "#ededed";
                anchor.style.textDecoration = "none";
                anchor.style.color = "#000000";
                anchor.style.paddingLeft = anchor.style.paddingRight = "3px";
		anchor.target = "_blank";

            span.appendChild(anchor);
            span.appendChild(document.createElement("br"));
            span.appendChild(document.createElement("br"));
            span.appendChild(pdfFrame);
        }//if
    }//for
});
