// 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 printsize="";
var printres="";
var printlayout="";

var legVis2=true;

/*
***************************************************************************************

Print functions 

// EDITED BY ALISON SENGUPTA
// LEXINGTON COUNTY GIS

***************************************************************************************
*/


// display print form
function printIt() {
	hideLayer("measureBox");
	if (useTextFrame) {
		//parent.TextFrame.document.location = "printform.htm";
		var Win1 = open("printform.htm","PrintFormWindow","width=575,height=450,scrollbars=yes,resizable=yes");
	} else {
		var Win1 = open("printform.htm","PrintFormWindow","width=575,height=450,scrollbars=yes,resizable=yes");
	}
}

// create web page for printing
	// first get Map
function getPrintMap(title, pagesize, resolution, layout) {
	printlayout = layout;
	printres = resolution;
	printsize = pagesize;	
	showRetrieveMap();
	printTitle=title;
	var tempWidth = iWidth;
	var tempHeight = iHeight;

// Print setting for Portrait

	if(printsize == "small" && printlayout == "Portrait")
	{
		iWidth=900;
		iHeight=1275;
	}

	else if(printsize == "large" && printlayout == "Portrait")
	{
		iWidth=1200;
		iHeight=2175;
	}

// Print settings for Landscape

	else if(printsize == "small" && printlayout == "Landscape")
	{
		iWidth=1275;
		iHeight=975;
	}

	else if(printsize == "large" && printlayout == "Landscape")
	{
		iWidth=2100;
		iHeight=1350;
	}

// Below should never happen

	else
	{
		iWidth=901;
		iHeight=901;
	}

//return

	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;
}
// third, get Legend
function getPrintLegend() {
	if (printLegURL=="") printLegURL = "images/nolegend.gif";
	//  waiting for Legend tags
	writePrintPage();
}
// fourth, write the web page
function writePrintPage() 
{




// 8.5 x 11 - Portrait

	if (printsize == "small" && printlayout == "Portrait")
	{
			var Win1 = open("","PrintPage");
			//Win1.document.open();
			Win1.document.writeln('<html><meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><head>');
			Win1.document.writeln('<title>'+ titleList[4] +'</title>');
			Win1.document.writeln('</head>');
			Win1.document.writeln('<body BGCOLOR="White" TEXT="Black" LEFTMARGIN=0 TOPMARGIN=0>');
			
			Win1.document.writeln('<TABLE WIDTH="750" HEIGHT="850" BORDER="2" CELLSPACING="0" BORDERCOLORLIGHT="BLACK" BORDERCOLORDARK="BLACK" CELLPADDING="0" NOWRAP>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.writeln('		<TD BGCOLOR="White" COLSPAN="2"><CENTER><B><font face="Arial color="Black" size=5></B>' + printTitle + '</font></CENTER></TD>');
			Win1.document.writeln('	</TR>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.write('		<TD BGCOLOR="white" WIDTH="600" HEIGHT="850" COLSPAN="1"');
			
			Win1.document.writeln('>');
			Win1.document.writeln('			<IMG SRC="' + printMapURL + '" WIDTH=600 HEIGHT=850 HSPACE=0 VSPACE=0 BORDER=0>');
			Win1.document.writeln('		</TD>');

			Win1.document.writeln('		<TD ALIGN="CENTER" VALIGN="TOP">');
			Win1.document.writeln('			<IMG SRC="' + printLegURL + '" WIDTH=150 HSPACE=0 VSPACE=0 BORDER=0 ALT="">');
			Win1.document.writeln('		</TD>');
			Win1.document.writeln('	</TR>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.writeln('		<TD BGCOLOR="White" COLSPAN="2"><font face="Arial color="Black" size=1>DISCLAIMER : Lexington County makes no warranty, representation or guaranty as to the content, sequence, accuracy, timeliness or completeness of any of the database information provided herein. The reader should not rely on the data provided herein for any reason. Lexington County explicitly disclaims any representations and warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.</font></TD>');
			Win1.document.writeln('	</TR>');

			Win1.document.writeln('</table>');
			
			
		}




// 11 x 17 Portrait

	else if (printsize == "large" && printlayout == "Portrait")
	{
			var Win1 = open("","PrintPage");
			//Win1.document.open();
			Win1.document.writeln('<html><meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><head>');
			Win1.document.writeln('<title>'+ titleList[4] +'</title>');
			Win1.document.writeln('</head>');
			Win1.document.writeln('<body BGCOLOR="White" TEXT="Black" LEFTMARGIN=0 TOPMARGIN=0>');
			
			Win1.document.writeln('<TABLE WIDTH="950" HEIGHT="1450" BORDER="2" CELLSPACING="0" BORDERCOLORLIGHT="BLACK" BORDERCOLORDARK="BLACK" CELLPADDING="0" NOWRAP>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.writeln('		<TD BGCOLOR="White" COLSPAN="2"><CENTER><B><font face="Arial color="Black" size=5></B>' + printTitle + '</font></CENTER></TD>');
			Win1.document.writeln('	</TR>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.write('		<TD BGCOLOR="white" WIDTH="800" HEIGHT="1450" COLSPAN="1"');
			
			Win1.document.writeln('>');
			Win1.document.writeln('			<IMG SRC="' + printMapURL + '" WIDTH=800 HEIGHT=1450 HSPACE=0 VSPACE=0 BORDER=0>');
			Win1.document.writeln('		</TD>');

			Win1.document.writeln('		<TD ALIGN="CENTER" VALIGN="TOP">');
			Win1.document.writeln('			<IMG SRC="' + printLegURL + '" WIDTH=150 HSPACE=0 VSPACE=0 BORDER=0 ALT="">');
			Win1.document.writeln('		</TD>');
			Win1.document.writeln('	</TR>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.writeln('		<TD BGCOLOR="White" COLSPAN="2"><font face="Arial color="Black" size=1>DISCLAIMER : Lexington County makes no warranty, representation or guaranty as to the content, sequence, accuracy, timeliness or completeness of any of the database information provided herein. The reader should not rely on the data provided herein for any reason. Lexington County explicitly disclaims any representations and warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.</font></TD>');
			Win1.document.writeln('	</TR>');

			Win1.document.writeln('</table>');
			
			
		}


// 8.5 x 11 - Landscape

	else if (printsize == "small" && printlayout == "Landscape")
	{
			var Win1 = open("","PrintPage");
			//Win1.document.open();
			Win1.document.writeln('<html><meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><head>');
			Win1.document.writeln('<title>'+ titleList[4] +'</title>');
			Win1.document.writeln('</head>');
			Win1.document.writeln('<body BGCOLOR="White" TEXT="Black" LEFTMARGIN=0 TOPMARGIN=0>');
			
			Win1.document.writeln('<TABLE WIDTH="1000" HEIGHT="650" BORDER="2" CELLSPACING="0" BORDERCOLORLIGHT="BLACK" BORDERCOLORDARK="BLACK" CELLPADDING="0" NOWRAP>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.writeln('		<TD BGCOLOR="White" COLSPAN="2"><CENTER><B><font face="Arial color="Black" size=5></B>' + printTitle + '</font></CENTER></TD>');
			Win1.document.writeln('	</TR>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.write('		<TD BGCOLOR="white" WIDTH="850" HEIGHT="650" COLSPAN="1"');
			
			Win1.document.writeln('>');
			Win1.document.writeln('			<IMG SRC="' + printMapURL + '" WIDTH=850 HEIGHT=650 HSPACE=0 VSPACE=0 BORDER=0>');
			Win1.document.writeln('		</TD>');

			Win1.document.writeln('		<TD ALIGN="CENTER" VALIGN="TOP">');
			Win1.document.writeln('			<IMG SRC="' + printLegURL + '" WIDTH=150 HSPACE=0 VSPACE=0 BORDER=0 ALT="">');
			Win1.document.writeln('		</TD>');
			Win1.document.writeln('	</TR>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.writeln('		<TD BGCOLOR="White" COLSPAN="2"><font face="Arial color="Black" size=1>DISCLAIMER : Lexington County makes no warranty, representation or guaranty as to the content, sequence, accuracy, timeliness or completeness of any of the database information provided herein. The reader should not rely on the data provided herein for any reason. Lexington County explicitly disclaims any representations and warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.</font></TD>');
			Win1.document.writeln('	</TR>');

			Win1.document.writeln('</table>');
			
			
		}



// 11 x 17 - Landscape

	else if (printsize == "large" && printlayout == "Landscape")
	{
			var Win1 = open("","PrintPage");
			//Win1.document.open();
			Win1.document.writeln('<html><meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><head>');
			Win1.document.writeln('<title>'+ titleList[4] +'</title>');
			Win1.document.writeln('</head>');
			Win1.document.writeln('<body BGCOLOR="White" TEXT="Black" LEFTMARGIN=0 TOPMARGIN=0>');
			
			Win1.document.writeln('<TABLE WIDTH="1550" HEIGHT="900" BORDER="2" CELLSPACING="0" BORDERCOLORLIGHT="BLACK" BORDERCOLORDARK="BLACK" CELLPADDING="0" NOWRAP>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.writeln('		<TD BGCOLOR="White" COLSPAN="2"><CENTER><B><font face="Arial color="Black" size=5></B>' + printTitle + '</font></CENTER></TD>');
			Win1.document.writeln('	</TR>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.write('		<TD BGCOLOR="white" WIDTH="1400" HEIGHT="900" COLSPAN="1"');
			
			Win1.document.writeln('>');
			Win1.document.writeln('			<IMG SRC="' + printMapURL + '" WIDTH=1400 HEIGHT=900 HSPACE=0 VSPACE=0 BORDER=0>');
			Win1.document.writeln('		</TD>');

			Win1.document.writeln('		<TD ALIGN="CENTER" VALIGN="TOP">');
			Win1.document.writeln('			<IMG SRC="' + printLegURL + '" WIDTH=150 HSPACE=0 VSPACE=0 BORDER=0 ALT="">');
			Win1.document.writeln('		</TD>');
			Win1.document.writeln('	</TR>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.writeln('		<TD BGCOLOR="White" COLSPAN="2"><font face="Arial color="Black" size=1>DISCLAIMER : Lexington County makes no warranty, representation or guaranty as to the content, sequence, accuracy, timeliness or completeness of any of the database information provided herein. The reader should not rely on the data provided herein for any reason. Lexington County explicitly disclaims any representations and warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.</font></TD>');
			Win1.document.writeln('	</TR>');

			Win1.document.writeln('</table>');
			
			
		}

	
	//Win1.document.writeln('</body></html>');
	Win1.document.close();
	
	legendVisible=legVis2;
	Win1=null;
	hideRetrieveMap();
}


