﻿
//Print Document - Prints the specified div tag
//Arguments:
//          iframeId - The ID of an iframe on the calling page
//                      that acts as a holding area for the div
//                      tag.
//          divId   - The ID of a div tag that contains the data
//                      that you want sent to the printer.                          
function PrintDocument(iframeId, divId)
{
    try
    {
        var printFrame = document.getElementById(iframeId);
        printFrame = (printFrame.contentWindow || printFrame.contentDocument);
        printFrame.document.open();
        printFrame.document.write('<html><head></head><body>');
        var oContent = document.getElementById(divId).innerHTML;
        printFrame.document.write(oContent);
        printFrame.document.write('</body></html>');
        printFrame.document.close();
        printFrame.focus();
        printFrame.print();
    }
    catch(e)
    {
       alert("Error: " + e.message);
    }
}
