﻿$(document).ready(function() {
    $("#print-button-container").css('display', 'block');
});

function OpenInNewWindow(url) {
    // Change "_blank" to something like "newWindow" to load all links in the same new window
    var newWindow = window.open(url);
    newWindow.focus();
    return false;
}
function PrintPreview() {
    var w = 1000; // <-- dit is een vaste waarde in de print.css van RDW deze is overgenomen
    var h = 768; // <-- TODO: dit mogelijk dynamisch doen?

    wleft = (screen.width - w) / 2;
    wtop = (screen.height - h) / 2;

    if (wleft < 0) {
        w = screen.width;
        wleft = 0;
    }
    if (wtop < 0) {
        h = screen.height;
        wtop = 0;
    }
    var printpreview = window.open('', 'PrintPreview', 'width=' + w + ',height=' + h + ',left=' + wleft + ",top=" + wtop);
    var newHtml = $("html").html().replace(/media=(?:"print"|'print'|print)/g, "");

    printpreview.document.open();
    printpreview.document.write(newHtml);
    printpreview.document.close();
    printpreview.print();
    //$("html").html(oldHtml);

    return false;
}
