// JavaScript Document

// Author: Jesse Sheehan

// Some assistance from www.boutell.com

// Script is intended to open a new window, print user's object, then close the window.



function makepage(src)

{

  // We 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>Morning Madness.com Print 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 + "' width='627' height='302'/>\n" +

    "</body>\n" +

    "</html>\n";

}



function printme(evt)

{

  if (!evt) {

    // Old IE

    evt = window.event;

  }    

  var image = evt.target;

  if (!image) {

    // Old IE

    image = window.event.srcElement;

  }

  src = image.src;

  link = "about:blank";

  var pw = window.open(link, "_new");

  pw.document.open();

  pw.document.write(makepage(src));

  pw.document.close();

}

//From: http://www.webdeveloper.com/forum/archive/index.php/t-151318.html (Poster: slaughters, http://www.stansight.com/tmp.html)
function PrintPic(picimg) {
picwin=window.open(picimg,"pic");
setTimeout("picwin.print();", 1000);
setTimeout("picwin.close();", 1000);
}


