﻿
// Print Functionality

function PrintHtmlWithPath(matchTag, sourceContent, headerTitle, path)
{
    var pageContent = document.getElementById(sourceContent).innerHTML;
    pageContent = pageContent.replace(matchTag, "");
    //var winProp = 'left=' + (screen.availWidth - 450) / 2 + ',top=5000,width=0,height=0';

    if (path == null || path == '')
    {
        path = 'PrintPage.html';
    }
    
    var printWindow = window.open(path, '_blank', 'fullscreen=yes');

    while (printWindow.document.body == null)
    {
        setTimeout('return;', 10000);
    }

    var container = printWindow.document.createElement('div');
    container.innerHTML = '<H1 >' + headerTitle + '</H1> <HR>' + pageContent;

    var f = function() { OpenPrintWindow(printWindow, container); };
    setTimeout(f, 200); // need to set a delay to accomodate firefox using appendChild
}

function OpenPrintWindow(printWindow, container)
{
    printWindow.document.body.appendChild(container);
    printWindow.focus();
    printWindow.print();
    printWindow.close();
}

function setActiveTab(tabID) {

    var currTabElem = this.document.getElementById(tabID);

    currTabElem.setAttribute("class", "ActiveTab");
    currTabElem.setAttribute("className", "ActiveTab");

    return;
}

 


