var gAutoPrint = true;

function processPrint(divId){
    if (document.getElementById != null){
        var html = '<HTML>\n<HEAD><style>*{background-color:white;} div{padding-top:20px;}</style>\n';
        if (document.getElementsByTagName != null){
            var headTags = document.getElementsByTagName("head");
            if (headTags.length > 0) html += headTags[0].innerHTML;
        }
        html += '\n</HE' + 'AD>\n<BODY style="background:white;padding:20px">\n';
        var printReadyElem = document.getElementById(divId);
        if (printReadyElem != null) html += printReadyElem.innerHTML;
        else{
            alert("Error, no contents.");
            return;
        }
        html += '\n</BO' + 'DY>\n</HT' + 'ML>';
        var printWin = window.open("","processPrint");
        printWin.document.open();
        printWin.document.write(html);
        printWin.document.close();
        if (gAutoPrint) printWin.print();
    }
    else alert("Browser not supported.");
}