// bhLegend.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 = "Black Hawk County, Iowa";
var printMapURL="";
var printOVURL="";
var printLegURL="";

var legVis2=false;

/*
***************************************************************************************

Legend functions 

***************************************************************************************
*/

// create web page for printing
	// first get Map
function bhLegend() {
	showRetrieveMap();
	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,111);
	tempWidth=null;
	tempHeight=null;
	theString=null;
}
// second, get Legend
function getbhLegend() {
	//  waiting for Legend tags
	if (printLegURL=="") printLegURL = "images/esrilogo.gif";
	writebhLegend();
}
// third, write the web page
function writebhLegend() {
	Win1 = window.open("","bhLegend","width=200,height=400,toolbar=yes,scrollbars=yes,resizable=yes,top=0,left=0");
	//Win1.document.open();
	Win1.document.writeln('<html><head>');
	Win1.document.writeln('	<title>Current Map Legend</title>');
	Win1.document.writeln('</head>');
	Win1.document.writeln('<body BGCOLOR="White" TEXT="Black" LEFTMARGIN=0 TOPMARGIN=0 onload="window.focus()">');
	Win1.document.writeln('<FONT FACE="Arial" size=1><B>');
	Win1.document.writeln('<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" NOWRAP>');
	Win1.document.writeln('	<TR>');
	Win1.document.writeln('		<TD ALIGN="CENTER" VALIGN="MIDDLE">');
	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('</B></FONT>');
	Win1.document.writeln('</body></html>');
	Win1.document.close();
	
	//legendVisible=legVis2;
	//Win1=null;
	hideRetrieveMap();
}

