// 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
*/

aimsPrintPresent=true;

var printTitle = titleList[4];
var printMapURL="";
var printOVURL="";
var printLegURL="";

var legVis2=false;

/*
***************************************************************************************

Print functions 

***************************************************************************************
*/


// display print form
function printIt() {
	hideLayer("measureBox");

	parent.LocateFrame.document.location = "printform.htm";
	
	//REMOVED BY BML - Print Form needs to be displayed in the locate frame
	//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) {
	showRetrieveMap();
	printTitle=title;
	var tempWidth = iWidth;
	var tempHeight = iHeight;
	var tempLegWidth = legWidth;
	var tempLegHeight = legHeight;	
	
	iWidth=450;
	iHeight=450;	

	//set the legend size
	legVis2=legendVisible;
	legWidth=250;
	legHeight=450;
	
	legVis2=legendVisible;
	if (aimsLegendPresent) legendVisible=true;
	var theString = writeXML();
	iWidth=tempWidth;
	iHeight = tempHeight;
	legWidth = tempLegWidth;
	legHeight = tempLegHeight;
	legendVisible = legVis2;
	sendToServer(imsURL,theString,101);
	tempWidth=null;
	tempHeight=null;
	theString=null;
}
// second, get OVMap
function getPrintOV() {
	var tempWidth = i2Width;
	var tempHeight = i2Height;
	i2Width=190;
	i2Height=150;
	var tempDraw=drawOVExtentBox;
	drawOVExtentBox=true;
	var theString = writeOVXML();
	drawOVExtentBox=tempDraw;
	i2Width=tempWidth;
	i2Height = tempHeight;
	sendToServer(imsOVURL,theString,102);
	tempWidth=null;
	tempHeight=null;
	theString=null;
}
// third, get Legend
function getPrintLegend() {
	//  waiting for Legend tags
	if (printLegURL=="") printLegURL = "images/nolegend.gif";
	writePrintPage();
}
// fourth, write the web page
function writePrintPage() {
	var Win1 = open("","PrintPage");
	//Win1.document.open();
	Win1.document.writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');
	Win1.document.writeln('<html>');
	Win1.document.writeln('<head>');
	Win1.document.writeln('		<title></title>');
	Win1.document.writeln('		<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">');
	Win1.document.writeln('		<LINK href="' + baseURL + webSite + 'Common/print.css" title="print_style" rel="stylesheet" type="text/css">');
	Win1.document.writeln('	</head>');
	Win1.document.writeln('	<body>');	
	Win1.document.writeln('<body BGCOLOR="White" TEXT="Black" LEFTMARGIN=0 TOPMARGIN=0>');
	Win1.document.writeln('		<table width="700" border="1" cellspacing="0" cellpadding="0">');
	Win1.document.writeln('			<tr valign="middle">');
	Win1.document.writeln('				<td height="24" align="center" class="Title" colspan="2">' + printTitle + '</td>');
	Win1.document.writeln('			</tr>');
	Win1.document.writeln('			<tr>');
	Win1.document.writeln('				<td valign="top"><IMG SRC="' + printMapURL + '" WIDTH="450" HEIGHT="450" HSPACE="0" VSPACE="0" BORDER="0" ALT=""></td>');
	Win1.document.writeln('				<td valign="top"><IMG SRC="' + printLegURL + '" WIDTH="250" HEIGHT="450" HSPACE="0" VSPACE="0" BORDER="0" ALT=""></td>');
	Win1.document.writeln('			</tr>');
	Win1.document.writeln('			<tr valign="middle">');
	Win1.document.writeln('				<td height="24" align="center" class="Title">Control Station Information</td>');
	Win1.document.writeln('			</tr>');
	Win1.document.writeln('			<tr>');
	Win1.document.writeln('				<td valign="top" colspan="2">Control Station Inforamtion Goes Here!</td>');
	Win1.document.writeln('			</tr>');
	Win1.document.writeln('			<tr>');
	Win1.document.writeln('				<td colspan="2" class="Disclaimer">');
	Win1.document.writeln('					<b>Disclaimer.</b>KGIS makes no representation or warranty as to the accuracy ');
	Win1.document.writeln('					of this map and its information nor to its fitnes for use. Any user of this map ');
	Win1.document.writeln('					product accepts the same AS IS, WITH ALL FAULTS, and assumes all responsibility ');
	Win1.document.writeln('					for the use thereof, and futher covenants and agrees to hold KGIS harmless from ');
	Win1.document.writeln('					and any damage, loss, or liability arising from any use of the map product. ');
	Win1.document.writeln('					Independent verification of all information contained on this map should be ');
	Win1.document.writeln('					obtained by any user.');
	Win1.document.writeln('					<p><b>Proprietary Information.</b> The map products and databases on this Web Site ');
	Win1.document.writeln('						have been copyrighted by the KGIS Policy Board. The KGIS Policy Board hereby ');
	Win1.document.writeln('						reserves all rights thereto, and no portion of the products or databases on ');
	Win1.document.writeln('						this Web Site may be reproduced in any form or by any means without the express'); 
	Win1.document.writeln('						written authorization of the KGIS Policy Board or its authorized agents.</p>');
	Win1.document.writeln('				</td>');
	Win1.document.writeln('			</tr>');
	Win1.document.writeln('		</table>');
	Win1.document.writeln('	</body>');
	Win1.document.writeln('</html>');

	Win1.document.close();
	
	legendVisible=legVis2;
	Win1=null;
	hideRetrieveMap();
}


