var da = (document.all) ? 1 : 0; var pr = (window.print) ? 1 : 0; var mac = (navigator.userAgent.indexOf("Mac") != -1); function printPage(frame, arg) { if (frame == window) { printThis(); } else { link = arg; // a global variable printFrame(frame); } return false; } function printThis() { if (pr && !mac) { // NS4, IE5 window.print(); } else if (da && !mac) { // IE4 (Windows) vbPrintPage(); } else if (mac){ // mac var allowPrinting = false; var userAgent = navigator.userAgent; if(userAgent.indexOf("Netscape/7") != -1) { allowPrinting = true; }else if(userAgent.indexOf("Safari") != -1) { allowPrinting = true; } if(allowPrinting) { window.print(); }else { alert("Sorry, your browser doesn't support this feature. Please use the File menu to print this window."); } }else {// other browsers alert("Sorry, your browser doesn't support this feature. Please use the File menu to print this window."); } } function printFrame(frame) { if (pr && da) { // IE5 frame.focus(); window.print(); link.focus(); } else if (pr) { // NS4 frame.print(); } else if (da && !mac) { // IE4 (Windows) frame.focus(); setTimeout("vbPrintPage(); link.focus();", 100); } else { // other browsers alert("Sorry, your browser doesn't support this feature. Please use the file menu to print this window."); } } if (da && !pr && !mac) with (document) { writeln(''); writeln('<' + 'SCRIPT LANGUAGE="VBScript">'); writeln('Sub window_onunload'); writeln(' On Error Resume Next'); writeln(' Set WB = nothing'); writeln('End Sub'); writeln('Sub vbPrintPage'); writeln(' OLECMDID_PRINT = 6'); writeln(' OLECMDEXECOPT_DONTPROMPTUSER = 2'); writeln(' OLECMDEXECOPT_PROMPTUSER = 1'); writeln(' On Error Resume Next'); writeln(' WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER'); writeln('End Sub'); writeln('<' + '/SCRIPT>'); } function printit() { printThis(); } function closeWindow() { alert("in close"); if(newWindow && !newWindow.closed) { newWindow.close() } }