aimsXMLPresent=true;
var cVersion="&ClientVersion=4.0";
var selectXMLMode=6;
var identifyXMLMode=7;
var queryXMLMode=8;
var findXMLMode=14;
var hyperlinkXMLMode=15;
var charEncoding="UTF-8";
var localeEncoding='encoding="'+charEncoding+'" ';
var charSet="ISO-8859-1"
var formColor="#000000";
var XMLMode=1;
var okToSend=true;
var xHalf=xDistance/2;
var yHalf=yDistance/2;
var xmlEndPos=0;
var lastXMLResponse="";
var drawOVExtentBox=true;
var forceNewOVMap=true;
var connectorURL="http://"+hostName+"/servlet/com.esri.esrimap.Esrimap?ServiceName=redirect";
var requestMethod="Servlet";
if(parent.connectorType!="")requestMethod=parent.connectorType;
var activeMapServiceIndex=0;
var forceCommaInRequest=new Array();
forceCommaInRequest[activeMapServiceIndex]=false;
var forceCommaInOV=false;
var pastStart=false;
if(hasOVMap!=true)pastStart=true;
var adjustLimit=true;
var focusOnData=false;
var extWin;
function sendToServer(URLString,XMLRequest,theType)
{
//alert("Hope" + XMLRequest);
if(parent.PostFrame.document.forms[0]!=null)
{
if(okToSend)
{
XMLMode=theType;
if(XMLMode==1)showRetrieveMap();
okToSend=false; 
if(requestMethod.toUpperCase()=="JSP")
{
jspSendToServer(URLString,XMLRequest,theType);
}
else
{
htmlSendToServer(URLString,XMLRequest,theType);
}
}
else
{
hideRetrieveMap();
hideRetrieveData();
}
}
else
{
hideRetrieveMap();
hideRetrieveData();
}
}
function htmlSendToServer(URLString,XMLRequest,theType){
var cVersion="&ClientVersion=4.0";
var thePostForm=parent.PostFrame.document.forms[0];
URLString=URLString+cVersion;
var requestURL=URLString;
if(thePostForm.RedirectURL!=null){
if(isNotSameHostInURL(URLString,hostName)){
requestURL=connectorURL;
thePostForm.RedirectURL.value=URLString;
}else{
thePostForm.RedirectURL.value="";
}
}
thePostForm.action=requestURL+"&Form=True&Encode=False";
var xmlHeader='<?xml version="1.0" '+localeEncoding+'?>';
thePostForm.ArcXMLRequest.value=xmlHeader+XMLRequest;
if(thePostForm.FormCharset!=null)thePostForm.FormCharset.value=charSet;
if(thePostForm.BgColor!=null)thePostForm.BgColor.value="#000000";
thePostForm.submit();
}
function jspSendToServer(URLString,XMLRequest,theType){
var cVersion="&ClientVersion=4.0";
var theService=getService(URLString);
var theHost=getHost(URLString);
theService+=cVersion;
var thePostForm=parent.PostFrame.document.forms[0];
var xmlHeader='<?xml version="1.0" '+localeEncoding+'?>\n';
thePostForm.ArcXMLRequest.value=xmlHeader+XMLRequest;
thePostForm.ServerName.value=theHost;
thePostForm.ServiceName.value=theService;
thePostForm.submit();
}
function getHost(theURL){
var thisHost="";
var startpos=theURL.indexOf("//");
if(startpos==-1){
startpos=0;
}else{
startpos=startpos+2;
}
var endpos=theURL.indexOf("/",startpos);
if(endpos==-1)endpos=theURL.length;
thisHost=theURL.substring(startpos,endpos);
return thisHost;
}
function getService(theURL){
var theService="";
var startpos=theURL.indexOf("ServiceName=");
if(startpos!=-1){
startpos+=12;
theService=theURL.substring(startpos);
}
return theService;
}
function sendCustomToServer(XMLRequest,theFunction,theType){
var theForm=parent.PostFrame.document.forms[0];
theForm.JavaScriptFunction.value=theFunction;
sendToServer(imsQueryURL,XMLRequest,theType)
}
function sendMapXML()
{
beforeMapRefresh();
showRetrieveMap();
var theText=writeXML();
if(debugOn==2)alert(msgList[12]+theText);
sendToServer(imsURL,theText,1);
}
function processXML(theReplyIn){
if(doURLencode){
theReplyIn=replacePlus(theReplyIn);
var theReply=unescape(theReplyIn);
}else{
var theReply=theReplyIn;
}
lastXMLResponse=theReply;
okToSend=true;
if(debugOn>2)alert(msgList[13]+theReply);
var theError=getXMLErrorMessage(theReply);
switch(XMLMode)
{
case 1:
var theURL="";
theURL=getURL(theReply);
if(theURL!="")
{
getXYs(theReply);
document.theImage.src=theURL;
afterMapRefresh();
if(toolMode==3)
{
moveLayer("theMap",hspc,vspc);
clipLayer2("theMap",0,0,iWidth,iHeight);
window.setTimeout('showLayer("theMap");',showMapLayerTimeout);
if(hasLayer("theMapClicks"))
{
moveLayer("theMapClicks",hspc,vspc);
clipLayer2("theMapClicks",0,0,iWidth,iHeight);
}
}
}
else{
if(debugOn>0){
alert(msgList[14]+"\n"+theReply);
}else{
alert(msgList[14]+theError);
}
}
if(toolMode==20){
updateMeasureBox();
}
if(legendVisible){
showLegend();
}
if(hasOVMap){
if(ovIsVisible){
if((!pastStart)||(forceNewOVMap)){
theText=writeOVXML();
sendToServer(imsOVURL,theText,2);
}else{
putExtentOnOVMap();
hideRetrieveMap();
}
}else{
if((!pastStart)||(forceNewOVMap)){
theText=writeOVXML();
sendToServer(imsOVURL,theText,2);
}else{
hideRetrieveMap();
}
}
}else{
hideRetrieveMap();
}
if(aimsBufferPresent){
if(getBufferedData){
var buffString=writeGetBufferedData();
if(buffString!=""){
sendToServer(imsQueryURL,buffString,11);
}else{
alert(msgList[15]);
}
getBufferedData=false;
}
}
if((focusOnData)&&(!useTextFrame)){
extWin.focus();
focusOnData=false;
extWin=null;
}
break;
case 2:
var theURL="";
theURL=getURL(theReply);
if(!pastStart){
getOVXYs(theReply);
pastStart=true;
}
if(theURL!=""){
ovImageVar.src=theURL;
}
else{
if(debugOn>0){
alert(msgList[16]+"\n"+theReply);
}else{
alert(msgList[16]+theError);
}
}
if(ovIsVisible)putExtentOnOVMap();
hideRetrieveMap();
break;
case 3:
if(getLimitExtent){
var pos=theReply.indexOf("<PROPERTIES");
var theXYs=getEnvelopeXYs(theReply,pos)
limitLeft=theXYs[0];
limitBottom=theXYs[1];
limitRight=theXYs[2];
limitTop=theXYs[3];
}
if(adjustLimit){
var imgW2HRatio=iWidth/iHeight;
var imgH2WRatio=iHeight/iWidth;
var itWidth=limitRight-limitLeft;
var itHeight=limitTop-limitBottom;
var mapRatio=itHeight/itWidth;
var ix=limitLeft+(itWidth/2);
var iy=limitBottom+(itHeight/2);
var iSize=itWidth/2;
if(iWidth>=iHeight){
if(imgH2WRatio<mapRatio){
iSize=(itHeight*imgW2HRatio)/2;
limitRight=ix+iSize;
limitLeft=ix-iSize;
}else{
iSize=(itWidth*imgH2WRatio)/2;
limitTop=iy+iSize;
limitBottom=iy-iSize;
}
}else{
if(imgH2WRatio<mapRatio){
iSize=(itHeight*imgH2WRatio)/2;
limitRight=ix+iSize;
limitLeft=ix-iSize;
}else{
iSize=(itWidth*imgH2WRatio)/2;
limitTop=iy+iSize;
limitBottom=iy-iSize;
}
}
}
imageLimitLeft=limitLeft;
imageLimitRight=limitRight;
imageLimitTop=limitTop
imageLimitBottom=limitBottom;
fullLeft=limitLeft;
fullRight=limitRight;
fullTop=limitTop;
fullBottom=limitBottom;
fullWidth=Math.abs(fullRight-fullLeft);
fullHeight=Math.abs(fullTop-fullBottom);
fullOVWidth=Math.abs(fullOVRight-fullOVLeft);
fullOVHeight=Math.abs(fullOVTop-fullOVBottom);
forceCommaInRequest[activeMapServiceIndex]=false;
processStartExtent(theReply);
break;
case 5:
processCatalog(theReply);
break;
case 6:
displayAttributeData(theReply);
break;
case 7:
displayAttributeData(theReply);
break;
case 8:
displayAttributeData(theReply);
break;
case 9:
processGeocode(theReply);
break;
case 10:
doIdentifyAll(theReply);
break;
case 11:
getBufferAttributeData(theReply)
break;
case 14:
displayAttributeData(theReply);
break;
case 15:
parseHyperLink(theReply);
break;
case 16:
parseHyperLinkAny(theReply);
break;
case 20:
parseStartQuery(theReply);
break;
case 25:
parseGeocodeLayers(theReply);
if((aimsQueryPresent)&&(highlightedOne!="")&&(queryZoom)){
setStartQuery();
}else{
sendMapXML();
}
break;
case 26:
if(parseGeocodeParams(theReply,GCLayers[GCActiveLayer])){
var theAddressForm=appDir+"addmatch.htm";
if((useExternalWindow)||(!useTextFrame)){
var Win1=window.open(theAddressForm,"GeocodeWindow","width=575,height=150,scrollbars=yes,resizable=yes");
}else{
parent.TextFrame.document.location=theAddressForm;
}
}else{
if(debugOn>0){
alert(msgList[17]+"\n"+theReply);
if(parent.TextFrame!=null)parent.TextFrame.document.location=appDir+"blank.htm";
}else{
alert(msgList[17]);
if(parent.TextFrame!=null)parent.TextFrame.document.location=appDir+"blank.htm";
}
}
break;
case 27:
parseGeocodeResults(theReply);
break;
case 40:
parseFieldSamples(theReply);
writeQueryForm();
break;
case 55:
parseStoredQueries(theReply);
break;
case 70:
parseIDFieldData(theReply);
break;
case 98:
var theURL="";
theURL=getURL(theReply);
if(theURL!=""){
document.theImage.src=theURL;
}
if(legendVisible){
showLegend();
drawLegendOnly=false;
}
hideRetrieveMap();
break;
case 99:
var theURL="";
legendVisible=legendTemp;
theURL=getURL(theReply);
if(theURL!=""){
document.theImage.src=theURL;
}
else{
alert(msgList[14]+theReply);
}
hideRetrieveMap();
break;
case 101:
printMapURL=getURL(theReply);
printLegURL=getLegendURL(theReply);
if(hasOVMap){
getPrintOV();
}else{
getPrintLegend();
}
break;
case 102:
printOVURL=getURL(theReply);
legendImage=printLegURL
getPrintLegend();
break;
case 103:
hideRetrieveMap();
writePrintPage();
break;
case 900:
var theURL="";
theURL=getURL(theReply);
if(theURL!=""){
getXYs(theReply);
document.theImage.src=theURL;
}
break;
case 902:
var theURL="";
theURL=getURL(theReply);
if(theURL!=""){
ovImageVar.src=theURL;
}
var tempLeft=fullLeft;
var tempRight=fullRight;
var tempTop=fullTop;
var tempBottom=fullBottom;
getOVXYs(theReply);
pastStart=true;
fullLeft=tempLeft;
fullRight=tempRight;
fullTop=tempTop;
fullBottom=tempBottom;
var theString='<ARCXML version="1.1">\n<REQUEST>\n<GET_SERVICE_INFO renderer="false" extensions="true" ';
if(aimsLayersPresent){
if(LayerID.length>0){
theString+='fields="false" ';
}else{
theString+='fields="true" ';
}
}else{
theString+='fields="false" ';
}
theString+='/>\n</REQUEST>\n</ARCXML>';
sendToServer(imsURL,theString,3);
break;
default:
if(XMLMode>=1000){
useCustomFunction(theReply);
}else{
alert(theReply+msgList[19]);
}
}
}
function writeXML(){
var theString='<ARCXML version="1.1">\n<REQUEST>\n<GET_IMAGE>\n<PROPERTIES>\n<ENVELOPE minx="'+forceComma(eLeft)+'" miny="'+forceComma(eBottom)+'" maxx="'+forceComma(eRight)+'" maxy="'+forceComma(eTop)+'" />\n';
theString+='<IMAGESIZE height="'+iHeight+'" width="'+iWidth+'" />\n';
var visString="";
if(aimsLayersPresent){
if(toggleVisible){
theString+='<LAYERLIST >\n';
for(var i=0;i<layerCount;i++){
if(LayerVisible[i]==1){
theString+='<LAYERDEF id="'+LayerID[i]+'" visible="true" ';
if(aimsClassRenderPresent){
theString+=addSpecialRenderToMap(i);
}else{
theString+='/>\n';
}
}
else{
theString+='<LAYERDEF id="'+LayerID[i]+'" visible="false" />\n';
}
}
theString+='</LAYERLIST>\n';
}
}
if(mapTransparent){
theString+='<BACKGROUND color="255,255,254" transcolor="255,255,254" />\n';
}else{
if(mapBackColor!=""){
theString+='<BACKGROUND color="'+mapBackColor+'" />\n\n';
}
}
if(aimsLegendPresent){
if(legendVisible)theString+=addLegendToMap();
}
theString+='</PROPERTIES>\n';
if(aimsBufferPresent){
if(showBuffer)theString+=addBufferToMap();
}
if(aimsSelectPresent){
theString+=addSelectToMap();
}
if(aimsCustomPresent)theString+=addCustomToMap1();
if(aimsClickPresent){
if(clickCount>0){
var clickColor=selectColor;
if(clickType==1)clickColor=clickMarkerColor;
theString+='<LAYER type="acetate" name="allTheClicks">\n';
if(clickCount>1){
theString+='<OBJECT units="database">\n<LINE coords="'+forceComma(clickPointX[0])+coordsDelimiter+forceComma(clickPointY[0]);
for(var i=1;i<clickCount;i++){
theString+=pairsDelimiter+forceComma(clickPointX[i])+coordsDelimiter+forceComma(clickPointY[i]);
}
theString+='" >\n';
theString+='<SIMPLELINESYMBOL type="solid" color="'+clickMarkerColor;
theString+='" width="3" />\n</LINE>\n</OBJECT>\n';
theString+='<OBJECT units="database">\n<LINE coords="'+forceComma(clickPointX[0])+coordsDelimiter+forceComma(clickPointY[0]);
for(var i=1;i<clickCount;i++){
theString+=pairsDelimiter+forceComma(clickPointX[i])+coordsDelimiter+forceComma(clickPointY[i]);
}
theString+='" >\n';
theString+='<SIMPLELINESYMBOL type="solid" color="255,255,255" width="1" />\n</LINE>\n</OBJECT>\n';
}
for(var i=0;i<clickCount;i++){
theString+='<OBJECT units="database">\n<POINT coords="'+forceComma(clickPointX[i])+coordsDelimiter+forceComma(clickPointY[i])+'">\n';
theString+='<SIMPLEMARKERSYMBOL  type="'+clickMarkerType+'"';
theString+=' color="'+clickMarkerColor+'" width="'+clickMarkerSize+'" />\n</POINT>\n</OBJECT>\n';
}
theString+='</LAYER>\n';
}
}
if(aimsRoutePresent){
if(geocodeAppMode=="route")theString+=addRouteToMapXML("");
}
if(showGeocode){
theString+='<LAYER type="acetate" name="GeoCode1">\n';
theString+='<OBJECT units="database">\n<POINT coords="'+forceComma(geocodeX)+coordsDelimiter+forceComma(geocodeY)+'">\n';
theString+='<SIMPLEMARKERSYMBOL  type="circle"  color="'+geocodePointColor+'" width="'+geocodePointSize+'" overlap="false" />\n</POINT></OBJECT>\n';
if(geocodeLabel!=""){
theString+='<OBJECT units="database">\n<TEXT coords="'+forceComma(geocodeX)+coordsDelimiter+forceComma(geocodeY)+'" label="'+geocodeLabel+'">\n';
theString+='<TEXTMARKERSYMBOL fontcolor="'+geocodePointColor+'" fontsize="12" shadow="64,64,64" glowing="255,255,0" halignment="right" valignment="top" overlap="false" /></TEXT></OBJECT>\n';
}
theString+='</LAYER>\n';
}
if(aimsCustomPresent)theString+=addCustomToMap2();
if(drawBottomBar){
theString+='<LAYER type="acetate" name="theBottomBar">\n';
theString+='<OBJECT units="pixel">\n<POLYGON ';
theString+='coords="0'+coordsDelimiter+'1'+pairsDelimiter;
theString+='1'+coordsDelimiter+bottomBarHeight+pairsDelimiter;
theString+=(iWidth-1)+coordsDelimiter+bottomBarHeight+pairsDelimiter;
theString+=(iWidth-1)+coordsDelimiter+'1'+pairsDelimiter;
theString+='0'+coordsDelimiter+'1">\n';
theString+='<SIMPLEPOLYGONSYMBOL fillcolor="'+bottomBarColor+'" boundary="true" boundarycolor="'+bottomBarOutline+'" overlap="false" />\n';
theString+='</POLYGON>\n</OBJECT>\n';
theString+='</LAYER>\n';
}
if(drawCopyright){
theString+='<LAYER type="acetate" name="theCopyright">\n';
theString+='<OBJECT units="pixel">\n<TEXT coords="'+CopyrightCoords+'" label="'+CopyrightText+'">\n';
theString+='<TEXTMARKERSYMBOL fontstyle="'+CopyrightStyle+'" fontsize="'+CopyrightSize+'" ';
if(CopyrightFont!="")theString+='font="'+CopyrightFont+'" ';
theString+='fontcolor="'+CopyrightColor+'" antialiasing="True" ';
if(CopyrightBackground.toUpperCase()=="TRUE")theString+='blockout="'+CopyrightBGColor+'" ';
if(CopyrightShadow.toUpperCase()=="TRUE")theString+='shadow="'+CopyrightShadowColor+'" ';
theString+='overlap="false" ';
if(CopyrightGlow.toUpperCase()=="TRUE")theString+=' glowing="'+CopyrightGlowColor+'" ';
theString+='/>\n</TEXT>\n</OBJECT>\n';
theString+='</LAYER>\n';
}
if(drawNorthArrow){
theString+='<LAYER type="acetate" name="theNorthArrow">\n';
theString+='<OBJECT units="pixel">\n<NORTHARROW type="'+NorthArrowType+'" size="'+NorthArrowSize+'" coords="'+NorthArrowCoords+'" shadow="32,32,32" ';
theString+='angle="'+NorthArrowAngle+'" antialiasing="True" overlap="False" />\n</OBJECT>\n';
theString+='</LAYER>\n';
}
if(drawScaleBar){
theString+='<LAYER type="acetate" name="theScaleBar">\n';
xDistance=eRight-eLeft;
theString+='<OBJECT units="pixel">\n';
theString+='<SCALEBAR ';
if(drawScaleBar2){
theString+='screenlength="'+parseInt(iWidth*(1/10))+'" coords="'+(iWidth-((parseInt(iWidth*(4/10)))+20))+coordsDelimiter+'3" ';
}else{
theString+='screenlength="'+parseInt(iWidth*(2/10))+'" coords="'+parseInt(iWidth*(6/10))+coordsDelimiter+'3" ';
}
if(MapUnits=="DEGREES")theString+='mode="geodesic" ';
if(ScaleBarFont!="")theString+='font="'+ScaleBarFont+'" ';
theString+='fontcolor="'+ScaleBarFontColor+'" fontstyle="'+ScaleBarStyle+'" barcolor="'+ScaleBarColor+'" ';
if(MapUnits!="DEGREES"){
theString+='mapunits="'+MapUnits.toLowerCase()+'" ';
}
theString+='scaleunits="'+ScaleBarUnits.toLowerCase()+'" antialiasing="True" ';
var sDistance=getScaleBarDistance();
if(MapUnits=="DEGREES"){
if(xDistance<1/10){
theString+='precision="'+ScaleBarPrecision+'" ';
}
}else if(sDistance<5){
theString+='precision="'+ScaleBarPrecision+'" ';
}
theString+='fontsize="'+ScaleBarSize+'" barwidth="'+ScaleBarWidth+'" overlap="False"  ';
theString+='/>\n</OBJECT>\n';
theString+='</LAYER>\n';
}
if(drawScaleBar2){
theString+='<LAYER type="acetate" name="theScaleBar2">\n';
xDistance=eRight-eLeft;
theString+='<OBJECT units="pixel">\n';
theString+='<SCALEBAR ';
if(drawScaleBar){
theString+='screenlength="'+parseInt(iWidth*(1/10))+'" coords="'+(iWidth-((parseInt(iWidth*(2/10)))+10))+coordsDelimiter+'3" ';
}else{
theString+='screenlength="'+parseInt(iWidth*(2/10))+'" coords="'+parseInt(iWidth*(6/10))+coordsDelimiter+'3" ';
}
if(MapUnits=="DEGREES")theString+='mode="geodesic" ';
if(ScaleBar2Font!="")theString+='font="'+ScaleBar2Font+'" ';
theString+='fontcolor="'+ScaleBar2FontColor+'" fontstyle="'+ScaleBar2Style+'" barcolor="'+ScaleBar2Color+'" ';
if(MapUnits!="DEGREES"){
theString+='mapunits="'+MapUnits.toLowerCase()+'" ';
}
theString+='scaleunits="'+ScaleBar2Units.toLowerCase()+'" antialiasing="True" ';
var sDistance=getScaleBarDistance();
if(MapUnits=="DEGREES"){
if(xDistance<1/10){
theString+='precision="'+ScaleBar2Precision+'" ';
}
}else if(sDistance<5){
theString+='precision="'+ScaleBar2Precision+'" ';
}
theString+='fontsize="'+ScaleBar2Size+'" barwidth="'+ScaleBar2Width+'" overlap="False"  ';
theString+='/>\n</OBJECT>\n';
theString+='</LAYER>\n';
}
if(aimsCustomPresent)theString+=addCustomToMap3();
if(drawModeOnMap){
theString+='<LAYER type="acetate" name="theMode">\n';
theString+='<OBJECT units="pixel">\n<TEXT coords="5'+coordsDelimiter+(iHeight-10)+'" label="'+modeBlurb+'">\n';
theString+='<TEXTMARKERSYMBOL fontstyle="BOLD" fontsize="12" font="ARIAL" fontcolor="'+modeMapColor+'" ';
theString+='threed="TRUE" glowing="'+modeMapGlow+'" overlap="false" />\n</TEXT>\n</OBJECT>';
theString+='</LAYER>\n';
}
if(aimsCustomPresent)theString+=addCustomToMap4();
theString+='</GET_IMAGE>\n</REQUEST>\n</ARCXML>';
return theString;
}
function writeOVXML(){
var extentRatio=xDistance/fullWidth;
var midX=eLeft+xHalf;
var midY=eBottom+yHalf;
var theString='<ARCXML version="1.1">\n<REQUEST>\n<GET_IMAGE><PROPERTIES>\n';
theString+='<ENVELOPE minx="'+forceOVComma(fullOVLeft)+'" miny="'+forceOVComma(fullOVBottom)+'" maxx="'+forceOVComma(fullOVRight)+'" maxy="'+forceOVComma(fullOVTop)+'" />\n';
theString+='<IMAGESIZE height="'+i2Height+'" width="'+i2Width+'" />\n';
if((toggleOVVisible)&&(imsURL==imsOVURL)){
theString+='<LAYERLIST >\n';
for(var i=0;i<layerCount;i++){
if(LayerVisible[i]==1){
visString="true";
}
else{
visString="false";
}
theString+='<LAYERDEF name="'+LayerName[i]+'" visible="'+visString+'" />\n';
}
theString+='</LAYERLIST>\n';
}
if(mapBackColor!=""){
theString+='<BACKGROUND color="'+mapBackColor+'" />\n';
}
theString+='</PROPERTIES>\n';
if(drawOVExtentBox){
theString+='<LAYER type="acetate" name="ACETATE">\n';
if(extentRatio<(1/100)){
theString+='<OBJECT units="database">\n<POINT coord="'+forceOVComma(midX)+coordsDelimiter+forceOVComma(midY)+'">\n';
theString+='<SIMPLEMARKERSYMBOL  type="Square" color="'+ovBoxColor+'" width="4" />\n</POINT></OBJECT>\n';
}else{
theString+='<OBJECT units="database">\n<LINE coords="'+forceOVComma(eLeft)+coordsDelimiter+forceOVComma(eBottom)+pairsDelimiter+forceOVComma(eLeft)+coordsDelimiter+forceOVComma(eTop)+pairsDelimiter;
theString+=forceOVComma(eRight)+coordsDelimiter+forceOVComma(eTop)+pairsDelimiter+forceOVComma(eRight)+coordsDelimiter+forceOVComma(eBottom)+pairsDelimiter+forceOVComma(eLeft)+coordsDelimiter+forceOVComma(eBottom)+'">\n';
theString+='<SIMPLELINESYMBOL type="solid" color="'+ovBoxColor+'" width="3" />\n</LINE></OBJECT>\n';
}
theString+='</LAYER>\n';
}
theString+='</GET_IMAGE>\n</REQUEST>\n</ARCXML>';
return theString;
}
function getXYs(theString){
var tempStr="";
var smallStr="";
var startpos=0;
var endpos=0;
var theReply=theString
var theXYs=getEnvelopeXYs(theString,0)
eLeft=theXYs[0];
eBottom=theXYs[1];
eRight=theXYs[2];
eTop=theXYs[3];
xDistance=Math.abs(eRight-eLeft);
yDistance=Math.abs(eTop-eBottom);
xHalf=xDistance/2;
yHalf=yDistance/2;
panX=xDistance*panFactor;
panY=yDistance*panFactor;
var sFactor=xDistance/iWidth
if(aimsLayersPresent){
if(sFactor!=mapScaleFactor){
mapScaleFactor=sFactor;
if((hasTOC)&&(!legendVisible))parent.TOCFrame.document.location=appDir+"toc.htm";
if(aimsLayersPresent){
if(LayerListOpen)writeLayerListForm();
}
}
}
}
function getXYs(theString){
var tempStr="";
var smallStr="";
var startpos=0;
var endpos=0;
var theReply=theString
var theXYs=getEnvelopeXYs(theString,0)
eLeft=theXYs[0];
eBottom=theXYs[1];
eRight=theXYs[2];
eTop=theXYs[3];
xDistance=Math.abs(eRight-eLeft);
yDistance=Math.abs(eTop-eBottom);
xHalf=xDistance/2;
yHalf=yDistance/2;
panX=xDistance*panFactor;
panY=yDistance*panFactor;
var sFactor=xDistance/iWidth
if(aimsLayersPresent){
if(sFactor!=mapScaleFactor){
mapScaleFactor=sFactor;
if((hasTOC)&&(!legendVisible))parent.TOCFrame.document.location=appDir+"toc.htm";
if(aimsLayersPresent){
if(LayerListOpen)writeLayerListForm();
}
}
}
}
function getOVXYs(theString){
var tempStr="";
var smallStr="";
var startpos=0;
var endpos=0;
var tempComma=forceCommaInRequest[activeMapServiceIndex];
var theXYs=getEnvelopeXYs(theString,0)
forceCommaInOV=forceCommaInRequest[activeMapServiceIndex];
forceCommaInRequest[activeMapServiceIndex]=tempComma;
fullOVLeft=theXYs[0];
fullOVBottom=theXYs[1];
fullOVRight=theXYs[2];
fullOVTop=theXYs[3];
fullOVWidth=Math.abs(fullOVRight-fullOVLeft);
fullOVHeight=Math.abs(fullOVTop-fullOVBottom);
}
function getURL(theReply){
var theURL="";
var startpos=0;
var endpos=0;
var pos=theReply.indexOf("OUTPUT");
if(pos!=-1){
theURL=getInsideString(theReply,'url="',dQuote,pos,0,false);
}
legendImage=getLegendURL(theReply);
return theURL;
}
function getLegendURL(theReply){
var theURL="";
var startpos=0;
var endpos=0;
var pos=theReply.indexOf("LEGEND");
if(pos!=-1){
theURL=getInsideString(theReply,'url="',dQuote,pos,0,false);
}
return theURL;
}
function justGetMap(theURL,extentLeft,extentTop,extentRight,extentBottom,getOVMap){
var mode=900;
if(getOVMap)mode=1;
if(extentLeft!="")eLeft=extentLeft;
if(extentTop!="")eTop=extentTop
if(extentRight!="")eRight=extentRight;
if(extentBottom!="")eBottom=extentBottom;
var theText=writeXML();
if(debugOn==2)alert(msgList[12]+theText);
sendToServer(theURL,theText,mode);
}
function getEnvelopeXYs(theString,startpos){
var theEnvelope=new Array();
theString=theString.toUpperCase();
var tempString="";
var pos=theString.indexOf("ENVELOPE",startpos);
if(pos!=-1){
pos=pos+8;
startpos=theString.indexOf("MINX=",pos);
startpos+=6;
var endpos=theString.indexOf(dQuote,startpos);
tempString=theString.substring(startpos,endpos);
theEnvelope[0]=parseFloat(setDecimalString(tempString));
startpos=theString.indexOf("MINY=",pos);
startpos+=6;
endpos=theString.indexOf(dQuote,startpos);
tempString=theString.substring(startpos,endpos);
theEnvelope[1]=parseFloat(setDecimalString(tempString));
startpos=theString.indexOf("MAXX=",pos);
startpos+=6;
endpos=theString.indexOf(dQuote,startpos);
tempString=theString.substring(startpos,endpos);
theEnvelope[2]=parseFloat(setDecimalString(tempString));
startpos=theString.indexOf("MAXY=",pos);
startpos+=6;
endpos=theString.indexOf(dQuote,startpos);
tempString=theString.substring(startpos,endpos);
theEnvelope[3]=parseFloat(setDecimalString(tempString));
xmlEndPos=endpos;
}
return theEnvelope;
}
function setDecimalString(numberString){
if(numberString.indexOf(",")!=-1)forceCommaInRequest[activeMapServiceIndex]=true;
if(decimalChar=="."){
numberString=numberString.replace(/,/g,".");
}else{
numberString=numberString.replace(/./g,",");
}
return numberString;
}
function forceComma(theNumber){
var comma=",";
var dot=".";
var charOut=comma;
var charIn=dot;
var numberString=new String(theNumber);
if(forceCommaInRequest[activeMapServiceIndex]){
charOut=dot;
charIn=comma;
}
var pos=numberString.indexOf(charOut);
if(pos!=-1){
var begin=numberString.substring(0,pos);
var ending=numberString.substring(pos+1,numberString.length);
numberString=begin+charIn+ending;
}
return numberString;
}
function forceOVComma(theNumber){
var comma=",";
var dot=".";
var charOut=comma;
var charIn=dot;
var numberString=new String(theNumber);
if(forceCommaInOV){
charOut=dot;
charIn=comma;
}
var pos=numberString.indexOf(charOut);
if(pos!=-1){
var begin=numberString.substring(0,pos);
var ending=numberString.substring(pos+1,numberString.length);
numberString=begin+charIn+ending;
}
return numberString;
}
function getXMLErrorMessage(theString){
var pos1=0;
var pos2=0;
var pos3=0;
var theError="";
pos3=theString.indexOf("<ERROR");
if(pos3!=-1){
pos1=theString.indexOf(">",pos3);
pos1+=1;
pos2=theString.indexOf("</ERROR");
theError=theString.substring(pos1,pos2)
}
return theError;
}
function isNotSameHostInURL(theURL,theHost){
var startpos=theURL.indexOf("//");
if(startpos==-1){
startpos=0;
}else{
startpos=startpos+2;
}
var endpos=theURL.indexOf("/",startpos);
if(endpos==-1)endpos=theURL.length;
var thisHost=theURL.substring(startpos,endpos);
if(thisHost==theHost){
return false;
}else{
return true;
}
}
