// aimsPrint.js
/*
*  JavaScript template file for ArcIMS HTML Viewer
*       dependent on aimsXML.js, ArcIMSparam.js, aimsCommon.js, aimsMap.js,
*       aimsLayers.js, aimsDHTML.js
*       aimsClick.js, aimsNavigation.js,
*       aimsLegend.js
*/

var aimsPrintPresent=true;

var printTitle = "ArcIMS 3.0 HTML Viewer Map";
var printMapURL="";
var printOVURL="";
var printLegURL="";

var legVis2=false;

/*
***************************************************************************************

Print functions 

***************************************************************************************
*/


// display print form
function printIt() {
    hideLayer("measureBox");
    if (useTextFrame) {
        parent.TextFrame.document.location = "printform.htm";
    } else {
        var Win1 = open("printform.htm","PrintFormWindow","width=575,height=150,scrollbars=yes,resizable=yes");
    }
}

// create web page for printing
    // first get Map
function getPrintMap(title) {
    makePrint=true;
    showRetrieveMap();
    printTitle=title;
    var tempWidth = iWidth;
    var tempHeight = iHeight;
    iWidth=800;
    iHeight=600;
    legVis2=legendVisible;
    if (aimsLegendPresent) legendVisible=true;

    var theString = writeXML();
    iWidth=tempWidth;
    iHeight = tempHeight;
    legendVisible = legVis2;
    makePrint=true;
    sendToServer(imsURL,theString,101);
    tempWidth=null;
    tempHeight=null;
    theString=null;
}

// third, get Legend
function getPrintLegend() {
    //  waiting for Legend tags
    if (colourLegend) {printLegURL = "/website/bikes2b/images/legend_rds.gif";} else {printLegURL = "/website/bikes2b/images/legend_rds_G.gif";}
    //if (printLegURL=="") printLegURL = "/website/bikes2b/images/0-5.gif";
    writePrintPage();
}

// fourth, write the web page
 function writePrintPage() {
    var Win1 = open("","PrintPage");

    //Win1.document.open();
    Win1.document.writeln('<html><head>');
    Win1.document.writeln(' <title>Bicycle Facilities</title>');
    Win1.document.writeln('</head>');

    Win1.document.writeln('<body BGCOLOR="White" TEXT="Black" LEFTMARGIN=0 TOPMARGIN=0>');

    Win1.document.writeln('<FONT FACE="Arial"><B>');
    Win1.document.writeln('<TABLE WIDTH="950" BORDER="2" CELLSPACING="0" CELLPADDING="0" NOWRAP>');
    Win1.document.writeln(' <TR>');
    Win1.document.writeln('     <TH COLSPAN="2">' + printTitle + '</TH>');
    Win1.document.writeln(' </TR>');
    Win1.document.writeln(' <TR>');
    
    Win1.document.writeln('     <TD ALIGN="CENTER" WIDTH=150 VALIGN="TOP">');    
    Win1.document.writeln('<br>Bicycle Facilities');
    Win1.document.writeln('         <IMG SRC="/website/bikes2b/images/legend_bikes.gif" HSPACE=0 VSPACE=0 BORDER=0 ALT=""><BR>');
    Win1.document.writeln('<br><br>Background');
    Win1.document.writeln('         <IMG SRC="' + printLegURL + '" HSPACE=0 VSPACE=0 BORDER=0 ALT=""><BR>');
    Win1.document.writeln('     </TD>');
        
    Win1.document.write('       <TD WIDTH="800" HEIGHT="600" rowspan="2"');
    Win1.document.writeln('>');
    Win1.document.writeln('         <IMG SRC="' + printMapURL + '" WIDTH=800 HEIGHT=600 HSPACE=0 VSPACE=0 BORDER=0 ALT="">');
    Win1.document.writeln('     </TD>');
    Win1.document.writeln(' </TR>');
   
    Win1.document.writeln(' <TR>');
    Win1.document.writeln('     <TD ALIGN="left" VALIGN="TOP">');
    Win1.document.writeln('<font size=-2><I>This VicRoads\' plan is provided for information purposes only.');
    Win1.document.writeln('No claim is made as to the accuracy or authenticity of the plan. VicRoads does');
    Win1.document.writeln('not accept any liability to any person for the information or advice (or the use');
    Win1.document.writeln('of such information or advice) which is provided on this plan or incorporated into');
    Win1.document.writeln('it by reference. The information on the plan is provided on the basis that persons');
    Win1.document.writeln('undertake responsibility for assessing the relevance and accuracy of its content.<br></I></font></TD></TR>');
    Win1.document.writeln('</TABLE>');
    Win1.document.writeln('</B></FONT>');

    Win1.document.writeln('</body></html>');
    Win1.document.close();
    
    legendVisible=legVis2;
    Win1=null;
    hideRetrieveMap();

}