var flag;

function doLoad(value) {
	var apath= new Array();
	
	apath[0]='/lib/form_short.php';
	apath[1]='/lib/form_ticket.php';
	apath[2]='/lib/form_short_en.php';
	apath[3]='/lib/form_ticket_en.php';

    flag=1;
	var req = new JsHttpRequest();
    req.onreadystatechange = function() {
        if (req.readyState == 4) {
            document.getElementById('output').innerHTML =
               req.responseJS;
        }
    }
    var path;
    path=apath[id_form];
    //path='/lib/form_short.php';
    req.open(null, path, true);
    req.send( { q: value } );
}

function makepage(src) {
  return "<html>\n" +
    "<head>\n" +
    "<title>Ticket</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";
}
function printme(evt) {
  var image = evt.target;
  if (!image) image = window.event.srcElement;
  if (!evt) evt = window.event;
  src = image.src;
  link = "about:blank";
  var pw = window.open(link,"_new");
  pw.document.open();
  pw.document.write(makepage(src));
  pw.document.close();
}


window.onload= doLoad('');

