gAutoPrint = true;
function printSpecial(varDiv){
    if (document.getElementById != null){
        var html = '<HTML>\n<HEAD>\n';

        if (document.getElementsByTagName != null){
            var headTags = document.getElementsByTagName("head");
            if (headTags.length > 0)
            html += headTags[0].innerHTML;
        }

        html += '\n</HEAD>\n\n';
        html += '<body class="main"><div class="main" style="width:100%; padding:20px;">';
        //var printReadyElem = document.getElementById("printReady");
        var printReadyElem = document.getElementById(varDiv);

        if (printReadyElem != null){
            html += printReadyElem.innerHTML;
        }
        else{
            alert("Could not find the printReady function");
            return;
        }
        //html += '<form><input type="button" value="Print this page" onclick="javascript:windown.print();"></form>';
        html += '</div>';
        html += '\n</BODY>\n</HTML>';

        var printWin = window.open("","printSpecial","menubar=1,resizable=0,width=600,height=400"); 
        printWin.document.open();
        printWin.document.write(html);

        if (gAutoPrint){
            printWin.print();
        }
    }
    else{
        alert("The print ready feature is only available if you are using an browser. Please update your browswer.");
    }
}
