// aimsIdentify.js
aimsIdentifyPresent=true;
// hyperlink variables
var currentHyperLinkLayer="";
var currentHyperLinkField="";
var currentHyperLinkPrefix="";
var currentHyperLinkSuffix="";
var hyperlinkWindowWidth=500;
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 feature
function identify(e) {
if (checkIfActiveLayerAvailable()) {
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;
queryStartRecord=1;
selectEnvelope='maxy="' + forceComma(tempNorth) + '" maxx="' + forceComma(tempEast) + '" miny="' + forceComma(tempSouth) + '" minx="' + forceComma(tempWest) + '"';
selectionMode=2;
var theString = writeGetFeatures(tempWest,tempSouth,tempEast,tempNorth);
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();
sendToServer(imsQueryURL,theString,hyperlinkXMLMode);
} else {
alert(msgList[47]);
}
}
}
// 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 writeIdentifyChartXML(theLayer,theLayerType,theFields)
{
var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_FEATURES outputmode="xml" envelope="false" checkesc ="true" geometry="false" featurelimit="' + maxReturned + '">\n';
theString += '<LAYER id="' + theLayer + '" />';
theString += '<SPATIALQUERY subfields="' + theFields + '"';
theString += addJoinExpWhere(ActiveLayerIndex);
theString += ">";
theString += '<SPATIALFILTER relation="area_intersection" >';
theString += '<ENVELOPE maxy="' + forceComma(topY) + '" maxx="' + forceComma(rightX) + '" miny="' + forceComma(bottomY) + '" minx="' + forceComma(leftX) + '" />';
theString += '</SPATIALFILTER>';
theString += '</SPATIALQUERY>';
theString += '</GET_FEATURES>';
theString += '</REQUEST>';
theString += '</ARCXML>';
return theString;
}
function writeIdentifyXML(theLayer,theLayerType,theFields,leftX,bottomY,rightX,topY,maxReturned,hasLimit) {

if(ActiveLayerIndex==parent.ParametersFrame.HCenterLayerIndex)
{
Str = "";
for (i=1; i<4; i++)
{
if (parent.ParametersFrame.HealthCentersVisible[i] == 1)
Str += " type = "+i+" or ";
}
Str += " type = -1 ";
str1 = '<SPATIALQUERY subfields="' + theFields + '" where=" ('+Str+')';
str1 += addJoinExp(ActiveLayerIndex);
str1 += " >";
var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_FEATURES outputmode="xml" envelope="false" checkesc ="true" geometry="false" featurelimit="' + maxReturned + '">\n';
theString += '<LAYER id="' + theLayer + '" />';

theString += str1;

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;
}
else
{
var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_FEATURES outputmode="xml" envelope="false" checkesc ="true" geometry="false" featurelimit="' + maxReturned + '">\n';
theString += '<LAYER id="' + theLayer + '" />';
theString += '<SPATIALQUERY subfields="' + theFields + '"';
theString += addJoinExpWhere(ActiveLayerIndex);
theString += ">";
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) {


setLayerFields(ActiveLayerIndex);

if (ActiveLayerIndex==parent.ParametersFrame.HDirLayerIndex)  //open directorate profile
{
var nData="";		
var HDendpos = 1;
var HDCode="";
var ProfileURL="";
	
nData = parseRecordString(theReply, HDendpos);

var fName11 = getFieldNames(nData);

var fValue11 = getFieldValues(nData);

HDCode=fValue11[0];
			
			if (parent.ParametersFrame.Arabic)
			{
			ProfileURL="http://gis.moh.gov.jo/hss_db/DirectorateArb.aspx?ID="+HDCode;
			var Win1 = open(ProfileURL,"DataWindow","width=750,height=600,scrollbars=yes,resizable=yes");
			extWin = Win1;
			focusOnData = true;
	
			}
			else
			{
//			alert(HDCode);
			ProfileURL="http://gis.moh.gov.jo/hss_db/Directorate.aspx?ID="+HDCode;
			var Win1 = open(ProfileURL,"DataWindow","width=750,height=600,scrollbars=yes,resizable=yes");
			extWin = Win1;
			focusOnData = true;	
			}
hideRetrieveData();
}


if (ActiveLayerIndex==parent.ParametersFrame.JoGovLayerIndex)   //open governorate profile
{
var nData="";		
var HDendpos = 1;
var GovCode="";
var ProfileURL="";
	
nData = parseRecordString(theReply, HDendpos);

var fName11 = getFieldNames(nData);

var fValue11 = getFieldValues(nData);

GovCode=fValue11[0];
			
	if (parent.ParametersFrame.Arabic)
	{
	ProfileURL="http://gis.moh.gov.jo/hss_db/GovernorateArb.aspx?ID="+GovCode;
	var Win1 = open(ProfileURL,"DataWindow","width=750,height=600,scrollbars=yes,resizable=yes");
	extWin = Win1;
	focusOnData = true;

	}
	else
	{
//	alert(GovCode);
	ProfileURL="http://gis.moh.gov.jo/hss_db/Governorate.aspx?ID="+GovCode;
	var Win1 = open(ProfileURL,"DataWindow","width=750,height=600,scrollbars=yes,resizable=yes");
	extWin = Win1;
	focusOnData = true;	
	}
hideRetrieveData();
}


if (ZoomFindisBeingUsed){

/////////////////////////////////////////////////////////////// code to zoom to selected item in search result window
var epos = 1;

	
	var featureCount = 1;
	
	var stillMore = false
	pos=0;
	var tempCount = 0;
	var selectedData="";
	var inData="";
	var fCount = featureCount;
	selectCount = 0;


	
	if (featureCount > 0)
	{
			
		endpos = 1;

		for (var i=0;i<fCount;i++)
		{
			try
			{
				

			var theXYs = getEnvelopeXYs(theReply, endpos)
		//alert("theXYs"+theXYs);
			selectLeft[selectCount] = theXYs[0];
			selectBottom[selectCount] = theXYs[1];
			selectRight[selectCount] = theXYs[2];
			selectTop[selectCount] = theXYs[3];
			endpos = xmlEndPos;
				

			}
			catch(e)
			{}

		}
		
	}

	
	parent.SearchFrame.document.location.reload();
	selectCount = 1;
	window.setTimeout("zoomToReturnedRecords()",10);
	
	hideRetrieveData();


	ZoomFindisBeingUsed=false;

/////////////////////////////////////////////////////////////////// End of code used to zoom to search result winodw
}else{

if ((ActiveLayerIndex!=parent.ParametersFrame.JoGovLayerIndex)&&(ActiveLayerIndex!=parent.ParametersFrame.HDirLayerIndex))   //other layers
{
var url = appDir + "displayAttributeData.htm";
var Win1 = open(url,"DataWindow","width=575,height=250,scrollbars=yes,resizable=yes");
extWin = Win1;
focusOnData = true;
}

////////////////////////////////////////////////////////////////////////
}


}
function displayAttributeDataChart(theReply) {
setLayerFields(ActiveLayerIndex);
var url = appDir + "displayChartAttributeData.htm";
var Win1 = open(url,"DataWindow","width=575,height=250,scrollbars=yes,resizable=yes");
extWin = Win1;
focusOnData = true;
}
function parseHyperLink(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;
selectCount = 0;
var tempString="";
if (featureCount > 0) {
var searchStr = currentHyperLinkField + "=";
newSelectCount += 1;
selectCount += 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 {
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;
}
}
}
var replyArray = new Array();
var fID = 0;
var fIndex = 0;
var idEast;
var idWest;
var idSouth;
var idNorth;
function writeIdentifyXMLAll(theLayer,theLayerType,theFields,leftX,bottomY,rightX,topY,maxReturned,hasLimit,LayerIndex)
{
if(LayerIndex==parent.ParametersFrame.HCenterLayerIndex)//check if this layer is for health centers
{

Str = "";
for (i=1; i<4; i++)
{
if (parent.ParametersFrame.HealthCentersVisible[i] == 1)
Str += " type = "+i+" or ";
}
Str += " type = -1 ";
str1 = '<SPATIALQUERY subfields="' + theFields + '" where="('+Str+')';
str1 += addJoinExp(LayerIndex);
str1 += " >";


var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_FEATURES outputmode="xml" envelope="false" checkesc ="true" geometry="false" featurelimit="' + maxReturned + '">\n';
theString += '<LAYER id="' + theLayer + '" />';

theString += str1;

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;
}
else
{
var theString = '<ARCXML version="1.1">\n<REQUEST>\n<GET_FEATURES outputmode="xml" envelope="false" checkesc ="true" geometry="false" featurelimit="' + maxReturned + '">\n';
theString += '<LAYER id="' + theLayer + '" />';
theString += '<SPATIALQUERY subfields="' + theFields + '"';
theString += addJoinExpWhere(LayerIndex);
theString += ">";
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) {
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;
}
}
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 ((LayerVisible[i]==1) && (LayerIsFeature[i]) &&(i!=parent.ParametersFrame.RoadsayerIndex)) j = i;
}
if (j>-1) {
fID=j;
var theString = writeGetFeaturesDrill(tempWest,tempSouth,tempEast,tempNorth,fID);
showRetrieveData();
sendToServer(imsQueryURL,theString,10);
} else {
alert(msgList[111]);
}
}
function doIdentifyAll(theReply) {
replyArray[fID] = theReply;
fID++;
if (fID < (LayerID.length)) {
if ((LayerVisible[fID]==1) && (LayerIsFeature[fID])&& (fID!=parent.ParametersFrame.RoadsayerIndex)) {
theString = writeGetFeaturesDrill(idWest,idSouth,idEast,idNorth,fID);
sendToServer(imsQueryURL,theString,10);
} else {
doIdentifyAll("");
}
}
if (fID == (LayerID.length)) {
displayAttributeDataforDrill(replyArray);
fID = 0;
}
}
function writeGetFeaturesDrill(west1,south1,east1,north1,thefID) {
if (swapSelectFields) {
selectFields=selFieldList[thefID];
}
var useString = writeIdentifyXMLAll(LayerID[thefID],LayerType[thefID],selectFields,west1,south1,east1,north1,maxFeaturesReturned,useLimitExtent,thefID);
hightlightedOne="";
return useString;
}
// parse XML response for selected features
function displayAttributeDataforDrill(theReplyArray) {
showRetrieveData();
var url = appDir + "displayAttributeDataAll.htm";
if (useTextFrame) {
parent.TextFrame.document.location = url;
} else {
var Win1 = open(url,"DataWindow","width=575,height=250,scrollbars=yes,resizable=yes");
}
}
// 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 (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();
sendToServer(imsQueryURL,theString,16);
} else {
alert(msgList[114]);
}
} else {
alert(msgList[115]);
}
}
function parseHyperLinkAny(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;
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();
sendToServer(imsQueryURL,theString,16);
} else {
parseHyperLinkAny("");
}


} else {
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('<br>' + msgList[116]);
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();
}


