1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
<script type="text/javascript">
<!--
var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1);
if (window.addEventListener) {
window.addEventListener('load', printWin, false);
} else if (window.attachEvent) {
window.attachEvent('onload', printWin);
} else if (window.onload != null) {
var oldOnLoad = window.onload;
window.onload = function(e)
{
oldOnLoad(e);
printWin();
};
} else {
window.onload = printWin;
}
function printWin()
{
if (pr) {
// NS4+, IE5+
window.print();
} else if (!mac) {
// IE3 and IE4 on PC
VBprintWin();
} else {
// everything else
handle_error();
}
}
window.onerror = handle_error;
window.onafterprint = function() {window.close()}
function handle_error()
{
window.alert('<?php echo addslashes(_("Your browser does not support this print option. Press Control/Command + P to print.")) ?>');
return true;
}
if (!pr && !mac) {
if (da) {
// This must be IE4 or greater
wbvers = "8856F961-340A-11D0-A96B-00C04FD705A2";
} else {
// this must be IE3.x
wbvers = "EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B";
}
document.write("<OBJECT ID=\"WB\" WIDTH=\"0\" HEIGHT=\"0\" CLASSID=\"CLSID:");
document.write(wbvers + "\"> </OBJECT>");
}
// -->
</script>
<script type="text/vbscript">
<!--
sub window_onunload
on error resume next
' Just tidy up when we leave to be sure we aren't
' keeping instances of the browser control in memory
set WB = nothing
end sub
sub VBprintWin
OLECMDID_PRINT = 6
on error resume next
' IE4 object has a different command structure
if da then
call WB.ExecWB(OLECMDID_PRINT, 1)
else
call WB.IOleCommandTarget.Exec(OLECMDID_PRINT, 1, "", "")
end if
end sub
' -->
</script>
|