// 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;


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");
	}
}

function getPrintMap(title) {
	showRetrieveMap();
	printTitle=title;
	var tempWidth = iWidth;
	var tempHeight = iHeight;
	iWidth=495;
	iHeight=470;
	legVis2=legendVisible;
	if (aimsLegendPresent) legendVisible=true;
	
	var theString = writeXML();
	legendVisible = legVis2;
	sendToServer(imsURL,theString,101);
	iWidth=tempWidth;
	iHeight = tempHeight;
	tempWidth=null;
	tempHeight=null;
	theString=null;
}
// second, get OVMap
function getPrintOV() {
        eLeft = idWest - 2000;
        eRight = idEast + 2000;
        eTop = idNorth + 2000;
        eBottom = idSouth - 2000;
	var tempDraw=drawOVExtentBox;
	drawOVExtentBox=true;
	var theString = writeOVXML();
	drawOVExtentBox=tempDraw;
	sendToServer(imsOVURL,theString,102);
	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","width=800,height=360,scrollbars=yes,resizable=yes,toolbar=yes");
	
	Win1.document.writeln('<html><meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><head>');
	Win1.document.writeln('	<title></title>');
	Win1.document.writeln('</head>');
	Win1.document.writeln('<body BGCOLOR="White" TEXT="Black" LEFTMARGIN=0 TOPMARGIN=0>');
	//Win1.document.writeln('<a href="" onmousedown="window.close();"><img src="' + appDir + '/images/closewindow.gif"></a>&nbsp;&nbsp;&nbsp;<a href="" onmousedown="window.print();"><img src="' + appDir + '/images/printmap.gif" value="Print map"></a>');
 
    Win1.document.writeln(addAttributeToMap);
	Win1.document.writeln('<TABLE WIDTH="670" height="500" BORDER="0" CELLSPACING="0" CELLPADDING="0" NOWRAP>');
	
	Win1.document.writeln('	<TR>');

	Win1.document.writeln('	</TR>');
	Win1.document.writeln('	<TR>');
	Win1.document.write('		<TD ROWSPAN="2"');
	Win1.document.writeln(' VALIGN="top">');
	Win1.document.writeln('			<br><br><IMG SRC="' + printMapURL + '"HSPACE=0 VSPACE=0 BORDER=1 ALT="">');
	Win1.document.writeln('		</TD>');
	Win1.document.writeln('		<TD VALIGN="top">');
	Win1.document.writeln('			<IMG SRC="' + printOVURL + '" HSPACE=5 VSPACE=35 BORDER=0 ALT="">');
	Win1.document.writeln('		</TD>');
	Win1.document.writeln('	</TR>');
	Win1.document.writeln('	<TR>');
	Win1.document.writeln('		<TD VALIGN="top">');
	Win1.document.writeln('			<IMG SRC="' + printLegURL + '" HSPACE=0 VSPACE=0 BORDER=0 ALT="">');
	Win1.document.writeln('		</TD>');
	Win1.document.writeln('	</TR>');
	Win1.document.writeln('</TABLE>');
	Win1.document.writeln('<font size="-2">Note: Electronic mapping has inherent limitations in accuracy. The information you retrieve from this map is correct<br>within a 5% range of accuracy, so it is provided for general information purposes only. Before making business <br>investments or taking other actions to take advantage of the government incentives provided by this program, please <br>confirm your eligibility by contacting the Community and Economic Development Department at (619)533-4233.<br><br></font>');
 
	Win1.document.writeln('</body></html>');
	Win1.document.close();
	
	legendVisible=legVis2;
	Win1=null;
	hideRetrieveMap();
}

