
var shell;
/*
function SetPrintProperties() {
try {
shell = new ActiveXObject("WScript.Shell");
shell.SendKeys("%fu");
window.setTimeout("javascript:SetPaperSize();", 1200);
window.setTimeout("javascript:setlandscape();", 2000);
} catch (e) {
alert('Please verify that your print settings have a landscape orientation and minimum margins.');
}
}
function SetPaperSize() {
//shell.sendKeys("%a{TAB}.2{TAB}0{TAB}0{TAB}0{ENTER}");
shell.sendKeys("^p");
shell.sendKeys("%R");
shell.sendKeys("%L");
shell.sendKeys("{ENTER}");
shell.sendKeys("{ENTER}");
}
function setlandscape() {
shell.sendKeys("%fp");
window.print();
} */

function winPrint() {
  try {
    SetPaperSize();
  } catch (e) {
    SetPaperSize_fail();
  }
}
function SetPaperSize() {
  try {
    shell = new ActiveXObject("WScript.Shell");
    shell.sendKeys("^p");
    setTimeout("shell.sendKeys('%R')",1000);
    setTimeout("shell.sendKeys('%L')",1100);
    setTimeout("shell.sendKeys('{ENTER}')",1200);
    setTimeout("shell.sendKeys('{ENTER}')",1300);
  } catch(e) {
    SetPaperSize_fail();
  }
}
function SetPaperSize_fail() {
  if(navigator.product!='Gecko'||navigator.appVersion<5)
    // don't show the alert for browsers that can understand the style rules.
    // yes, it's a very ugly hack, but it works.
    alert('Please adjust your page settings under print preview and verify the orientation \nis landscape to ensure the document will print correctly. ');
  //window.print();
}

