// 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 = "";
var printMapURL="";
var printOVURL="";
var printLegURL="";
var printsize="";
var printres="";
var printlayout="";

var datevar = new Date();
var thisyear = datevar.getFullYear();

var legVis2=true;

/*
***************************************************************************************

Print functions 

// EDITED BY BRIAN FITZGERALD
// RICHLAND COUNTY GIS
// WWW.RICHLANDMAPS.COM

***************************************************************************************
*/


// display print form
function printIt() {
	hideLayer("measureBox");
	if (useTextFrame) {
		//parent.TextFrame.document.location = "printform.htm";
		var Win1 = open("printform.htm","PrintFormWindow","width=575,height=500,scrollbars=yes,resizable=yes");
	} else {
		var Win1 = open("printform.htm","PrintFormWindow","width=575,height=500,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" && printres == "Low" && printlayout == "Portrait")
	{
		iWidth=570;
		iHeight=456;
	}
	else if(printsize == "small" && printres == "Normal" && printlayout == "Portrait")
	{
		iWidth=855;
		iHeight=684;
	}
	else if(printsize == "small" && printres == "High" && printlayout == "Portrait")
	{
		iWidth=1140;
		iHeight=912;
	}
	else if(printsize == "large" && printres == "Low" && printlayout == "Portrait")
	{
		iWidth=1520;
		iHeight=1216;
	}
	else if(printsize == "large" && printres == "Normal" && printlayout == "Portrait")
	{
		iWidth=1350;
		iHeight=1485;
	}
	else if(printsize == "large" && printres == "High" && printlayout == "Portrait")
	{
		iWidth=1800;
		iHeight=1980;
	}

// Print settings for Landscape

	else if(printsize == "small" && printres == "Low" && printlayout == "Landscape")
	{
		iWidth=547;
		iHeight=441;
	}
	else if(printsize == "small" && printres == "Normal" && printlayout == "Landscape")
	{
		iWidth=820;
		iHeight=661;
	}
	else if(printsize == "small" && printres == "High" && printlayout == "Landscape")
	{
		iWidth=1230;
		iHeight=992;
	}
	else if(printsize == "large" && printres == "Low" && printlayout == "Landscape")
	{
		iWidth=990;
		iHeight=900;
	}
	else if(printsize == "large" && printres == "Normal" && printlayout == "Landscape")
	{
		iWidth=1485;
		iHeight=1350;
	}
	else if(printsize == "large" && printres == "High" && printlayout == "Landscape")
	{
		iWidth=1980;
		iHeight=1800;
	}

// 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=249;
	i2Height=200;
	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>Charlotte County GIS - www.ccgis.com</title>');
			Win1.document.writeln('</head>');
			Win1.document.writeln('<body BGCOLOR="White" TEXT="#003366" LEFTMARGIN=0 TOPMARGIN=0>');
			
			Win1.document.writeln('<TABLE WIDTH="760" 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="Tahoma" color="#003366" size=5>' + printTitle + '</B></font></CENTER></TD>');
			Win1.document.writeln('	</TR>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.write('		<TD BGCOLOR="white" WIDTH="760" HEIGHT="608" COLSPAN="2"');
			//if (hasOVMap) Win1.document.write(' ROWSPAN="1"');
			Win1.document.writeln('>');
			Win1.document.writeln('			<IMG SRC="' + printMapURL + '" WIDTH=760 HEIGHT=608 HSPACE=0 VSPACE=0 BORDER=0>');
			Win1.document.writeln('		</TD>');
			
			Win1.document.writeln('	</TR>');
			Win1.document.writeln(' 	<TR>');
			Win1.document.writeln(' 		<TD BACKGROUND="/images/ccseal_gray.JPG" ALIGN="LEFT" VALIGN="TOP">');


		Win1.document.writeln('<TABLE CELLSPACING="0" BORDER="0"><TR>');
		Win1.document.writeln('<TD><center><IMG SRC="' + printOVURL + '" height=200 width=249 ></center></TD>');
		Win1.document.writeln('<TD colspan="2"><center><IMG SRC="../gis/images/ccseal.png" height=90 width=90 ></center><br>');
		Win1.document.writeln('<center><font face="Tahoma" size = "1"><B>Copyright ' + thisyear + '</font><br><font face="Tahoma" size = "1">Charlotte County GIS</font><br><font face="Tahoma" size = "1">18500 Murdock Circle</font><br><font face="Tahoma" size = "1">Port Charlotte, FL 33948</font><B></center></TD>');
		Win1.document.writeln('</tr><tr>');

		Win1.document.writeln('<TD colspan="3"><font face=Tahoma color="#003366" SIZE="1"><br>DISCLAIMER : This map is a representation of compiled public information.  It is believed to be an accurate and true depiction for the stated purpose, but Charlotte County and its employees make no guaranties, implied or otherwise to the accuracy or completeness.  We therefore do not accept any responsibilities as to its use.  This is not a survey or is it to be used for design.  C.C.G.I.S. maintains a record regarding the methods used to produce this map and can be furnished upon request.</font></TD>');

		Win1.document.writeln('</tr></table>');	
			

			
			Win1.document.writeln('		<TD>');
			Win1.document.writeln('		<center><IMG SRC="' + printLegURL + '" HEIGHT=300 SPACE=0 VSPACE=0 BORDER=0 ALT=""></center>');
			Win1.document.writeln('		</TD>');
			Win1.document.writeln('	</TR></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>Charlotte County GIS - www.ccgis.com</title>');
			Win1.document.writeln('</head>');
			Win1.document.writeln('<body BGCOLOR="White" TEXT="#003366" LEFTMARGIN=0 TOPMARGIN=0>');
			
			Win1.document.writeln('<TABLE WIDTH="990" 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="Tahoma" color="#003366" size=5>' + printTitle + '</B></font></CENTER></TD>');
			Win1.document.writeln('	</TR>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.write('		<TD BGCOLOR="white" WIDTH="990" HEIGHT="900" COLSPAN="2"');
			//if (hasOVMap) Win1.document.write(' ROWSPAN="1"');
			Win1.document.writeln('>');
			Win1.document.writeln('			<IMG SRC="' + printMapURL + '" WIDTH=990 HEIGHT=900 HSPACE=0 VSPACE=0 BORDER=0>');
			Win1.document.writeln('		</TD>');
			
			Win1.document.writeln('	</TR>');
			Win1.document.writeln(' 	<TR>');
			Win1.document.writeln(' 		<TD BACKGROUND="/images/ccseal_gray.JPG" ALIGN="LEFT" VALIGN="TOP">');


		Win1.document.writeln('<TABLE CELLSPACING="0" BORDER="0"><TR>');
		Win1.document.writeln('<TD><center><IMG SRC="' + printOVURL + '" height=200 width=249 ></center></TD>');
		Win1.document.writeln('<TD colspan="2"><center><IMG SRC="../gis/images/ccseal.png" height=90 width=90 ></center><br>');
		Win1.document.writeln('<center><font face="Tahoma" size = "1"><B>Copyright ' + thisyear + '</font><br><font face="Tahoma" size = "1">Charlotte County GIS</font><br><font face="Tahoma" size = "1">18500 Murdock Circle</font><br><font face="Tahoma" size = "1">Port Charlotte, FL 33948</font><B></center></TD>');
		Win1.document.writeln('</tr><tr>');

		Win1.document.writeln('<TD colspan="3"><font face=Tahoma color="#003366" SIZE="1"><br>DISCLAIMER : This map is a representation of compiled public information.  It is believed to be an accurate and true depiction for the stated purpose, but Charlotte County and its employees make no guaranties, implied or otherwise to the accuracy or completeness.  We therefore do not accept any responsibilities as to its use.  This is not a survey or is it to be used for design.  C.C.G.I.S. maintains a record regarding the methods used to produce this map and can be furnished upon request.</font></TD>');

		Win1.document.writeln('</tr></table>');	
			

			
			Win1.document.writeln('		<TD>');
			Win1.document.writeln('		<center><IMG SRC="' + printLegURL + '" HEIGHT=300 SPACE=0 VSPACE=0 BORDER=0 ALT=""></center>');
			Win1.document.writeln('		</TD>');
			Win1.document.writeln('	</TR></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>Charlotte County GIS - www.ccgis.com</title>');
			Win1.document.writeln('</head>');
			Win1.document.writeln('<body BGCOLOR="White" TEXT="#003366" LEFTMARGIN=0 TOPMARGIN=0>');
			
			Win1.document.writeln('<TABLE HEIGHT="680" WIDTH="900" BORDER="2" CELLSPACING="0" BORDERCOLORLIGHT="BLACK" BORDERCOLORDARK="BLACK" CELLPADDING="0" NOWRAP>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.writeln('		<TD ROWSPAN="3"><CENTER><B><font face="Tahoma" color="#003366" size=5>' + printTitle + '</B></font></CENTER>');
			Win1.document.writeln('		<IMG SRC="' + printMapURL + '" WIDTH=820 HEIGHT=661 HSPACE=0 VSPACE=0 BORDER=0></TD>');
			Win1.document.writeln('		<TD><center><IMG SRC="' + printOVURL + '" height=120 width=150 ></center></TD>');
//			Win1.document.writeln('		<TD ><CENTER><font face="Tahoma" color="#003366" size=5><B>' + printTitle + '</B></font></CENTER>  </TD>');
			Win1.document.writeln('	</TR>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.writeln('		<td WIDTH="350"><center><IMG SRC="' + printLegURL + '" HEIGHT=300 SPACE=0 VSPACE=0 BORDER=0 ALT=""></center></td>');
			Win1.document.writeln('	</TR>');

			Win1.document.writeln(' 	<TR>');
			Win1.document.writeln(' 		<TD BACKGROUND="/images/large_trans_seal_gray.JPG" ALIGN="LEFT" VALIGN="TOP">');
			

		Win1.document.writeln('<TABLE CELLSPACING="1" BORDER="0"><TR>');
		Win1.document.writeln('<TD><center><IMG SRC="../gis/images/ccseal.png" height=60 width=60 ></center>');
		Win1.document.writeln('<center><font face="Tahoma" size = "1"><B>Copyright ' + thisyear + '</font><br><font face="Tahoma" size = "1">Charlotte County GIS</font><br><font face="Tahoma" size = "1">18500 Murdock Circle</font><br><font face="Tahoma" size = "1">Port Charlotte, FL 33948</font><B></center></TD>');
		Win1.document.writeln('</tr><tr>');

		Win1.document.writeln('<TD colspan="3"><br><br><font face="Tahoma"><xxsmall>DISCLAIMER : This map is a representation of compiled public information.  It is believed to be an accurate and true depiction for the stated purpose, but Charlotte County and its employees make no guaranties, implied or otherwise to the accuracy or completeness.  We therefore do not accept any responsibilities as to its use.  This is not a survey or is it to be used for design.  C.C.G.I.S. maintains a record regarding the methods used to produce this map and can be furnished upon request.</xxsmall></font></TD>');

		Win1.document.writeln('</tr>');
		Win1.document.writeln('<tr>');
			
					
		}


// 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>Charlotte County GIS - www.ccgis.com</title>');
			Win1.document.writeln('</head>');
			Win1.document.writeln('<body BGCOLOR="White" TEXT="#003366" LEFTMARGIN=0 TOPMARGIN=0>');
			
			Win1.document.writeln('<TABLE HEIGHT="900" WIDTH="1300" BORDER="2" CELLSPACING="0" BORDERCOLORLIGHT="BLACK" BORDERCOLORDARK="BLACK" CELLPADDING="0" NOWRAP>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.writeln('		<TD ROWSPAN="3"><CENTER><B><font face="Tahoma" color="#003366" size=5>' + printTitle + '</B></font></CENTER>');
			Win1.document.writeln('		<IMG SRC="' + printMapURL + '" WIDTH=990 HEIGHT=900 HSPACE=0 VSPACE=0 BORDER=0></TD>');
			Win1.document.writeln('		<TD><center><IMG SRC="' + printOVURL + '" height=120 width=150 ></center></TD>');
//			Win1.document.writeln('		<TD ><CENTER><font face="Tahoma" color="#003366" size=5><B>' + printTitle + '</B></font></CENTER>  </TD>');
			Win1.document.writeln('	</TR>');
			
			Win1.document.writeln('	<TR>');
			Win1.document.writeln('		<td WIDTH="350"><center><IMG SRC="' + printLegURL + '" HEIGHT=300 SPACE=0 VSPACE=0 BORDER=0 ALT=""></center></td>');
			Win1.document.writeln('	</TR>');

			Win1.document.writeln(' 	<TR>');
			Win1.document.writeln(' 		<TD BACKGROUND="/images/large_trans_seal_gray.JPG" ALIGN="LEFT" VALIGN="TOP">');
			

		Win1.document.writeln('<TABLE CELLSPACING="1" BORDER="0"><TR>');
		Win1.document.writeln('<TD><center><IMG SRC="../gis/images/ccseal.png" height=60 width=60 ></center>');
		Win1.document.writeln('<center><font face="Tahoma" size = "1"><B>Copyright ' + thisyear + '</font><br><font face="Tahoma" size = "1">Charlotte County GIS</font><br><font face="Tahoma" size = "1">18500 Murdock Circle</font><br><font face="Tahoma" size = "1">Port Charlotte, FL 33948</font><B></center></TD>');
		Win1.document.writeln('</tr><tr>');

		Win1.document.writeln('<TD colspan="3"><br><br><font face="Tahoma" size = "1">DISCLAIMER : This map is a representation of compiled public information.  It is believed to be an accurate and true depiction for the stated purpose, but Charlotte County and its employees make no guaranties, implied or otherwise to the accuracy or completeness.  We therefore do not accept any responsibilities as to its use.  This is not a survey or is it to be used for design.  C.C.G.I.S. maintains a record regarding the methods used to produce this map and can be furnished upon request.</font></TD>');

		Win1.document.writeln('</tr>');
		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();
}

