function makepage(src)
{
  // Break the closing script tag in half to prevent
  // the HTML parser from seeing it as a part of
  // the *main* page.

  return "<html>\n" +
    "<head>\n" +
    "<title>Temporary Printing Window</title>\n" +
    "<script>\n" +
    "function step1() {\n" +
    "  setTimeout('step2()', 10);\n" +
    "}\n" +
    "function step2() {\n" +
    "  window.print();\n" +
    "  window.close();\n" +
    "}\n" +
    "</scr" + "ipt>\n" +
    "</head>\n" +
    "<body onLoad='step1()'>\n" +
    "<img src='" + src + "'/>\n" +
    "</body>\n" +
    "</html>\n";
}
///////////////  COUPON 1  ///////////////////
function printme1(evt)
{
  if (!evt) {
    // Old IE
    evt = window.event;
  }    
  var image = "http://www.toplineperformancehb.com/images/oil_change_wheel_alignment_coupon_huntington_beach.gif";
  if (!image) {
    // Old IE
    image = window.event.srcElement;
  }
  src = "http://www.toplineperformancehb.com/images/oil_change_wheel_alignment_coupon_huntington_beach.gif";
  link = "about:blank";
  var pw = window.open(link, "_new");
  pw.document.open();
  pw.document.write(makepage(src));
  pw.document.close();
}

///////////////  COUPON 2  ///////////////////
function printme2(evt)
{
  if (!evt) {
    // Old IE
    evt = window.event;
  }    
  var image = "http://www.toplineperformancehb.com/images/radiator_flush_coupon.gif";
  if (!image) {
    // Old IE
    image = window.event.srcElement;
  }
  src = "http://www.toplineperformancehb.com/images/radiator_flush_coupon.gif";
  link = "about:blank";
  var pw = window.open(link, "_new");
  pw.document.open();
  pw.document.write(makepage(src));
  pw.document.close();
}

///////////////  COUPON 3  ///////////////////
function printme3(evt)
{
  if (!evt) {
    // Old IE
    evt = window.event;
  }    
  var image = "http://www.toplineperformancehb.com/images/ac_service_coupon.gif";
  if (!image) {
    // Old IE
    image = window.event.srcElement;
  }
  src = "http://www.toplineperformancehb.com/images/ac_service_coupon.gif";
  link = "about:blank";
  var pw = window.open(link, "_new");
  pw.document.open();
  pw.document.write(makepage(src));
  pw.document.close();
}

///////////////  COUPON 4  ///////////////////
function printme4(evt)
{
  if (!evt) {
    // Old IE
    evt = window.event;
  }    
  var image = "http://www.toplineperformancehb.com/images/catalytic_converter_coupon.gif";
  if (!image) {
    // Old IE
    image = window.event.srcElement;
  }
  src = "http://www.toplineperformancehb.com/images/catalytic_converter_coupon.gif";
  link = "about:blank";
  var pw = window.open(link, "_new");
  pw.document.open();
  pw.document.write(makepage(src));
  pw.document.close();
}

///////////////  COUPON 5  ///////////////////
function printme5(evt)
{
  if (!evt) {
    // Old IE
    evt = window.event;
  }    
  var image = "http://www.toplineperformancehb.com/images/oil_change_coupon.gif";
  if (!image) {
    // Old IE
    image = window.event.srcElement;
  }
  src = "http://www.toplineperformancehb.com/images/oil_change_coupon.gif";
  link = "about:blank";
  var pw = window.open(link, "_new");
  pw.document.open();
  pw.document.write(makepage(src));
  pw.document.close();
}
