﻿function PrintPage() {    
    window.print();    
}

function PrintTerm(id) {
    
    var termId = "abcTerm_" + id;
    //var termInfo = $('#' + termId).html();

    var da = (document.all) ? 1 : 0;
    var pr = (window.print) ? 1 : 0;

    if (!pr) {
        window.status = "No print";
        return;
    }

    var printArea = document.getElementById(termId);

    if (printArea == null && da)
        printArea = document.all.PrintArea;

    if (printArea) {
        var sStart = "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"/inc/styles/print.css\">\n";
        sStart += "<title>Kommerskollegium - National Board of Trade</title>\n";
        sStart += "</head><body><div class='abcTerm'>";
        sStop = "</div></body></html>";

        var w = window.open('about:blank', 'printWin', 'width=650,height=440,scrollbars=yes');
        wdoc = w.document;
        wdoc.open();
        wdoc.write(sStart + printArea.innerHTML);
        wdoc.writeln(sStop);
        wdoc.close();
        w.print();
        w.close();
    }

    //alert("printar: " + termId);
    //alert(termInfo);
}

function IncreaseFontSize() {

    var shareFontSize = $("#pageFunctions").css("font-size");    

    var fontSize = $("#contentArea").css("font-size");
    var lineHeight = $("#contentArea").css("line-height");

    var newSize = parseInt(fontSize.replace(/px/, "")) + 3;
    var newLineHeight = 1.5;
    if (newSize > 18) {
        //Reset
        newSize = 12;
        newLineHeight = 'normal';
    }

    $("#contentArea").css("font-size", newSize + "px");
    $("#contentArea").css("line-height", newLineHeight);

    //Keep size of Share-functions
    $("#pageFunctions").css("font-size", shareFontSize);
    $("#pageFunctions").css("line-height", 'normal');
}

function DecreaseFontSize() {
    var shareFontSize = $("#pageFunctions").css("font-size");

    var fontSize = $("#contentArea").css("font-size");
    var lineHeight = $("#contentArea").css("line-height");

    var newSize = parseInt(fontSize.replace(/px/, "")) - 3;
    var newLineHeight = 1.5;
    if (newSize <= 12) {
        //Reset
        newSize = 12;
        newLineHeight = 'normal';
    }

    $("#contentArea").css("font-size", newSize + "px");
    $("#contentArea").css("line-height", newLineHeight);

    //Keep size of Share-functions
    $("#pageFunctions").css("font-size", shareFontSize);
    $("#pageFunctions").css("line-height", 'normal');
}

function ShowButtonDiv() {
    $('#fontSizeButtons').show();       
}
function HideButtonDiv() {
    $('#fontSizeButtons').hide();
}

