﻿$().ready(function () {
    $("#ctl00_print_it").click(function() {
        printPage();
    });
});

function printPage() {
    var url = document.location;
    var urlParts = String(url).split('?');
    if (urlParts[1] == null) {
        url = url + "?printmode=1";
    }
    else {
        url = url + "&printmode=1";

    }

    //alert("print" + url)

    var printWindow = window.open(url, 'print', 'width=550,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=no,resizable=yes,copyhistory=no');
    //printWindow.focus();
    //printWindow.print();
    //    printWindow.document.on
    //    
    //    printWindow.print();
    //printWindow.close();
};


//function printPartOfPage(elementId) {

//    var printContent = document.getElementById(elementId);
//    var printWindow = window.open('', 'print', 'left=50000, top=50000, width=10, height=10');
//    printWindow.document.write("<html><head>");
//    printWindow.document.write('<link href="/css/htmlparts/table_form.css" rel="stylesheet" type="text/css" />');
//    //printWindow.document.write('<link href="/css/htmlparts/table_window.css" rel="stylesheet" type="text/css" />');
//    //printWindow.document.write('<link href="/associations/terralex01/css/layouts.css" rel="stylesheet" type="text/css" />');
//    printWindow.document.write('<link href="/App_Themes/Office2003%20Blue/GridView/styles.css" rel="stylesheet" type="text/css" />');
//    printWindow.document.write("</head>");
//    printWindow.document.write("<body>");
//    printWindow.document.write(printContent.innerHTML);
//    printWindow.document.write("</body></html>");
//    printWindow.document.close();
//    printWindow.focus();
//    printWindow.print();
//    printWindow.close();

//}

//function loadjscssfile(filename, filetype, document1) {
//    if (filetype == "js") { //if filename is a external JavaScript file
//        var fileref = document1.createElement('script')
//        fileref.setAttribute("type", "text/javascript")
//        fileref.setAttribute("src", filename)
//    }
//    else if (filetype == "css") { //if filename is an external CSS file
//        var fileref = document1.createElement("link")
//        fileref.setAttribute("rel", "stylesheet")
//        fileref.setAttribute("type", "text/css")
//        fileref.setAttribute("href", filename)
//    }
//    if (typeof fileref != "undefined")
//        document1.getElementsByTagName("head")[0].appendChild(fileref)
//}

//loadjscssfile("myscript.js", "js") //dynamically load and add this .js file
//loadjscssfile("javascript.php", "js") //dynamically load "javascript.php" as a JavaScript file
//loadjscssfile("mystyle.css", "css") ////dynamically load and add this .css file


//function Clickheretoprint() {
//    var disp_setting = "toolbar=yes,location=no,directories=yes,menubar=yes,";
//    disp_setting += "scrollbars=yes,width=650, height=600, left=100, top=25";
//    var content_vlue = document.getElementById("article").innerHTML;

//    var docprint = window.open("", "", disp_setting);
//    docprint.document.open();
//    docprint.document.write('<html><head><title>HOW TO REORGANISE A BUSINESS IN THE NETHERLANDS</title>');
//    docprint.document.write('</head><body onLoad="self.print()">');
//    docprint.document.write(content_vlue);
//    docprint.document.write('</body></html>');
//    docprint.document.close();
//    docprint.focus();
//}

