// aimsIdentify.js
/*
*  JavaScript template file for ArcIMS HTML Viewer
*		dependent on aimsXML.js, ArcIMSparam.js, aimsCommon.js, aimsMap.js, and aimsLayers.js
*		To be interactive, dependent also on aimsDHTML.js, aimsClick.js, and aimsNavigation.js
*/

aimsIdentifyPresent=true;

// hyperlink variables
var currentHyperLinkLayer="";
var currentHyperLinkField="";
var currentHyperLinkPrefix="";
var currentHyperLinkSuffix="";
var hyperlinkWindowWidth=100;
var hyperlinkWindowHeight=400;

// variable for search tolerance... dynamically set in app
var searchTolerance=1/100;
// starting record position for returned records
var queryStartRecord=1;

if (imsQueryURL=="") {
	imsQueryURL= imsURL + "&CustomService=Query";
	//alert(imsQueryURL);
}
var canQuery=true;
var newSelectCount=0;
var selectPoints = new Array();

// can features be selected if invisible or not within layer scale threshholds?
var canSelectInvisible=false;


/*
***************************************************************************************

Identify functions 

***************************************************************************************
*/


// identify feature
function identify(e) {
//SET WEBPARC ACTIVE
	var t = parent.MapFrame;
	for (x=0;x<t.LayerName.length;x++) {
         if (t.LayerName[x] == "webparc3") {
            t.setActiveLayer(x);
         }
        }
	if (checkIfActiveLayerAvailable()) {
		highlightedOne="";
		var theX = mouseX;
		var theY = mouseY;
		getMapXY(theX,theY);
		searchTolerance = (xDistance/iWidth) * pixelTolerance;
		var tempWest = mapX - searchTolerance;
		var tempNorth = mapY + searchTolerance;
		var tempEast = mapX + searchTolerance;
		var tempSouth = mapY - searchTolerance;
		var theString = writeGetFeatures(tempWest,tempSouth,tempEast,tempNorth);
		//if (useTextFrame) parent.TextFrame.document.location = "text.htm";
		//alert(theString);
		showRetrieveData();
		sendToServer(imsQueryURL,theString,identifyXMLMode);
	}
}

// hyperlink from feature in active layer
function hyperLink(e) {
	if (checkIfActiveLayerAvailable()) {
		if (currentHyperLinkLayer!="") {
			highlightedOne="";
			var theX = mouseX;
			var theY = mouseY;
			getMapXY(theX,theY);
			searchTolerance = (xDistance/iWidth) * pixelTolerance;
			var tempWest = mapX - searchTolerance;
			var tempNorth = mapY + searchTolerance;
			var tempEast = mapX + searchTolerance;
			var tempSouth = mapY - searchTolerance;
			var tempSwap = swapSelectFields;
			swapSelectFields=false;
			var tempSelect = selectFields;
			selectFields = LayerIDField[ActiveLayerIndex] + " " + LayerShapeField[ActiveLayerIndex] + " " + currentHyperLinkField;
			var theString = writeGetFeatures(tempWest,tempSouth,tempEast,tempNorth);
			selectFields = tempSelect;
			swapSelectFields=tempSwap;
			showRetrieveData();
			//if (useTextFrame) parent.TextFrame.document.location = "text.htm";
			sendToServer(imsQueryURL,theString,hyperlinkXMLMode);
		} else {
			alert(msgList[47]);
		}
	}
}

function AerialToggleB() {
  //TOGGLE Aerial Photos
     parent.MapFrame.parURL=imgURL;
     var t = parent.MapFrame;
     for (x=0;x<t.LayerName.length;x++) {
              var thestring = t.LayerName[x]
              isphot = thestring.indexOf(".tif")
         if (isphot != -1) {
         //alert(t.LayerName[x] + " " + t.LayerID[x]);
     // where vis=1 means visible, vis=0 means hidden
            if (t.LayerVisible[x] == 1) {
              t.LayerVisible[x] = 0;
            } else if (t.LayerVisible[x] == 0) {
              t.LayerVisible[x] = 1;
            }
         } 
     }
    parent.MapFrame.sendMapXML();
}

function AerialToggle() {
  //TOGGLE Aerial Photos
     //printvar = 0 means it will print screen, 1 will print info sheet
     parent.MapFrame.printvar = 1
     parent.MapFrame.parURL=imgURL;
     newwin = window.open("http://www2.springfieldcityhall.com/gis/print.htm","","width=250,height=100,status=yes,toolbar=no,menubar=no")
     var t = parent.MapFrame;
     for (x=0;x<t.LayerName.length;x++) {
              var thestring = t.LayerName[x]
              isphot = thestring.indexOf(".tif")
         if (isphot != -1) {
         //alert(t.LayerName[x] + " " + t.LayerID[x]);
     // where vis=1 means visible, vis=0 means hidden
            if (t.LayerVisible[x] == 1) {
              t.LayerVisible[x] = 0;
            } else if (t.LayerVisible[x] == 0) {
              t.LayerVisible[x] = 1;
            }
         } 
     }
    //setTimeout("parent.MapFrame.sendMapXML();",1000);
    parent.MapFrame.sendMapXML();
    setTimeout("parent.MapFrame.clickFunction(\'print\')",30000);
    setTimeout("parent.MapFrame.phoURL=imgURL;",31000);
  
   //TOGGLE Aerial Photos
    setTimeout("AerialToggleB();",40000)
}

//*******************4/26/2004**************
function PrintScreen() {
  //TOGGLE Aerial Photos
     //printvar = 0 means it will print screen, 1 will print info sheet
     parent.MapFrame.printvar = 0
     parent.MapFrame.parURL=imgURL;
     newwin = window.open("http://www2.springfieldcityhall.com/gis/print.htm","","width=250,height=100,status=yes,toolbar=no,menubar=no")
     var t = parent.MapFrame;

    parent.MapFrame.sendMapXML();
    setTimeout("parent.MapFrame.clickFunction(\'print\')",7000);
  
}
//*******************4/26/2004**************


// write out XML request to identify features
function writeGetFeatures(west1,south1,east1,north1) {
	if (swapSelectFields) {
		selectFields=selFieldList[ActiveLayerIndex];
	}
	var useString = writeIdentifyXML(ActiveLayer,ActiveLayerType,selectFields,west1,south1,east1,north1,maxFeaturesReturned,useLimitExtent);
	hightlightedOne="";
	return useString;
}

function writeIdentifyXML(theLayer,theLayerType,theFields,leftX,bottomY,rightX,topY,maxReturned,hasLimit) {
	var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_FEATURES outputmode="xml" envelope="false" geometry="false" featurelimit="' + maxReturned + '">\n';
	theString += '<LAYER id="' + theLayer + '" />';
	theString += '<SPATIALQUERY subfields="' + theFields + '">';
	theString += '<SPATIALFILTER relation="area_intersection" >';
	theString += '<ENVELOPE maxy="' + forceComma(topY) + '" maxx="' + forceComma(rightX) + '" miny="' + forceComma(bottomY) + '" minx="' + forceComma(leftX) + '" />';
	theString += '</SPATIALFILTER>';
	theString += '</SPATIALQUERY>';
	if (hasLimit) {
		// keep this within the limitExtent
		theString += '<SPATIALFILTER relation="area_intersection">\n';
		theString += '<ENVELOPE maxx="' + forceComma(limitRight) + '" maxy="' + forceComma(limitTop) + '" minx="' + forceComma(limitLeft) + '" miny="' + forceComma(limitBottom) + '" />\n';
		theString += '</SPATIALFILTER>\n';
	}
	theString += '</GET_FEATURES>';
	theString += '</REQUEST>';
	theString += '</ARCXML>';
	return theString;
}

// parse XML response for selected features
function displayAttributeData(theReply) {
	//alert("blah!");
    //alert(theReply);
	setLayerFields(ActiveLayerIndex);
	var theError = getXMLErrorMessage(theReply);
	var fList="";
	var lpos1 = 1;
	var lpos2 = 1;
	var epos = 1;
	var spos = 1;
	var morePoints=true;
	var moreFeatures=true;
	var featureCount = justGetFeatureCount(theReply);
	//alert(featureCount);
	var pos = 0;
	var startpos = 0;
	var endpos = xmlEndPos;
	var stillMore = false
	pos = theReply.indexOf('hasmore="true"',endpos);
	if (pos!=-1) stillMore = true;
	pos=0;
	var tempCount = 0;
	var selectedData="";
	var inData="";
	var xStr="";
	var yStr="";
	var tempString = "";
	var fCount = featureCount;
	//alert("displayAttributeData()[featurecount=" + featureCount + "]");
	selectCount = 0;
	var tempString="";
	var Win1 = parent.Text3Frame;
	var theFrame = "parent.MapFrame";
	if (featureCount > 0) {
		newSelectCount += 1;

		if (showSelectedData) {
			//alert("displayAttributeData()[opening html page]");
			if ((useExternalWindow) || (!useTextFrame)) {
				Win1 = window.open("","QueryWindow","width=575,height=120,scrollbars=yes,resizable=yes");
				theFrame = "opener";
				if (parent.MapFrame!=null) theFrame = "opener.parent.MapFrame";
			} else {
				Win1 = parent.Text3Frame;
				Win1.document.open();
			}
			Win1.document.open();
          


          parent.MapFrame.LocArray = (getParFieldValues(theReply,'LOC',justGetFeatureCount(theReply)));
          parent.MapFrame.SpArray = (getParFieldValues(theReply,'STR_PARC_C',justGetFeatureCount(theReply)));
          parent.MapFrame.OwnArray = (getParFieldValues(theReply,'OWN_NAME',1));
          parent.MapFrame.M1Array = (getParFieldValues(theReply,'MAIL1',1));
          parent.MapFrame.M2Array = (getParFieldValues(theReply,'MAIL2',1));
          parent.MapFrame.M3Array = (getParFieldValues(theReply,'MAIL3',1));
          parent.MapFrame.M4Array = (getParFieldValues(theReply,'MAIL4',1));
          parent.MapFrame.AreaArray = (getParFieldValues(theReply,'AREA_SQFT',justGetFeatureCount(theReply)));
          parent.MapFrame.ValArray = (getParFieldValues(theReply,'ASSESSED',justGetFeatureCount(theReply)));
          parent.MapFrame.NeiArray = (getParFieldValues(theReply,'NEIHOOD',justGetFeatureCount(theReply)));
          parent.MapFrame.CensArray = (getParFieldValues(theReply,'CENS_TRACT',justGetFeatureCount(theReply)));
          parent.MapFrame.CensbArray = (getParFieldValues(theReply,'CENS_BLOCK',justGetFeatureCount(theReply)));
          parent.MapFrame.ZonArray = (getParFieldValues(theReply,'ZONE_NAME',justGetFeatureCount(theReply)));
          parent.MapFrame.YearArray = (getParFieldValues(theReply,'YEARBUILT',justGetFeatureCount(theReply)));
          parent.MapFrame.FZArray = (getParFieldValues(theReply,'FLOODZONE',justGetFeatureCount(theReply)));
          parent.MapFrame.FPArray = (getParFieldValues(theReply,'FLOODPANEL',justGetFeatureCount(theReply)));
          parent.MapFrame.SaleBArray = (getParFieldValues(theReply,'SALEBOOK',justGetFeatureCount(theReply)));
          parent.MapFrame.SalePaArray = (getParFieldValues(theReply,'SALEPAGE',justGetFeatureCount(theReply)));
          parent.MapFrame.SaleDArray = (getParFieldValues(theReply,'SALEDATE',justGetFeatureCount(theReply)));
          parent.MapFrame.SaleTArray = (getParFieldValues(theReply,'SALETYPE',justGetFeatureCount(theReply)));
          parent.MapFrame.SalePrArray = (getParFieldValues(theReply,'SALEPRICE',justGetFeatureCount(theReply)));
          parent.MapFrame.StyArray = (getParFieldValues(theReply,'STYLE',justGetFeatureCount(theReply)));
          parent.MapFrame.StorArray = (getParFieldValues(theReply,'STORIES',justGetFeatureCount(theReply)));
          parent.MapFrame.UnitArray = (getParFieldValues(theReply,'UNITSZ',justGetFeatureCount(theReply)));
          parent.MapFrame.RoomArray = (getParFieldValues(theReply,'ROOMS',justGetFeatureCount(theReply)));
          parent.MapFrame.AnbhdArray = (getParFieldValues(theReply,'ASSESS_NBD',justGetFeatureCount(theReply)));
          parent.MapFrame.PlanArray = (getParFieldValues(theReply,'BLOCK_PLAN',justGetFeatureCount(theReply)));
          //parent.MapFrame.BlockArray = (getParFieldValues(theReply,'BLOCK',justGetFeatureCount(theReply)));
          parent.MapFrame.LotArray = (getParFieldValues(theReply,'LOT',justGetFeatureCount(theReply)));
          parent.MapFrame.LUseArray = (getParFieldValues(theReply,'LANDUSE',justGetFeatureCount(theReply)));
          parent.MapFrame.CCodeArray = (getParFieldValues(theReply,'CLASS_CODE',justGetFeatureCount(theReply)));
          parent.MapFrame.TaxamArray = (getParFieldValues(theReply,'TAXAMT',justGetFeatureCount(theReply)));
          parent.MapFrame.TTCArray = (getParFieldValues(theReply,'TTCODE',justGetFeatureCount(theReply)));
          parent.MapFrame.TTYArray = (getParFieldValues(theReply,'TTYEAR',justGetFeatureCount(theReply)));
          parent.MapFrame.HistArray = (getParFieldValues(theReply,'HISTORIC',justGetFeatureCount(theReply)));
//        parent.MapFrame.CondArray = //(getParFieldValues(theReply,'CONDITION',justGetFeatureCount(theReply)));
          parent.MapFrame.CDArray = (getParFieldValues(theReply,'CDBG_2000',justGetFeatureCount(theReply)));
          parent.MapFrame.XArray = (getParFieldValues(theReply,'X_OVERLAY',justGetFeatureCount(theReply)));
          parent.MapFrame.DayArray = (getParFieldValues(theReply,'DAY',justGetFeatureCount(theReply)));
                                                                                  

/////////////////////////6/16/04/////////////////////
    if (parent.MapFrame.qtype = "normal") {
/////////////////////////6/16/04/////////////////////
                        
          Win1.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">');
          Win1.document.writeln('<HTML>');
          Win1.document.writeln('<HEAD>');
          Win1.document.writeln('<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">');
                     //parent.Text2Frame.document.writeln('var spnum = "";');
                     //parent.Text2Frame.document.writeln('function spnumlook(spnum) {');
                     //parent.Text2Frame.document.writeln('var t = parent.MapFrame;');
                     //parent.Text2Frame.document.writeln('t.setActiveLayer(12);');
                     //parent.Text2Frame.document.writeln("var pQString = 'STR_PARC_C like &apos;' + spnum + '&apos;';");
                     //parent.Text2Frame.document.writeln('t.sendQueryString(pQString);')
                     //parent.Text2Frame.document.writeln('}');



//FUNNNCTION
Win1.document.writeln("function openNewWindow(newwin) { ");
Win1.document.writeln("  popupWin = window.open('http://www2.springfieldcityhall.com/gis/' + newwin, 'open_window', 'menubar,toolbar,location,directories,status,scrollbars,resizable,dependent,width=600,height=600,left=200,top=50');   ");
Win1.document.writeln("}");
//FUNNNCTION

//FUNNNCTION
Win1.document.writeln("function openNewWindow2(newwin) { ");
Win1.document.writeln("  popupWin = window.open('' + newwin, 'open_window', 'menubar,toolbar,location,directories,status,scrollbars,resizable,dependent,width=800,height=650,left=200,top=50');   ");
Win1.document.writeln("}");
//FUNNNCTION

          Win1.document.writeln('</SCRIPT>');
          Win1.document.writeln('</HEAD>');

var stylePage="<style type=\"text/css\">.rightSideText{margin:0px 6px 0px 0px;}html > body  .topRightText {border-right:6px solid #82ac7a;background:#FFFFFF;color:#2B74B1;width:100%;height:100%;}* html  .topRightText {border-right:6px solid #82ac7a;background:#FFFFFF;color:#2B74B1;height:100%;width:235px;}body {font-family: Tahoma, Trebuchet MS, Arial, Helvetica, sans-serif;font-size: 0.8em;background-color: #2b74b1;}.text3Frame{font-family: Arial, Helvetica, sans-serif;overflow:scroll;overflow-x:hidden;font-size: 9pt; color:#09274f;padding-left:0.5em;width:97%;height:200px;}</style>";
		  
		  Win1.document.writeln(stylePage);
          Win1.document.writeln('<BODY class="rightSideText" link=#b00008 vlink=#b00008 alink=#EBAF8B TEXT=#b00008 TOPMARGIN=0 LEFTMARGIN=0>');
                  //var x = 0;
                  //for (x = 0; x<1; x++){
                  //hrstring = "javascript:spnumlook(" + "'" + parent.MapFrame.SpArray[x] + "'" + ");"
                  //parent.Text2Frame.document.writeln("<center><a href=" + hrstring + ">" + parent.MapFrame.AddArray[x] + "</a><br></center>");          
 //         Win1.document.writeln("<br>");
		  Win1.document.writeln('<table cellpadding="0" cellspacing="0" class="topRightText"><tr><td><div class="text3Frame">');
          
//DISPLAY TUTORIAL DATA
          if (tut1 == 1) {          
          Win1.document.writeln("<center><table width='200' cellpadding=0 cellspacing=2><tr bgcolor=#82AC7A>");
          Win1.document.writeln("<td colspan=2><center><image src='http://www2.springfieldcityhall.com/gis/images/seartut4.gif'></center></td></tr>");
          Win1.document.writeln("</table>");
          }

Win1.document.writeln("<center><table width='200' cellpadding=3 cellspacing=2><tr bgcolor=#82AC7A>");
          
          Win1.document.writeln("<td colspan=2><center><font size=-1><b>" + parent.MapFrame.LocArray[0] + "</b></font></center></td></tr>");
          Win1.document.writeln("</table>");
          Win1.document.writeln("<center><table cellpadding=0 cellspacing=0>");
          Win1.document.writeln("<tr><td><font color=#09274f size=-1>" + parent.MapFrame.OwnArray + "</font></td></tr>");
          Win1.document.writeln("<tr><td><font color=#09274f size=-1>" + parent.MapFrame.M1Array + "</font></td></tr>");
          Win1.document.writeln("<tr><td><font color=#09274f size=-1>" + parent.MapFrame.M2Array + "</font></td></tr>");
          if (parent.MapFrame.M3Array != "") {
          Win1.document.writeln("<tr><td><font color=#09274f size=-1>" + parent.MapFrame.M3Array + "</font></td></tr>");
          }
          if (parent.MapFrame.M4Array != "") {
          Win1.document.writeln("<tr><td><font color=#09274f size=-1>" + parent.MapFrame.M4Array + "</font></td></tr>");
          }
          Win1.document.writeln("</table></center>");
          Win1.document.writeln("<center><table width='200' cellpadding=3 cellspacing=2><tr bgcolor=#82AC7A>");
          Win1.document.writeln("<tr bgcolor=#82AC7A><td align=left><font size=-1>Street-Parcel </font></td><td align=right><font size=-1><b>" + parent.MapFrame.SpArray[0] + "</b></font></td></tr>");
          Win1.document.writeln("<tr bgcolor=#82AC7A><td align=left><font size=-1>Land Area </font></td><td align=right><font size=-1><b>" + parent.MapFrame.AreaArray[0] + " sq.ft.</b></font></td></tr>");
          Win1.document.writeln("<tr bgcolor=#82AC7A><td align=left><font size=-1>Assessed Value </font></td><td align=right><font size=-1><b>$" + parent.MapFrame.ValArray[0] + "</b></font></td></tr>");
          Win1.document.writeln("</tr></table></center>");
          Win1.document.writeln("<center><table cellpadding=1 cellspacing=0 width='200'>");
          Win1.document.writeln("<br>");
          Win1.document.writeln("<center><table cellpadding=1 cellspacing=0 width='200'>");
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Neighborhood:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.NeiArray[0] + "</font></td></tr>");

 //hrstring = "javascript:spnumlook(" + "'" + parent.MapFrame.SpArray[x] + "'" + ");"

if (parent.MapFrame.ZonArray[0] == "Residence A") {
            var zonfile = "resa.htm";
} else if (parent.MapFrame.ZonArray[0] == "Residence A-1"){
            var zonfile = "resa1.htm"
} else if (parent.MapFrame.ZonArray[0] == "Residence B"){
            var zonfile = "resb.htm"
} else if (parent.MapFrame.ZonArray[0] == "Residence B-1"){
            var zonfile = "resb1.htm"
} else if (parent.MapFrame.ZonArray[0] == "Residence C"){
            var zonfile = "resc.htm"
} else if (parent.MapFrame.ZonArray[0] == "Residence C-1"){
            var zonfile = "resc1.htm"
} else if (parent.MapFrame.ZonArray[0] == "Residence C-2"){
            var zonfile = "resc2.htm"
} else if (parent.MapFrame.ZonArray[0] == "Industrial A"){
            var zonfile = "inda.htm"
} else if (parent.MapFrame.ZonArray[0] == "Industrial Park"){
            var zonfile = "indp.htm"
} else if (parent.MapFrame.ZonArray[0] == "Business A"){
            var zonfile = "busa.htm"
} else if (parent.MapFrame.ZonArray[0] == "Business B"){
            var zonfile = "busb.htm"
} else if (parent.MapFrame.ZonArray[0] == "Business C"){
            var zonfile = "busc.htm"
} else if (parent.MapFrame.ZonArray[0] == "Office A"){
            var zonfile = "offa.htm"
} else if (parent.MapFrame.ZonArray[0] == "Commercial A"){
            var zonfile = "comma.htm"
} else if (parent.MapFrame.ZonArray[0] == "Commercial P"){
            var zonfile = "commp.htm"
} else if (parent.MapFrame.ZonArray[0] == "Conn Riverfront"){
            var zonfile = "connriv.htm"
} else if (parent.MapFrame.ZonArray[0] == "West Columbus"){
            var zonfile = "wcol.htm"
} else if (parent.MapFrame.ZonArray[0] == "Split"){
            var zonfile = "split.htm"
}


         Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Zoning:</font></td><td width=2></td><td><font color=#b00008 size=-1><a href='javascript:openNewWindow(\"" + zonfile + "\")'>" + parent.MapFrame.ZonArray[0] + "</a></font></td></tr>");
//Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Zoning:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.ZonArray[0] + "</font></td></tr>");
          if ((parent.MapFrame.DayArray[0] != "") & (parent.MapFrame.DayArray[0] != "0")) { 
          Win1.document.writeln("<tr><td align=right><font color=#2B74B1 style='font-weight:bold;' size=-1>* NEW </font><font color=#09274f style=bold size=-1>Trash Day:</font></td><td width=2></td><td><font color=#2B74B1 size=-1><a href='http://www.springfieldcityhall.com/DPW/solid_waste.html' target='_blank'>" + parent.MapFrame.DayArray[0] + "</a></font></td></tr>");
          }
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Census Tract:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.CensArray[0] + "</font></td></tr>");
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Census Block Group:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.CensbArray[0] + "</font></td></tr>");
                    

          if ((parent.MapFrame.YearArray[0] != "") & (parent.MapFrame.YearArray[0] != "0")) {
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Year Built:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.YearArray[0] + "</font></td></tr>");
          }
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Block Plan:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.PlanArray[0] + "</font></td></tr>");
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Flood Zone:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.FZArray[0] + "</font></td></tr>");
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Flood Panel:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.FPArray[0] + "</font></td></tr>");
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Flood Panel Date:</font></td><td width=2></td><td><font color=#b00008 size=-1>June 17th, 1991</font></td></tr>");     
          if ((parent.MapFrame.SaleBArray[0] != "") & (parent.MapFrame.SaleBArray[0] != "0")) {
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Sale Book:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.SaleBArray[0] + "</font></td></tr>");
          }
          if ((parent.MapFrame.SalePaArray[0] != "") & (parent.MapFrame.SalePaArray[0] != "0")) {
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Sale Page:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.SalePaArray[0] + "</font></td></tr>");
          }
          if ((parent.MapFrame.SaleDArray[0] != "") & (parent.MapFrame.SaleDArray[0] != "00000000") & (parent.MapFrame.SaleDArray[0] != "0")) {        
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Sale Date:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.SaleDArray[0] + "</font></td></tr>");
          } 
          if ((parent.MapFrame.SaleTArray[0] != "") & (parent.MapFrame.SaleTArray[0] != "0")) {          
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Sale Type:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.SaleTArray[0] + "</font></td></tr>");
          }
          if ((parent.MapFrame.SalePrArray[0] != "") & (parent.MapFrame.SalePrArray[0] != "0")) {          
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Sale Price:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.SalePrArray[0] + "</font></td></tr>");
          }
          if ((parent.MapFrame.StyArray[0] != "") & (parent.MapFrame.StyArray[0] != "0")) { 
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Style:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.StyArray[0] + "</font></td></tr>");
          }  
          if ((parent.MapFrame.StorArray[0] != "") & (parent.MapFrame.StorArray[0] != "0")) { 
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Stories:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.StorArray[0] + "</font></td></tr>");
          } 
          if ((parent.MapFrame.UnitArray[0] != "") & (parent.MapFrame.UnitArray[0] != "0")) {           
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Units:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.UnitArray[0] + "</font></td></tr>");
          }
          if ((parent.MapFrame.RoomArray[0] != "") & (parent.MapFrame.RoomArray[0] != "0")) {           
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Rooms:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.RoomArray[0] + "</font></td></tr>");
          }
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Assessor's Nbhd:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.AnbhdArray[0] + "</font></td></tr>");
          //Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Block:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.BlockArray[0] + "</font></td></tr>");
          if ((parent.MapFrame.LotArray[0] != "") & (parent.MapFrame.LotArray[0] != "0")) { 
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Lot:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.LotArray[0] + "</font></td></tr>");
          }
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Land Use:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.LUseArray[0] + "</font></td></tr>");
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Class Code:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.CCodeArray[0] + "</font></td></tr>");
          if ((parent.MapFrame.TaxamArray[0] != "") & (parent.MapFrame.TaxamArray[0] != "0")) { 
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Tax Amount:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.TaxamArray[0] + "</font></td></tr>");
          }
          if ((parent.MapFrame.TTCArray[0] != "") & (parent.MapFrame.TTCArray[0] != "0")) { 
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Tax Title Code:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.TTCArray[0] + "</font></td></tr>");
          }
          if ((parent.MapFrame.TTYArray[0] != "") & (parent.MapFrame.TTYArray[0] != "0")) { 
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Tax Title Year:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.TTYArray[0] + "</font></td></tr>");
          }
          if ((parent.MapFrame.HistArray[0] != "") & (parent.MapFrame.HistArray[0] != "0")) { 
          Win1.document.writeln("<tr><td align=right><font color=#09274f style=bold size=-1>Historic:</font></td><td width=2></td><td><font color=RED size=-1>" + parent.MapFrame.HistArray[0] + "</font></td></tr>");
          }
          if ((parent.MapFrame.XArray[0] != "") & (parent.MapFrame.XArray[0] != "0")) { 
          Win1.document.writeln("<tr><td align=right><font color=#2B74B1 style=bold size=-1>X Overlay:</font></td><td width=2></td><td><font color=#2B74B1 size=-1>" + parent.MapFrame.XArray[0] + "</font></td></tr>");
          }
//          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>Condition:</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.CondArray[0] + "</font></td></tr>");				
          Win1.document.writeln("<tr><td align=right><font color=#09274f size=-1>CD Eligible (2000):</font></td><td width=2></td><td><font color=#b00008 size=-1>" + parent.MapFrame.CDArray[0] + "</font></td></tr>");				
          Win1.document.writeln("<br>");      

	  spnumb = parent.MapFrame.SpArray[0].substring(0,5) + parent.MapFrame.SpArray[0].substring(6,10)
          link1string = "http://www.springfieldcityhall.com/finance/index.php?id=pmthisdetails&parcelId="         
 	  link2stringa = "http://www.springfieldcityhall.com/finance/lookup.0.html?parcel=";
          linkString3="http://www.springfieldcityhall.com/finance/index.php?id=tax-liens&option=results&streetParcel="+spnumb
          //link2stringb = "&series_card=1"
          
Win1.document.writeln("</table></center>");
Win1.document.writeln("<br>");
Win1.document.writeln("<table width=200 cellpadding=0 cellspacing=2><tr><td><table cellpadding=1 cellspacing=0 style='background:#D6E7F9;border:1px solid #2B74B1;width:100%;'><tr><td>");
          Win1.document.writeln("<center><font size=-1><a href=javascript:openNewWindow2('" + link1string + spnumb + "')>See Taxes<br><b>(courtesy of Collectors' site)</b></a></font></center></td></tr></table></td></tr>");
          Win1.document.writeln("<tr><td><table cellpadding=1 cellspacing=0 style='background:#D6E7F9;border:1px solid #2B74B1;width:100%;'><tr><td><center><font size=-1><a href=javascript:openNewWindow2('"+linkString3+"')>See if this property has a tax lien<br></a></font></center></td></tr></table></td></tr>");
          Win1.document.writeln("<tr><td><table cellpadding=1 cellspacing=0 style='background:#D6E7F9;border:1px solid #2B74B1;width:100%;'><tr><td><center><font size=-1><a href=javascript:openNewWindow2('" + link2stringa + spnumb +"')>See Property Card<br><b>(courtesy of Assessors' site)</b></a></font></center></td></tr></table></td></tr>");
Win1.document.writeln("</table>");
Win1.document.writeln("<br><center>");

          if (tut1 == 1) {          
          Win1.document.writeln("<center><table width='200' cellpadding=0 cellspacing=2><tr bgcolor=#82AC7A>");
          Win1.document.writeln("<td colspan=2><center><image src='http://www2.springfieldcityhall.com/gis/images/seartut5.gif'></center></td></tr>");
          Win1.document.writeln("</table>");
          }

                                        if ((parent.MapFrame.printinfo == 1) && (tut1 == 0)) {
					Win1.document.writeln('<img src="' + parent.MapFrame.docLoc + 'images/printprop.gif" width=100 height=100 hspace=0 vspace=0 border=0 onmousedown="parent.MapFrame.AerialToggle(); ">');
//*******************4/26/2004**************
					Win1.document.writeln('<img src="' + parent.MapFrame.docLoc + 'images/printscr.gif" width=100 height=100 hspace=0 vspace=0 border=0 onmousedown="parent.MapFrame.PrintScreen(); ">');
//*******************4/26/2004**************
Win1.document.writeln("<table width=205><tr><td><font size=-1 color=#b00008><b>Note to all users:</b> Please disable all popup blocking software, or the print feature on this page <b>WILL NOT WORK</b>. <br><br></font><font size=-1 color=#b00008>");
Win1.document.writeln("For users of <b>Windows XP</b>, you must disable popup blocking for this site in Internet Explorer.  <b>Instructions:</b> Go to </font><font size=-1 color=#2B74B1><b>Tools</b></font><font size=-1 color=#b00008>, </font><font size=-1 color=#2B74B1><b>Internet Options</b></font><font size=-1 color=#b00008>, and under the </font><font size=-1 color=#2B74B1><b>Privacy</b></font><font size=-1 color=#b00008> tab, and </font><font size=-1 color=#2B74B1><b>Pop-up Blocker</b></font><font size=-1 color=#b00008>, hit the </font><font size=-1 color=#2B74B1><b>Settings</b></font><font size=-1 color=#b00008> button.  Under </font><font size=-1 color=#2B74B1><b>Allow popups from these sites</b></font><font size=-1 color=#b00008>, type </font><font size=-1 color=#2B74B1>www2.springfieldcityhall.com</font><font size=-1 color=#b00008> and click </font><font size=-1 color=#2B74B1><b>Add</b>.</p></font></td></tr></table>");

                                                                                //alert (parent.MapFrame.printinfo);
                                        }
Win1.document.writeln("</center>");
Win1.document.writeln('</div></td></tr></table>');
          Win1.document.writeln("</body>");
          Win1.document.writeln("</html>");
}
		endpos = 1;
		
/////////////////////////6/16/04/////////////////////
   }
/////////////////////////6/16/04/////////////////////

		for (var i=0;i<fCount;i++) {
			//alert(endpos);
			if (toolMode!=4) {
				var theXYs = getEnvelopeXYs(theReply, endpos)
				selectLeft[selectCount] = theXYs[0];
				selectBottom[selectCount] = theXYs[1];
				selectRight[selectCount] = theXYs[2];
				selectTop[selectCount] = theXYs[3];
				endpos = xmlEndPos;
			}
			//alert(endpos);
			inData = parseRecordString(theReply, endpos);
			endpos = xmlEndPos;
			//selectedData = clearLeadingSpace(inData);
			selectedData = inData;
			
			epos = theReply.indexOf("</FEATURE",endpos);
 
			if (showSelectedData) {
				//alert("2\n" + selectedData);
				var showHyper = false;
				if (hyperLinkLayers!=null) {
					for (var s1=0;s1<hyperLinkLayers.length;s1++) {
						if (hyperLinkLayers[s1] == LayerName[ActiveLayerIndex]) showHyper=true;
					}
				}
					
				var fName1 = getFieldNames(selectedData);
				var fValue1 = getFieldValues(selectedData);
				selectPoints[selectCount] = getIdValue(fName1, fValue1);
				
				var idFieldNum = -1;
				var shapeFieldNum = -1;
				if (hideIDFieldData) {
					// hide ID column header
					for (var f=0;f<fName1.length;f++) {
						if (fName1[f]==LayerIDField[ActiveLayerIndex]) idFieldNum = f;
					}
				}
				if (hideShapeFieldData) {
					// hide Shape column header
					for (var f=0;f<fName1.length;f++) {
						if (fName1[f]==LayerShapeField[ActiveLayerIndex]) shapeFieldNum = f;
					}
				}
				
				/*if (selectCount==0) {
					Win1.document.write('<tr><th><FONT FACE="Arial" SIZE="-2">' + msgList[86] + '</FONT></a></th>');
					for (var f=0;f<fName1.length;f++) {
						if ((f!=idFieldNum) && (f!=shapeFieldNum)) {
							var f2 = -1;
							if (useFieldAlias) {
								for (var f3=0;f3<AliasFieldName.length;f3++) {
									if (AliasFieldName[f3]==fName1[f]) f2 = f3;
								}
							}
							if (f2!=-1) {
								Win1.document.write('<th><FONT FACE="Arial" SIZE="-2">' + AliasFieldAlias[f2].substring(0).toUpperCase +  AliasFieldAlias[f2].substring(1,AliasFieldAlias[f2].length - 1).toLowerCase + '</FONT></a></th>');
							} else {
								Win1.document.write('<th><FONT FACE="Arial" SIZE="-2">' + fName1[f].substring(0).toUpperCase +  fName1[f].substring(1,fName1[f].length - 1).toLowerCase + '</FONT></a></th>');
							}
						}
					}
					Win1.document.writeln('</tr>');
				}*/

				Win1.document.write('<tr><td>');
//THIS IS WHERE ARCIMS WRITES THE RECORD ZOOM BOX				
                                //if (toolMode!=4) Win1.document.write('<a href="javascript:' + theFrame + '.showHighlight(' + selectCount + ')">');
				//Win1.document.write('<FONT FACE="Arial" SIZE="-2">' + (selectCount+queryStartRecord) + '</FONT>');
				if (toolMode!=4) Win1.document.write('</a>');
				//Win1.document.writeln('</td>');
				for (var f=0;f<fName1.length;f++) {	
					if ((f!=idFieldNum) && (f!=shapeFieldNum)) {
					
//THIS IS WHERE ARCIMS WRITES THE DEFAULT INFO BOX	
                                         //Win1.document.write('<TR><TD><b><font FACE="Arial" SIZE="2">' + fName1[f] + '   ' + '</font></b><td>');
						
                                                var isHyper=false;
						if (showHyper) {
							for (var s1=0;s1<hyperLinkFields.length;s1++) {
								if (hyperLinkFields[s1]==fName1[f]) {
									var theLinkURL = currentHyperLinkPrefix + fValue1[f] + currentHyperLinkSuffix;
									Win1.document.write('<a href="' + theLinkURL + '" target="_blank">');
									isHyper=true;
								}
							}
						}
						var s2 = -1;
						for (var s1=0;s1<LayerFields.length;s1++) {
							if (fName1[f]==LayerFields[s1]) s2=s1;
						}
						if (LayerFieldType[s2]=="91") {
							//alert(fName1[f]);
							if (isNaN(fValue1[f])) {
								var theDate = fValue1[f];
							} else {
								//var theDate = new Date(parseInt(fValue1[f]));
								var theDateObj = new Date(parseFloat(fValue1[f]));
								var d = theDateObj.toUTCString();
								var theDate = d.replace(/GMT|UTC/,"");
							}
							Win1.document.write('<FONT FACE="Arial" SIZE="-2">' + theDate + '</FONT>');
							theDate=null;
						} else {
							// put html entity for spaces so display is correct - browsers trim extra spaces
							tempString = fValue1[f].replace(/ /g, "&nbsp;");
							//Win1.document.write('<FONT FACE="Arial" SIZE="-2">' + tempString + '</FONT>');
							//Win1.document.write('<FONT FACE="Arial" SIZE="-2">' + fValue1[f] + '</FONT>');
						}
						if (isHyper) Win1.document.write('</a>');
						Win1.document.writeln('</td>');
					}
				}
				Win1.document.writeln('</tr>');
				fName1 = null;
				fValue1 = null;
				
			}
			selectCount += 1;
					
		}
		if (showSelectedData) {
			
			Win1.document.writeln('</table><FONT FACE="Arial" SIZE="-2">');
			if (toolMode!=25) {
				if (queryStartRecord>1) {
					var prevRecord = queryStartRecord - maxFeaturesReturned;
					if (prevRecord<1) prevRecord=1;
					Win1.document.write('<a href="javascript:' + theFrame + '.getMoreData(' + prevRecord + ')">' + msgList[61] + maxFeaturesReturned + msgList[62] + '</a>&nbsp;&nbsp;&nbsp;');
				}
				if (stillMore) {
					var nextRecord=featureCount + queryStartRecord;
					Win1.document.writeln('<a href="javascript:' + theFrame + '.getMoreData(' + nextRecord + ')">' + msgList[63] + '</a>');
				}
			}
			if ((toolMode!=4) && (toolMode!=25) && (selectCount>1)) {
				//Win1.document.writeln('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><a href="javascript:' + theFrame + '.zoomToReturnedRecords()">Zoom to this property</A></b>');
			}
//Win1.document.writeln('</div></td></tr></table>');
			Win1.document.writeln('</font></center></div></td></tr></table></body></html>');
			Win1.document.close();
		}
		//alert("toolMode:" + toolMode);
		
		if ((queryStartRecord==1) && (toolMode!=4) && (toolMode!=25)) {
			if ((selectCount==1) && (zoomToSingleSelect)) {
				var fWidth = selectRight[0] - selectLeft[0];
				var fHeight = selectTop[0] - selectBottom[0];
				var mWMargin = 0;
				var mHMargin = 0;
				if (selectType=="point") {			
					mWMargin = fullWidth * selectPointMargin;
					mHMargin = fullHeight * selectPointMargin;
					if (mWMargin > xDistance/2) {
						mWMargin = xDistance/2;
						mHMargin = yDistance/2;
					}
				} else {
					mWMargin = fWidth * selectMargin;
					mHMargin = fHeight * selectMargin; 
				}
				saveLastExtent();
				eLeft = selectLeft[0] - mWMargin;
				eRight = selectRight[0] + mWMargin;
				eTop = selectTop[0] + mHMargin;
				eBottom = selectBottom[0] - mHMargin;
			}

//THIS IS WHERE IT ZOOMS TO SELECTED RECORDS
		// Get the feature count of those features with matching spnum name
		if (justGetFeatureCount(theReply)>0) {
			featExtents = getEnvelopeXYs(theReply,1);
			// If there are more than one, need to extend envelope to cover them all
			if (justGetFeatureCount(theReply)>1) {
				x=theReply.indexOf("</FEATURE>");
				for (var i=1;i<justGetFeatureCount(theReply);i++) {
					tempfeatExtents = getEnvelopeXYs(theReply,x);
					x = theReply.indexOf("</FEATURE>", x+1);
					if (tempfeatExtents[0] < featExtents[0]) featExtents[0] = tempfeatExtents[0];
					if (tempfeatExtents[1] < featExtents[1]) featExtents[1] = tempfeatExtents[1];
					if (tempfeatExtents[2] > featExtents[2]) featExtents[2] = tempfeatExtents[2];
					if (tempfeatExtents[3] > featExtents[3]) featExtents[3] = tempfeatExtents[3];
				}
			}
			parent.MapFrame.zoomToEnvelope(featExtents[0]-75,featExtents[1]-75,featExtents[2]+75,featExtents[3]+75);
                }
			//sendMapXML();
		}
		
		
			
	} else {
		//alert(tempString);
		if ((useExternalWindow) || (!useTextFrame)) {
			Win1 = window.open("","QueryWindow","width=575,height=120,scrollbars=yes,resizable=yes");
		} else {
			Win1 = parent.TextFrame;
			Win1.document.open();
		}
		Win1.document.writeln('<html><meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><head>');
		Win1.document.writeln('	<title>' + titleList[8] + '</title>');
		Win1.document.writeln('</head>');
		Win1.document.writeln('<body BGCOLOR=#DACBEB TEXT="Black" LEFTMARGIN=0 TOPMARGIN=0>');
		Win1.document.writeln('<FONT FACE="Arial"><B>' + LayerName[ActiveLayerIndex] +'</B></font><FONT FACE="Arial" size="-2">');
		Win1.document.writeln('<br>' + msgList[64]);
		if (debugOn>0) {
			Win1.document.writeln('<p>' + msgList[65] + '<br>');
			Win1.document.writeln(untag(theReply));
		} else {
			if (theError!="") {
				Win1.document.writeln('<p>' + msgList[66] + '<br>');
				Win1.document.writeln(theError);
			}
		}
		Win1.document.writeln('</FONT>');
		Win1.document.writeln('</body></html>');
		Win1.document.close();
	}
	if (toolMode==4) selectCount=0;
	Win1=null;
	hideRetrieveData();
}

function parseHyperLink(theReply) {
	//alert(theReply);
        var fList="";
	var lpos1 = 1;
	var lpos2 = 1;
	var pos = 0;
	var startpos = 0;
	var endpos = 0;
	var fString = theReply.substring(startpos,endpos);
	var featureCount = justGetFeatureCount(theReply);
	var linkString = "width=" + hyperlinkWindowWidth + ",height=" + hyperlinkWindowHeight + ",scrollbars=yes,resizable=yes"
	var selectedData="";
	var fCount = featureCount;
	//alert("displayAttributeData()[featurecount=" + featureCount + "]");
	selectCount = 0;
	var tempString="";
	if (featureCount > 0) {
		var searchStr = currentHyperLinkField + "=";
		
		newSelectCount += 1;

		endpos = 1;
		pos = theReply.indexOf(searchStr,1);
		startpos = pos + searchStr.length + 1;
		endpos =theReply.indexOf(dQuote,startpos);
		inData = theReply.substring(startpos,endpos);
		var theLinkURL = currentHyperLinkPrefix + inData + currentHyperLinkSuffix;
		if (parent.TextFrame!=null) {
			parent.TextFrame.document.open();
			parent.TextFrame.document.writeln('<html><meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><head>');
			parent.TextFrame.document.writeln('	<title>' + titleList[9] + 's</title>');
			parent.TextFrame.document.writeln('</head>');
			parent.TextFrame.document.writeln('<body BGCOLOR="White" TEXT="Black" LEFTMARGIN=0 TOPMARGIN=0>');
			parent.TextFrame.document.writeln('<FONT FACE="Arial"><B>' + LayerName[ActiveLayerIndex] +'</B></font><FONT FACE="Arial" size="-2">');
			parent.TextFrame.document.writeln('<br>' + msgList[67] + theLinkURL );
			parent.TextFrame.document.writeln('</FONT>');
			parent.TextFrame.document.writeln('</body></html>');
			parent.TextFrame.document.close();
		}
		var Win1=open(theLinkURL,"",linkString);
	} else {
	
		//alert(tempString);
		if (parent.TextFrame!=null) {
			parent.TextFrame.document.open();
			parent.TextFrame.document.writeln('<html><meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><head>');
			parent.TextFrame.document.writeln('	<title>' + titleList[9] + '</title>');
			parent.TextFrame.document.writeln('</head>');
			parent.TextFrame.document.writeln('<body BGCOLOR="White" TEXT="Black" LEFTMARGIN=0 TOPMARGIN=0>');
			parent.TextFrame.document.writeln('<FONT FACE="Arial"><B>' + LayerName[ActiveLayerIndex] +'</B></font><FONT FACE="Arial" size="-2">');
			parent.TextFrame.document.writeln('<br>' + msgList[68]);
			if (debugOn>0) {
				parent.TextFrame.document.writeln('<p>' + msgList[65] + '<br>');
				parent.TextFrame.document.writeln(untag(theReply));
			}
			parent.TextFrame.document.writeln('</FONT>');
			parent.TextFrame.document.writeln('</body></html>');
			parent.TextFrame.document.close();
		} else {
			var msg = msgList[69];
			if (debugOn>0) {
				msg = msg + msgList[9] + theReply;
			}
			alert(msg);
		}
	}
	hideRetrieveData();
}

// are there any selected features?
function checkSelected() {
	var isOk = false;
	if (selectCount>0) isOk = true;
	return isOk;
}

function checkHyperLinkLayer(layerIndex) {
	var canLink = false;
	//alert(hyperLinkLayers.length);
	for (var i=0; i<hyperLinkLayers.length; i++) {
			if (LayerName[layerIndex]==hyperLinkLayers[i]) {
				canLink=true;
				currentHyperLinkLayer=LayerName[layerIndex];
				currentHyperLinkField=hyperLinkFields[i];
				currentHyperLinkPrefix=hyperLinkPrefix[i];
				currentHyperLinkSuffix=hyperLinkSuffix[i];
			}
	}
	return canLink;

}

// check to see if active layer is in scale threshold and visible 
	// so it can be used for querying
function checkIfActiveLayerAvailable() {
	// is the override flag set?
	if (canSelectInvisible) {
		return true;
	} else {
		// is the current scale within the scale min and max?
		if ((mapScaleFactor>=LayerMinScale[ActiveLayerIndex]) && (mapScaleFactor<=LayerMaxScale[ActiveLayerIndex])) {
			// is the active layer visible?
			if (LayerVisible[ActiveLayerIndex]==1) {
				return true;
			
			} else {
				var msg = msgList[104] + LayerName[ActiveLayerIndex] + msgList[102] + LayerName[ActiveLayerIndex] + msgList[108];
				
				alert(msg);
				return false;
			}
		} else {
			var msg = msgList[104] + LayerName[ActiveLayerIndex] + msgList[101];
			//if ((!listAllLayers) && (hasTOC)) msg += msgList[103];
			alert(msg);
			return false;
		}
	}
}


/**************************************************************
*	functions and variables for Identify All
*	drill down through visible layers
**************************************************************/

var replyArray = new Array();
var fID = 0;
var fIndex = 0;
var idEast;
var idWest;
var idSouth;
var idNorth;


// identify feature
function identifyAll(e) {
	fID = 0;
	highlightedOne="";
	var theX = mouseX;
	var theY = mouseY;
	getMapXY(theX,theY);
	searchTolerance = (xDistance/iWidth) * pixelTolerance;
	var tempWest = mapX - searchTolerance;
	var tempNorth = mapY + searchTolerance;
	var tempEast = mapX + searchTolerance;
	var tempSouth = mapY - searchTolerance;
	idSouth = tempSouth;
	idNorth = tempNorth;
	idWest = tempWest;
	idEast = tempEast;
	replyArray.length=0;
	var j =-1;
	for (var i=(LayerID.length-1);i>=0;i--) {
		replyArray[i]="";
		if ((mapScaleFactor>=LayerMinScale[i]) && (mapScaleFactor<=LayerMaxScale[i]) && (LayerVisible[i]) && (LayerIsFeature[i])) j = i;

	}
	if (j>-1) {
		fID=j;
		var theString = writeGetFeaturesDrill(tempWest,tempSouth,tempEast,tempNorth,fID);
		//if (useTextFrame) parent.TextFrame.document.location = "text.htm";
		//alert(theString);
		showRetrieveData();
		sendToServer(imsQueryURL,theString,10);
	} else {
		alert(msgList[111]);
	}
}


function doIdentifyAll(theReply) {
    //drill tool loop sequence
	//alert(theReply);
   replyArray[fID] = theReply;
   fID++;
   if (fID < (LayerID.length)) {
   		if ((mapScaleFactor>=LayerMinScale[fID]) && (mapScaleFactor<=LayerMaxScale[fID]) && (LayerVisible[fID]) && (LayerIsFeature[fID])) {
      		theString = writeGetFeaturesDrill(idWest,idSouth,idEast,idNorth,fID);
			//alert(theString);
	  		sendToServer(imsQueryURL,theString,10);
	   	} else {
			doIdentifyAll("");
		}
   }
   
   if (fID == (LayerID.length)) {
	//createDrillPage = false;
	//replyArray.reverse();
	displayAttributeDataforDrill(replyArray);
	fID = 0;
	//var ActiveLayerIndex = 4;
   }
 }  //end doDrill()


 // write XML to identify features for drill ID
function writeGetFeaturesDrill(west1,south1,east1,north1,thefID) {
	if (swapSelectFields) {
		selectFields=selFieldList[thefID];
	}
	var useString = writeIdentifyXML(LayerID[thefID],LayerType[thefID],selectFields,west1,south1,east1,north1,maxFeaturesReturned,useLimitExtent);
	hightlightedOne="";
	return useString;
}

// parse XML response for drill functions
function displayAttributeDataforDrill(theReplyArray) {
   showRetrieveData();
	var theFrame = "parent.MapFrame";
	if ((useExternalWindow) || (!useTextFrame)) {
			var Win1 = window.open("","QueryWindow","width=575,height=120,scrollbars=yes,resizable=yes");
			theFrame = "opener";
			if (parent.MapFrame!=null) theFrame = "opener.parent.MapFrame";
	} else {
			var Win1 = parent.TextFrame;
			Win1.document.open();
	}
	Win1.document.open();
	Win1.document.writeln('<html><head><title>Query/Selection Results</title></head>');
	Win1.document.writeln('<body bgcolor="' + textFrameBackColor + '" text="Black" link="Blue" vlink="Gray" LEFTMARGIN=0 onload="window.focus()"><center>');
	var lyrCount = 0;
	 for (b=0;b<theReplyArray.length;b++) {
	 	if (theReplyArray[b]!="") {
		    //alert(theReply);
			theReply = theReplyArray[b];
			setLayerFields(b);
			var theError = getXMLErrorMessage(theReply);
			var fList="";
			var lpos1 = 1;
			var lpos2 = 1;
			var epos = 1;
			var spos = 1;
			var morePoints=true;
			var moreFeatures=true;
			var featureCount = justGetFeatureCount(theReply);
			//alert(featureCount);
			var pos = 0;
			var startpos = 0;
			var endpos = xmlEndPos;
			var stillMore = false
			pos = theReply.indexOf('hasmore="true"',endpos);
			if (pos!=-1) stillMore = true;
			pos=0;
			var tempCount = 0;
			var selectedData="";
			var inData="";
			var xStr="";
			var yStr="";
			var fCount = featureCount;
			//alert("displayAttributeData()[featurecount=" + featureCount + "]");
			selectCount = 0;
			var tempString="";
			if (featureCount > 0) {
				//alert(featureCount);
				newSelectCount += 1;
				endpos = 1;
				Win1.document.writeln('<center><br><FONT FACE="Arial" SIZE="-1"><b>' + LayerName[b] + '</b><br>');
				Win1.document.writeln('<table border="1" size="95%" cellspacing="0" cellpadding="2" nowrap bgcolor="' + tableBackColor + '">');						
				for (var i=0;i<fCount;i++) {
		
					inData = parseRecordString(theReply, endpos);
					endpos = xmlEndPos;
					//selectedData = clearLeadingSpace(inData);
					selectedData = inData;
					
					epos = theReply.indexOf("</FEATURE",endpos);
					if (showSelectedData) {
						//alert("2\n" + selectedData);
						var showHyper = false;
						if (hyperLinkLayers!=null) {
							for (var s1=0;s1<hyperLinkLayers.length;s1++) {
								if (hyperLinkLayers[s1] == LayerName[b]) showHyper=true;
							}
						}
							
						var fName1 = getFieldNames(selectedData);
						var fValue1 = getFieldValues(selectedData);
						//selectPoints[selectCount] = getIdValue(fName1, fValue1);
						var idFieldNum = -1;
						var shapeFieldNum = -1;
						if (hideIDFieldData) {
							// hide ID column header
							for (var f=0;f<fName1.length;f++) {
								if (fName1[f]==LayerIDField[ActiveLayerIndex]) idFieldNum = f;
							}
						}
						if (hideShapeFieldData) {
							// hide Shape column header
							for (var f=0;f<fName1.length;f++) {
								if (fName1[f]==LayerShapeField[ActiveLayerIndex]) shapeFieldNum = f;
							}
						}
						if (selectCount==0) {
							Win1.document.write('<tr><th><FONT FACE="Arial" SIZE="-2">Rec</FONT></a></th>');
							for (var f=0;f<fName1.length;f++) {
								if ((f!=idFieldNum) && (f!=shapeFieldNum)) {
									var f2 = -1;
									if (useFieldAlias) {
										for (var f3=0;f3<AliasFieldName.length;f3++) {
											if (AliasFieldName[f3]==fName1[f]) f2 = f3;
										}
									}
									if (f2!=-1) {
										Win1.document.write('<th><FONT FACE="Arial" SIZE="-2">' + AliasFieldAlias[f2] + '</FONT></a></th>');
									} else {
										Win1.document.write('<th><FONT FACE="Arial" SIZE="-2">' + fName1[f] + '</FONT></a></th>');
									}
								}
							}
							Win1.document.writeln('</tr>');
						}
						Win1.document.write('<tr><td>');
						Win1.document.write('<FONT FACE="Arial" SIZE="-2">' + (selectCount+queryStartRecord) + '</FONT>');
						Win1.document.writeln('</td>');
						for (var f=0;f<fName1.length;f++) {	
							if ((f!=idFieldNum) && (f!=shapeFieldNum)) {
								Win1.document.write('<TD>');
								var isHyper=false;
								if (showHyper) {
									for (var s1=0;s1<hyperLinkFields.length;s1++) {
										if (hyperLinkFields[s1]==fName1[f]) {
											Win1.document.write('<a href="' + fValue1[f] + '" target="_blank">');
											isHyper=true;
										}
									}
								}
								var s2 = -1;
								for (var s1=0;s1<LayerFields.length;s1++) {
									if (fName1[f]==LayerFields[s1]) s2=s1;
								}
								if (LayerFieldType[s2]=="91") {
									//alert(fName1[f]);
									if (isNaN(fValue1[f])) {
										var theDate = fValue1[f];
									} else {
										//var theDate = new Date(parseInt(fValue1[f]));
										var theDateObj = new Date(parseFloat(fValue1[f]));
										var d = theDateObj.toUTCString();
										var theDate = d.replace(/GMT|UTC/,"");
									}
									Win1.document.write('<FONT FACE="Arial" SIZE="-2">' + theDate + '</FONT>');
									theDate=null;
								} else {
									Win1.document.write('<FONT FACE="Arial" SIZE="-2">' + fValue1[f] + '</FONT>');
								}
								if (isHyper) Win1.document.write('</a>');
								Win1.document.writeln('</td>');
							}
						}
						Win1.document.writeln('</tr>');
						fName1 = null;
						fValue1 = null;
					}
					selectCount += 1;
					//					
				}
				Win1.document.writeln('</table></center>');
				lyrCount++

			} else {
				if (listAllLayersInIDAll) {
		        	Win1.document.writeln('<center><FONT FACE="Arial" SIZE="-1"><b>' + LayerName[b] + '</b>');
					Win1.document.writeln('<br>' + msgList[64] + '<br><br></font></center>');
		     	}

			}
	  	}
	  }//end for 
	  
	  if (lyrCount==0) {
        	Win1.document.writeln('<center><FONT FACE="Arial" SIZE="-1"><b>' + msgList[112] + '</b></font></center>');
	  }
 
    Win1.document.writeln('</body></html>');
    Win1.document.close();
    Win1=null;
    hideRetrieveData();
} //end function


// checks if any layer has hyperlink at location and links to first one matching
function hyperLinkAny(e) {
	if (hyperLinkLayers.length>0) {
		var j = -1;
		fIndex = 0;
		for (var i=layerCount-1;i>-1;i--) {
			
			if ((mapScaleFactor>=LayerMinScale[i]) && (mapScaleFactor<=LayerMaxScale[i]) && (LayerVisible[i]==1)) {
				fIindex = -1;
				for (var k = hyperLinkLayers.length-1;k>-1;k--) {
					if (hyperLinkLayers[k]==LayerName[i]) {
						fIndex = k;
						j = i;
					}
				}
			}

		}
		if (j>-1) {
			fID = j;
			highlightedOne="";
			var theX = mouseX;
			var theY = mouseY;
			getMapXY(theX,theY);
			searchTolerance = (xDistance/iWidth) * pixelTolerance;
			var west1 = mapX - searchTolerance;
			var north1 = mapY + searchTolerance;
			var east1 = mapX + searchTolerance;
			var south1 = mapY - searchTolerance;
			idSouth = south1;
			idNorth = north1;
			idWest = west1;
			idEast = east1;
			var tempSwap = swapSelectFields;
			swapSelectFields=false;
			var tempSelect = selectFields;
			selectFields = LayerIDField[fID] + " " + LayerShapeField[fID] + " " + hyperLinkFields[fIndex];
			var theString = writeIdentifyXML(LayerID[fID],LayerType[fID],selectFields,west1,south1,east1,north1,maxFeaturesReturned,useLimitExtent);

			selectFields = tempSelect;
			swapSelectFields=tempSwap;
			showRetrieveData();
			//if (useTextFrame) parent.TextFrame.document.location = "text.htm";
			sendToServer(imsQueryURL,theString,16);
			
		} else {
			alert(msgList[114]);
		}
	} else {
		alert(msgList[115]);
	}
}

function parseHyperLinkAny(theReply) {
	//alert(theReply);
	var fList="";
	var lpos1 = 1;
	var lpos2 = 1;
	var pos = 0;
	var startpos = 0;
	var endpos = 0;
	var fString = theReply.substring(startpos,endpos);
	var featureCount = justGetFeatureCount(theReply);
	var linkString = "width=" + hyperlinkWindowWidth + ",height=" + hyperlinkWindowHeight + ",scrollbars=yes,resizable=yes"
	var selectedData="";
	var fCount = featureCount;
	//alert("displayAttributeData()[featurecount=" + featureCount + "]");
	selectCount = 0;
	var tempString="";
	if (featureCount > 0) {
		var searchStr = hyperLinkFields[fIndex] + "=";
		
		newSelectCount += 1;

		endpos = 1;
		pos = theReply.indexOf(searchStr,1);
		startpos = pos + searchStr.length + 1;
		endpos =theReply.indexOf(dQuote,startpos);
		inData = theReply.substring(startpos,endpos);
		var theLinkURL = hyperLinkPrefix[fIndex] + inData + hyperLinkSuffix[fIndex];
		if (parent.TextFrame!=null) {
			parent.TextFrame.document.open();
			parent.TextFrame.document.writeln('<html><meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><head>');
			parent.TextFrame.document.writeln('	<title>' + titleList[9] + 's</title>');
			parent.TextFrame.document.writeln('</head>');
			parent.TextFrame.document.writeln('<body BGCOLOR="White" TEXT="Black" LEFTMARGIN=0 TOPMARGIN=0>');
			parent.TextFrame.document.writeln('<FONT FACE="Arial"><B>' + LayerName[fID] +'</B></font><FONT FACE="Arial" size="-2">');
			parent.TextFrame.document.writeln('<br>' + msgList[67] + theLinkURL );
			parent.TextFrame.document.writeln('</FONT>');
			parent.TextFrame.document.writeln('</body></html>');
			parent.TextFrame.document.close();
		}
		var Win1=open(theLinkURL,"",linkString);
	} else if (fID<layerCount) {
			fID++;
			var j = -1;
			if ((mapScaleFactor>=LayerMinScale[fID]) && (mapScaleFactor<=LayerMaxScale[fID]) && (LayerVisible[fID]==1)) {
				fIindex = -1;
				for (var k = hyperLinkLayers.length-1;k>-1;k--) {
					if (hyperLinkLayers[k]==LayerName[fID]) {
						fIndex = k;
						j = fID;
					}
				}
			}
			if (j>-1) {
				var tempSwap = swapSelectFields;
				swapSelectFields=false;
				var tempSelect = selectFields;
				selectFields = LayerIDField[fID] + " " + LayerShapeField[fID] + " " + hyperLinkFields[fIndex];
				var theString = writeIdentifyXML(LayerID[fID],LayerType[fID],selectFields,idWest,idSouth,idEast,idNorth,maxFeaturesReturned,useLimitExtent);
	
				selectFields = tempSelect;
				swapSelectFields=tempSwap;
				showRetrieveData();
				//if (useTextFrame) parent.TextFrame.document.location = "text.htm";
				sendToServer(imsQueryURL,theString,16);
			} else {
				parseHyperLinkAny("");
			}
	

	} else {
	
		//alert(tempString);
		if (parent.TextFrame!=null) {
			parent.TextFrame.document.open();
			parent.TextFrame.document.writeln('<html><meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><head>');
			parent.TextFrame.document.writeln('	<title>' + titleList[9] + '</title>');
			parent.TextFrame.document.writeln('</head>');
			parent.TextFrame.document.writeln('<body BGCOLOR="White" TEXT="Black" LEFTMARGIN=0 TOPMARGIN=0>');
			parent.TextFrame.document.writeln('<FONT FACE="Arial" size="-1">');
			//parent.TextFrame.document.writeln('<B>' + LayerName[ActiveLayerIndex] +'</B></font><FONT FACE="Arial" size="-2">');
			parent.TextFrame.document.writeln('<br>' + msgList[116]);
			/*
			if (debugOn>0) {
				parent.TextFrame.document.writeln('<p>' + msgList[65] + '<br>');
				parent.TextFrame.document.writeln(untag(theReply));
			}
			*/
			parent.TextFrame.document.writeln('</FONT>');
			parent.TextFrame.document.writeln('</body></html>');
			parent.TextFrame.document.close();
		} else {
			var msg = msgList[69];
			if (debugOn>0) {
				msg = msg + msgList[9] + theReply;
			}
			alert(msg);
		}
	}
	hideRetrieveData();
}


function displayBigTime() 
{ 
	alert(theReply);
	setLayerFields(ActiveLayerIndex);
	var theError = getXMLErrorMessage(theReply);
	var fList="";
	var lpos1 = 1;
	var lpos2 = 1;
	var epos = 1;
	var spos = 1;
	var morePoints=true;
	var moreFeatures=true;
	var featureCount = justGetFeatureCount(theReply);
	//alert(featureCount);
	var pos = 0;
	var startpos = 0;
	var endpos = xmlEndPos;
	var stillMore = false
	pos = theReply.indexOf('hasmore="true"',endpos);
	if (pos!=-1) stillMore = true;
	pos=0;
	var tempCount = 0;
	var selectedData="";
	var inData="";
	var xStr="";
	var yStr="";
	var tempString = "";
	var fCount = featureCount;
	//alert("displayAttributeData()[featurecount=" + featureCount + "]");
	selectCount = 0;
	var tempString="";
	var Win1 = parent.Text2Frame;
	var theFrame = "parent.MapFrame";
	
		newSelectCount += 1;

		if (showSelectedData) 
		{
			//alert("displayAttributeData()[opening html page]");
			if ((useExternalWindow) || (!useTextFrame)) 
			{
				Win1 = window.open("","QueryWindow","width=400,height=400,left=0,top=0,scrollbars=yes,resizable=yes");
				theFrame = "opener";
				if (parent.MapFrame!=null) theFrame = "opener.parent.MapFrame";
			} 
			else 
			{
				Win1 = parent.TextFrame;
				Win1.document.open();
			}
			Win1.document.open();
			//Win1.document.writeln('<link rel="stylesheet" type="text/css" href="' + viewerStylesheet + '">');
			Win1.document.writeln('<html><meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><head><title>' + titleList[7] + '</title></head>');
			Win1.document.writeln('<body LEFTMARGIN=0 onload="window.focus()">');
			Win1.document.writeln('<center>');
			Win1.document.writeln('<FONT FACE="Arial" SIZE="+1">' + LayerName[ActiveLayerIndex] + '</FONT>');
			Win1.document.writeln('<table border="1" cellspacing="0" cellpadding="0" width="90%" nowrap >');
		}
		endpos = 1;
		
		for (var i=0;i<fCount;i++) 
		{
			//alert(endpos);
			if (toolMode!=4) 
			{
				var theXYs = getEnvelopeXYs(theReply, endpos)
				selectLeft[selectCount] = theXYs[0];
				selectBottom[selectCount] = theXYs[1];
				selectRight[selectCount] = theXYs[2];
				selectTop[selectCount] = theXYs[3];
				endpos = xmlEndPos;
			}
			//alert(endpos);
			inData = parseRecordString(theReply, endpos);
			endpos = xmlEndPos;
			//selectedData = clearLeadingSpace(inData);
			selectedData = inData;
			
			epos = theReply.indexOf("</FEATURE",endpos);
			if (showSelectedData) 
			{
				//alert("2\n" + selectedData);
				var showHyper = false;
				if (hyperLinkLayers!=null) 
				{
					for (var s1=0;s1<hyperLinkLayers.length;s1++) 
					{
						if (hyperLinkLayers[s1] == LayerName[ActiveLayerIndex]) showHyper=true;
					}
				}
					
				var fName1 = getFieldNames(selectedData);
				var fValue1 = getFieldValues(selectedData);
				selectPoints[selectCount] = getIdValue(fName1, fValue1);
				
				var idFieldNum = -1;
				var shapeFieldNum = -1;
				if (hideIDFieldData) 
				{
					// hide ID column header
					for (var f=0;f<fName1.length;f++) 
					{
						if (fName1[f]==LayerIDField[ActiveLayerIndex]) idFieldNum = f;
					}
				}
				if (hideShapeFieldData) 
				{
					// hide Shape column header
					for (var f=0;f<fName1.length;f++) 
					{
						if (fName1[f]==LayerShapeField[ActiveLayerIndex]) shapeFieldNum = f;
					}
				}
				
				if (selectCount==0) 
				{
					//Win1.document.write('<tr><td><FONT FACE="Arial" SIZE="-1">' + msgList[86] + '</FONT></a></td>');
					Win1.document.write('<tr><td><FONT FACE="Arial" SIZE="-1"><b>Field Name</b></FONT></a></td>');
					Win1.document.write('<td><FONT FACE="Arial" SIZE="-1"><b>Field Value</b></FONT></a></td></tr>');
					for (var f=0;f<fName1.length;f++) 
					{
						Win1.document.write('<tr><td>');
						if ((f!=idFieldNum) && (f!=shapeFieldNum)) 
						{
							var f2 = -1;
							if (useFieldAlias) 
							{
								for (var f3=0;f3<AliasFieldName.length;f3++) 
								{
									if (AliasFieldName[f3]==fName1[f]) f2 = f3;
								}
							}
							if (f2!=-1) 
							{
								Win1.document.write('<FONT FACE="Arial" SIZE="-1">' + AliasFieldAlias[f2] + '</FONT></a>');
							} 
							else 
							{
								Win1.document.write('<FONT FACE="Arial" SIZE="-1">' + fName1[f] + '</FONT></a>');
							}
							Win1.document.write('</td>');
						}
						
						// **** now print value ***					
						if ((f!=idFieldNum) && (f!=shapeFieldNum)) 
						{
							Win1.document.write('<TD>');
							var isHyper=false;
							if (showHyper) 
							{
								for (var s1=0;s1<hyperLinkFields.length;s1++) 
								{
									if (hyperLinkFields[s1]==fName1[f]) 
									{
										//var theLinkURL = currentHyperLinkPrefix + fValue1[f] + currentHyperLinkSuffix;
										var theLinkURL = hyperLinkPrefix[s1] + fValue1[f] + hyperLinkSuffix[s1];
										Win1.document.write('<a href="' + theLinkURL + '" target="_blank">');
										isHyper=true;
									}
								}
							}
							var s2 = -1;
							for (var s1=0;s1<LayerFields.length;s1++) 
							{
								if (fName1[f]==LayerFields[s1]) s2=s1;
							}
							if (LayerFieldType[s2]=="91") 
							{
								//alert(fName1[f]);
								if (isNaN(fValue1[f])) 
								{
									var theDate = fValue1[f];
								} 
								else 
								{
									//var theDate = new Date(parseInt(fValue1[f]));
									var theDateObj = new Date(parseFloat(fValue1[f]));
									var d = theDateObj.toUTCString();
									var theDate = d.replace(/GMT|UTC/,"");
								}
								Win1.document.write('<FONT FACE="Arial" SIZE="-2">' + theDate + '</FONT>');
								theDate=null;
							} 
							else 
							{
								// put html entity for spaces so display is correct - browsers trim extra spaces
								tempString = fValue1[f].replace(/ /g, " ");
								Win1.document.write('<FONT FACE="Arial" SIZE="-2">' + tempString + '</FONT>');
								//Win1.document.write('<FONT FACE="Arial" SIZE="-2">' + fValue1[f] + '</FONT>');
							}
							if (isHyper) Win1.document.write('</a>');
							Win1.document.writeln('</td>');
						}
						Win1.document.writeln('</tr>');
					}
					Win1.document.writeln('</table>');
				}
			
				fName1 = null;
				fValue1 = null;
				
			}
			selectCount += 1;
							
		//alert("toolMode:" + toolMode);
		
		if ((queryStartRecord==1) && (toolMode!=4) && (toolMode!=25)) 
		{
			sendMapXML();
		}
					
	} 	
	if (toolMode==4) selectCount=0;
	Win1=null;
	hideRetrieveData();
}
