var fcSeqNum = 0;



function sizeAndCentre(win, width, height)

{

    var moveToX = (screen.availWidth - width) / 2;

    if (moveToX < 0) {

        moveToX = 0;

    }

    var moveToY = (screen.availHeight - height) / 2;

    if (moveToY < 0) {

        moveToY = 0;

    }

    win.resizeTo(width, height);

    win.moveTo(moveToX, moveToY);

}





function generatePage(host, gateway, client, jar, codebase)

{

    var targ = "FastBook" + fcSeqNum;

    fcSeqNum++;

    var newwin = window.open("", targ, "scrollbars=no, resizable=yes");



    sizeAndCentre(newwin, 767, 420);



    var doc = newwin.document;



    // if host not specified, then its the host this page is loaded from

    if (host == "") {

        host = document.location.hostname;

    }



    doc.writeln('<html><head><title>Online bookings</title></head>');

    doc.writeln('<body bgcolor="#C0C0C0">');

    doc.writeln('<applet CODE="com.tourplan.fastbook.FastBook.class"');

    doc.writeln('ARCHIVE="', jar, '" CodeBase="http://', host, codebase, '"');

    doc.writeln('WIDTH=747 HEIGHT=365>');

    doc.writeln('<param name="addr" value="http://', host, gateway, '">');

    doc.writeln('<param name="client" value="', client, '">');

    doc.writeln('</applet>');

    doc.writeln('</body></html>');

    doc.close();

    newwin.focus();

}