// 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 printPL="";
var printLO="";

var legVis2=false;

/*
***************************************************************************************

Print functions 

***************************************************************************************
*/


function getPrintMap1() {
	showRetrieveMap();
	printTitle="GIS Inquiry Print Page";
	var tempWidth = iWidth;
	var tempHeight = iHeight;
	var tempLHeight = legHeight;
	var tempLWidth = legWidth;
	var customWidth = 0;
// format portrait page, no legend
	customWidth = 650;
	if (iWidth > customWidth) {
	iHeight = (customWidth*iHeight)/iWidth;
	iWidth=customWidth;
	}
	legWidth = customWidth;
	legHeight = 100;
	legVis2=legendVisible;
	if (aimsLegendPresent) legendVisible=true;
	var theString = writeXML();
	iWidth=tempWidth;
	iHeight = tempHeight;
	legHeight = tempLHeight;
	legWidth=tempLWidth;
	legendVisible = legVis2;
	sendToServer(imsURL,theString,101);
	tempWidth=null;
	tempHeight=null;
	theString=null;
}



function getPrintMap2(printType, printLegendOption) {
printParam1 = printType;
printParam2 = printLegendOption;
	showRetrieveMap();
	printTitle="GIS Inquiry Print Page";
	var tempWidth = iWidth;
	var tempHeight = iHeight;
	var tempLHeight = legHeight;
	var tempLWidth = legWidth;
	var customWidth = 0;
	if (printType == 1) {
	// print portrait
		customWidth = 650;
		if (printLegendOption == 2) {
			customWidth = 450;
		}
	} else {
	// print landscape
		customWidth = 900;
		if (printLegendOption == 2) {
			customWidth = 700;
		}
	}
	if (iWidth > customWidth) {
	iHeight = (customWidth*iHeight)/iWidth;
	iWidth=customWidth;
	}
	if (printLegendOption == 2) {
		legHeight = iHeight;
	} else {
		legWidth = customWidth;
		legHeight = 100;
	}
	legVis2=legendVisible;
	if (aimsLegendPresent) legendVisible=true;
	var theString = writeXML();
	iWidth=tempWidth;
	iHeight = tempHeight;
	legHeight = tempLHeight;
	legWidth=tempLWidth;
	legendVisible = legVis2;
	sendToServer(imsURL,theString,102);
	tempWidth=null;
	tempHeight=null;
	theString=null;
}

