// 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 printmode="";
var legVis2=false;
var mapwidth="";
var mapheight="";

/*
***************************************************************************************

Print functions 

***************************************************************************************
*/

function plotIt() {
	hideLayer("measureBox");
	if (useTextFrame) {
		parent.TextFrame.document.location = "plotting.asp";
	} else {
		var Win1 = open("printform.asp","PrintFormWindow","width=575,height=150,scrollbars=yes,resizable=yes");
	}
}

// display print form
function printIt() {
	hideLayer("measureBox");
	if (useTextFrame) {
		parent.TextFrame.document.location = "printform.asp";
	} else {
		var Win1 = open("../printform.asp","PrintFormWindow","width=575,height=150,scrollbars=yes,resizable=yes");
	}
}

// create web page for printing

// first get Map
function getPrintMap() {
	mapwidth = userwidth;
	mapheight = userheight;
	showRetrieveMap();
	printTitle=title;
	var tempWidth = iWidth;
	var tempHeight = iHeight;
	iWidth=450;
	iHeight=450;
	legVis2=legendVisible;
	if (aimsLegendPresent) legendVisible=true;
	var theString = writeXML();
	iWidth=tempWidth;
	iHeight = tempHeight;
	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;
}

function SnapShot(snap) {
	var snapURL = snap;
	var mWidth = getMapWidth();
	var mHeight = getMapHeight();
	var Win1 = open("","PrintPage");
	Win1.document.writeln('<html><head>');
	Win1.document.writeln('	<title>Map Output</title>');
	Win1.document.writeln('</head>');
	Win1.document.writeln('<body BGCOLOR=WHITE TEXT="BLACK" LEFTMARGIN=0 TOPMARGIN=0>');
	Win1.document.writeln('<TABLE WIDTH="45%" BORDER="1" CELLSPACING="0" CELLPADDING="0" align="center">');
	Win1.document.writeln('	<TR>');
	Win1.document.writeln('	<TD ALIGN="CENTER" VALIGN="Middle"><FONT SIZE="5" FACE="Arial">');
	Win1.document.writeln('<Strong>Snap Shot</FONT></Strong>');
	Win1.document.writeln('	</TD>');
	Win1.document.writeln('<TR>');
	Win1.document.writeln('<TD>');
	Win1.document.writeln('<img name="theImage" src="' + snapURL + '" hspace=0 vspace=0 border=0>');
	Win1.document.writeln('	</TD>');
	Win1.document.writeln('	</TR>');
	Win1.document.writeln('<TR>');
	Win1.document.writeln('<TD>');
	Win1.document.writeln('<center><br>To save: Right Click on the image and select "Save Picture As..." from the pull down menu.<br>');
	Win1.document.writeln('<a href="Javascript:self.close()"><big>Close Window</big></a></font></center><br>');
	Win1.document.writeln('</TABLE>');
	Win1.document.writeln('</B></FONT>');
	Win1.document.writeln('</body></html>');
	Win1.document.close();
	Win1=null;
	hideRetrieveMap();
}

function writePlotPage(URL) {
//alert(legendImage);
	var plotURL = URL;
	var mWidth = getMapWidth();
	var mHeight = getMapHeight();
	var Win1 = open("","PrintPage");
	Win1.document.writeln('<html><head>');
	Win1.document.writeln('	<title>Map Output</title>');
	Win1.document.writeln('</head>');
	Win1.document.writeln('<body BGCOLOR=WHITE TEXT="BLACK" LEFTMARGIN=0 TOPMARGIN=0>');
	Win1.document.writeln('<TABLE WIDTH="45%" BORDER="1" CELLSPACING="0" CELLPADDING="0" align="center">');
	Win1.document.writeln('<TR><TD><TABLE BORDER="0">');
	Win1.document.writeln('<TR>');
	Win1.document.writeln('<TD width="100%">');
	Win1.document.writeln('<img name="theImage" src="' + OVURL + '" hspace=0 vspace=0 border=0>');
	Win1.document.writeln('</Table><TD><TABLE BORDER="0">');

	Win1.document.writeln('<td align=center>');
	Win1.document.writeln('<img src="'+appDir+'/images/NorthArrowSmall.jpg" border="0"></td></tr>');
	Win1.document.writeln('<TR><td align=center><font face="arial" size="1">COLUMBIA COUNTY <BR> INTERACTIVE MAPPING</TD></TR>');
			
	Win1.document.writeln('	<TR><td align=center><FONT SIZE="2" FACE="Arial">');
	Win1.document.writeln('<Strong>' + maptitle + '</Strong></FONT>');
	Win1.document.writeln('	</TD>');
	Win1.document.writeln('	</TR>');
	Win1.document.writeln('	</TD>');
	Win1.document.writeln('		<TD ALIGN="CENTER" VALIGN="middle">');
	Win1.document.writeln('			<IMG SRC="' + legendImage + '" HSPACE=0 VSPACE=0 BORDER=0 ALT="">');
	Win1.document.writeln('		</TD>');
	Win1.document.writeln('	</TR>');
	
	Win1.document.writeln('	<TR border=0>');
	Win1.document.writeln('		<TD ALIGN="center"><FONT SIZE="1" FACE="Arial">');
	Win1.document.writeln('Scale: 1" = ' + userscale + ' Feet');
	Win1.document.writeln('	</FONT></TD>');
	Win1.document.writeln('	</TR>');

	Win1.document.writeln('</B></FONT>');
	Win1.document.writeln('	<TR>');
	Win1.document.writeln('		<TD align="left" border=0 colspan=3><FONT SIZE="1" FACE="Arial">');
	Win1.document.writeln('DISCLAIMER:  This map was prepared using the online Columbia County Interactive Mapping System. Information is believed to be correct but is ADVISORY only.  Map accuracy is limited to the quality of data obtained from other public records. The user is responsible for verification of all data. Columbia County is NOT responsible for improper use.  Please contact the Land Information Department for further information (www.co.columbia.wi.us).');
	Win1.document.writeln('	</font></TD>');
	Win1.document.writeln('	</TR>');
	Win1.document.writeln('<TR><td align=center>');
	Win1.document.writeln('<img src="'+appDir+'/images/ColumbiaLogo.jpg" border="0"></td></tr>');
	Win1.document.writeln('</TABLE></TD></TR>');
	Win1.document.writeln('</TABLE>');
	Win1.document.writeln('</B></FONT>');
	Win1.document.writeln('</body></html>');
	Win1.document.close();
	left = templeft;
	right = tempright;
	top =  temptop;
	bottom = tempbottom;
	legendVisible=legVis2;
	Win1=null;
	hideRetrieveMap();
}

function writePlotPageP(URL) {
//alert(legendImage);
	var plotURL = URL;
	var mWidth = getMapWidth();
	var mHeight = getMapHeight();
	var Win1 = open("","PrintPageP");
	Win1.document.writeln('<html><head>');
	Win1.document.writeln('	<title>Map Output</title>');
	Win1.document.writeln('</head>');
	Win1.document.writeln('<body BGCOLOR=WHITE TEXT="BLACK" LEFTMARGIN=0 TOPMARGIN=0>');
	Win1.document.writeln('<TABLE WIDTH="45%" BORDER="1" CELLSPACING="0" CELLPADDING="0" align="center">');
	Win1.document.writeln('<TR><TD colspan="3"><TABLE BORDER="0">');
	Win1.document.writeln('<TR>');
	Win1.document.writeln('<TD width="100%">');
	Win1.document.writeln('<img name="theImage" src="' + plotURL + '" hspace=0 vspace=0 border=0>');
	Win1.document.writeln('</Table></td></tr>');

	Win1.document.writeln('<TR><TD width="20%"><TABLE BORDER="0">');
	Win1.document.writeln('<tr><td align=center><font face="arial" size="1">COLUMBIA COUNTY <BR> INTERACTIVE MAPPING</TD></TR>');
	Win1.document.writeln('<TR><td align=center><FONT SIZE="2" FACE="Arial">');
	Win1.document.writeln('<Strong>' + maptitle + '</Strong></FONT>');
	Win1.document.writeln('	</TD>');
	Win1.document.writeln('	</TR>');
	Win1.document.writeln('</Table></td>');
	Win1.document.writeln('		<TD width="50%" ALIGN="CENTER" VALIGN="middle">');
	Win1.document.writeln('			<IMG SRC="' + legendImage + '" HSPACE=0 VSPACE=0 BORDER=0 ALT="">');
	Win1.document.writeln('		</TD>');
	
	Win1.document.writeln('<td width="30%" align=center><Table>');
	
	Win1.document.writeln('<TR border=0>');
	Win1.document.writeln('<TD ALIGN="center" colspan="2"><FONT SIZE="1" FACE="Arial">');
	Win1.document.writeln('Scale: 1" = ' + userscale + ' Feet');
	Win1.document.writeln('	</FONT></TD>');
	Win1.document.writeln('	</TR>');
	
	Win1.document.writeln('	<TR>');
	Win1.document.writeln('		<TD align="left" border=0 colspan=2><FONT SIZE="1" FACE="Arial">');
	Win1.document.writeln('DISCLAIMER:  This map was prepared using the online Columbia County Interactive Mapping System. Information is believed to be correct but is ADVISORY only.  Map accuracy is limited to the quality of data obtained from other public records. The user is responsible for verification of all data. Columbia County is NOT responsible for improper use.  Please contact the Land Information Department for further information (www.co.columbia.wi.us).');
	Win1.document.writeln('	</font></TD>');
	Win1.document.writeln('	</TR>');
	
	Win1.document.writeln('<TR><td>');
	Win1.document.writeln('<img src="'+appDir+'/images/NorthArrowSmall.jpg" border="0"></td>');
	
	Win1.document.writeln('	</TD>');
	Win1.document.writeln('<td align=center>');
	Win1.document.writeln('<img src="'+appDir+'/images/ColumbiaLogo.jpg" border="0"></td></tr>');
	Win1.document.writeln('</TABLE></TD></TR>');
	Win1.document.writeln('</TABLE>');
	Win1.document.writeln('</B></FONT>');
	Win1.document.writeln('</body></html>');
	Win1.document.close();
	left = templeft;
	right = tempright;
	top =  temptop;
	bottom = tempbottom;
	legendVisible=legVis2;
	Win1=null;
	hideRetrieveMap();
}