
var selMaxEnvelope = new Array();
var objIDs = "";
var highlightedOne = "";
// global variables
aimsCustomPresent = true;
// change these to send XML response to custom function.
// use numbers >= 1000 and match in useCustomFunction()
// defaults are defined in aimsXML.js and use standard functions
// xml response mode for selection
selectXMLMode = 6;
// xml response mode for identify
identifyXMLMode = 7;
// xml response mode for query
queryXMLMode = 8;
// xml response mode for find
findXMLMode = 14;
// xml response mode hyperlink
hyperlinkXMLMode = 15;



var customQuery = "";
var customQueryId = ""
var customSelectedLayers = new Array();
var doneFeatureRequest;
var searchString;
var l = 0;
var customSelectionValue = "";
var customAddressValue = "";
var customDistanceValue = "";
var customtheX = 0;
var customtheY = 0;
var queryCommunity = false;
var custombuffDist = 0;
var replyString = "";
var polyString = "";



var fString;
var cString;
var nField;
var count = 1;
var feaCount;
var nString = new Array();
var aString = new Array();
var dString = new Array();
var pString = new Array();
var mString = new Array();
var extY;
var extX;
var mStringArray = new Array();

// custom function for handling clicks
// 		flow redirected here when
// 		toolMode set to >= 1000
function customMapTool(e) {
   if (toolMode == 1001) {
      // insert code here
      return false;

   }
   if (toolMode == 1002) {
      // insert code here

   }

}


// send  XML response to custom function
// 		flow  redirected here when
// 		XMLMode >= 1000
function useCustomFunction(theReply) {
   if (XMLMode == 1001) {
      featureNum = parent.MapFrame.justGetFeatureCount(theReply)
      parent.MapFrame.clearSelection
      // JH - Place the number of features returned into a variable
      var tempCount = featureNum;
      pos = theReply.indexOf("minx=");
      if (pos != - 1) {
         startpos = pos + 6;
         endpos = theReply.indexOf("miny=", startpos) - 2;
         if (endpos == - 1) endpos = theReply.length;
         minX = theReply.substring(startpos, endpos);
      }
      pos = theReply.indexOf("miny=");
      if (pos != - 1) {
         startpos = pos + 6;
         endpos = theReply.indexOf("maxx=", startpos) - 2;
         if (endpos == - 1) endpos = theReply.length;
         minY = theReply.substring(startpos, endpos);
      }
      pos = theReply.indexOf("maxx=");
      if (pos != - 1) {
         startpos = pos + 6;
         endpos = theReply.indexOf("maxy=", startpos) - 2;
         if (endpos == - 1) endpos = theReply.length;
         maxX = theReply.substring(startpos, endpos);
      }
      pos = theReply.indexOf("maxy=");
      if (pos != - 1) {
         startpos = pos + 6;
         endpos = theReply.indexOf("<FIELDS", startpos) - 3;
         if (endpos == - 1) endpos = theReply.length;
         maxY = theReply.substring(startpos, endpos);
      }
      pos = theReply.indexOf("OBJECTID=");
      if (pos != - 1) {
         startpos = pos + 10;
         endpos = theReply.indexOf("SHAPE", startpos) - 3;
         if (endpos == - 1) endpos = theReply.length;
         objID = theReply.substring(startpos, endpos);
      }
      parent.MapFrame.selectRight[0] = parseFloat(maxX)
      parent.MapFrame.selectLeft[0] = parseFloat(minX)
      parent.MapFrame.selectTop[0] = parseFloat(maxY)
      parent.MapFrame.selectBottom[0] = parseFloat(minY)
      featureNum = 0;

      // JH - Get the max extent for all returned records
      objIDs = "";
      var endpos = 1;
      var thePos = theReply.indexOf("OBJECTID=");
      for (var i = 0; i < tempCount; i ++ ){
         var theXYs = getEnvelopeXYs2(theReply, endpos);
         selectLeft[i] = theXYs[0];
         selectBottom[i] = theXYs[1];
         selectRight[i] = theXYs[2];
         selectTop[i] = theXYs[3];
         endpos = xmlEndPos;

         if (thePos != - 1) {
            theStartpos = thePos + 10;
            theEndpos = theReply.indexOf("SHAPE", theStartpos) - 3;
            if (endpos == - 1) theEndpos = theReply.length;
            if (i == tempCount - 1){
               objIDs += theReply.substring(theStartpos, theEndpos);
            }
            else{
               objIDs += theReply.substring(theStartpos, theEndpos) + ",";
            }
            thePos = theReply.indexOf("OBJECTID", theEndpos);
         }

      }
      calcCustomSelectEnvelope(tempCount);
      // JH - Call custom function to zoom to all returned records as well as highlight them
      parent.MapFrame.zoomToCustomReturnedRecords();
      // Old code - parent.MapFrame.showHighlight2(featureNum, objID)
   }
   else if (XMLMode == 1003) {
      var sPos = theReply.indexOf("<COORDS>", 0);
      var ePos = theReply.indexOf("</", snPos + 8);
      polyString = theReply.substring(sPos, ePos + 9);
      getXYs(theReply);
      startLeft = eLeft;
      startTop = eTop;
      startRight = eRight;
      startBottom = eBottom;


      setCustomStartQuery()
   }
   else {
      alert(msgList[55] + XMLMode + msgList[56]);
   }
   hideLayer("LoadData");
}

function writeHTML() {

   var theFrame = "parent.MapFrame";
   if ((useExternalWindow) || ( ! useTextFrame)) {
      var Win1 = window.open("", "QueryWindow", "toolbar=no,status=yes,menubar=no,scrollbars=1,resizable=yes,width=650,height=410,left=0,top=0");
      theFrame = "opener";
      if (parent.MapFrame != null) theFrame = "opener.parent.MapFrame";
   }
   else {
      var Win1 = parent.TextFrame;
      Win1.document.open();
   }

   Win1.document.open();
   Win1.document.write("<html><head>");
   Win1.document.writeln('<link REL="stylesheet" Type="text/css" HREF="' + appDir + 'westchester.css" >');
   Win1.document.write("<title>Found Facility List</title></head><body leftmargin=0 topmargin=0 bgcolor='white'  >");
   Win1.document.writeln('<table border="0" cellspacing="0" cellpadding="0" width="560"> <tr> <td bgcolor="#ffffff" width="150"> <IMG height="48" src="/westchester/emap/images/wcgov_pop.gif" width="115"></td>');
   Win1.document.writeln('<td width="280" align="middle" valign="bottom"> <table border="0" cellspacing="0" cellpadding="5"> <tr> <td class="poptitle">Locate Results</td></tr></table></td>');
   Win1.document.writeln('<td valign="bottom" align="right" width="150"><a href="#" onclick="parent.window.print()"; return false"><img src="/westchester/emap/images/print.gif" width="41" height="41" border="0"></a>&nbsp;&nbsp;<a href="#" onclick="parent.window.close()"><IMG height="32" src="/westchester/emap/images/close_window.gif" width="97" border="0"></td></tr><tr> ');
   Win1.document.writeln('<td bgcolor="#015963"><IMG height="22" src="/westchester/emap/images/menu_top_left.gif" width="17"></td><td width="15" bgcolor="#015963">&nbsp;</td>');
   Win1.document.writeln('<td valign="top" align="right" bgcolor="#015963"><IMG height=22 src="/westchester/emap/images/menu_top_right.gif" width=17></td></tr></table>');
   Win1.document.write(replyString);
   Win1.document.write("</body></html>");
   Win1.document.close();

}

// add custom stuff to Map XML request. . . between selection and geocode
function addCustomToMap1(){
   var customString = "";
   return customString;
}

// add custom stuff to Map XML request. . . between clickpoints and copyright
function addCustomToMap2(){
   var customString = "";

   return customString;
}

// add custom stuff to Map XML request. . . under modeOnMap
function addCustomToMap3(){
   var customString = "";
   return customString;
}

// add custom stuff to Map XML request. . . on top of everything
function addCustomToMap4(){
   var customString = "";

   return customString;
}

// extract layers to download
function extractIt() {
   hideLayer("measureBox");
   alert(msgList[51]);
}

// JH - Added custom function to show ALL returned records
function calcCustomSelectEnvelope(theNum) {
   if (theNum > 0) {
      selMaxEnvelope[0] = parseFloat(selectLeft[0]);
      selMaxEnvelope[1] = parseFloat(selectBottom[0]);
      selMaxEnvelope[2] = parseFloat(selectRight[0]);
      selMaxEnvelope[3] = parseFloat(selectTop[0]);
      if (theNum > 1) {
         for (var i = 1; i < theNum; i ++ ) {
            if (parseFloat(selectLeft[i]) < selMaxEnvelope[0]) selMaxEnvelope[0] = parseFloat(selectLeft[i]);
            if (parseFloat(selectBottom[i]) < selMaxEnvelope[1]) selMaxEnvelope[1] = parseFloat(selectBottom[i]);
            if (parseFloat(selectRight[i]) > selMaxEnvelope[2]) selMaxEnvelope[2] = parseFloat(selectRight[i]);
            if (parseFloat(selectTop[i]) > selMaxEnvelope[3]) selMaxEnvelope[3] = parseFloat(selectTop[i]);
         }
      }
   }
}

// JH - Added custom function to show ALL returned records
function getEnvelopeXYs2(theString, startpos) {
   var theEnvelope = new Array();
   // forceCommaInRequest[activeMapServiceIndex] = false;
   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;

}

// JH - Added custom function to show ALL returned records
function zoomToCustomReturnedRecords() {
   highlightedOne = LayerIDField[ActiveLayerIndex] + " IN (" + objIDs + ")";
   calcSelectEnvelope();
   var fWidth = selMaxEnvelope[2] - selMaxEnvelope[0];
   var fHeight = selMaxEnvelope[3] - selMaxEnvelope[1];
   var mWMargin = 0;
   var mHMargin = 0;
   if ((fWidth == 0) && (fHeight == 0)) {
      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 = selMaxEnvelope[0] - mWMargin;
   eRight = selMaxEnvelope[2] + mWMargin;
   eTop = selMaxEnvelope[3] + mHMargin;
   eBottom = selMaxEnvelope[1] - mHMargin;
   legendTemp = legendVisible;
   legendVisible = false;
   // JH - Use the updateLayers function instead of sendMapXML
   top.TOCFrame.updateLayers();
   // sendMapXML();

}

// JH - Temporary function to show XML
function dispXML(xmlCode){
   xmlCode = xmlCode.replace( /</g, '&lt' );
   var newWindow = open("", "W1", "width=450, height=400, scrollbars=yes, resizable=yes>");
   newWindow.document.write("<html><head><title>Data Download Form</title></head><body leftmargin=0 topmargin=0 text='black' link='DarkRed'>");
   newWindow.document.write(xmlCode);
   newWindow.document.write("</body></html>");
   newWindow.document.close;
}


function makeCircle(x, y, distance) {

   var coordsString = "";
   var increment = 0.0;
   firstTime = true;
   distance = Number(distance);
   x = Number(x);
   y = Number(y);
   while (increment <= 350.0) {
      var x1 = x + distance * Math.cos(increment * Math.PI / 180);
      var y1 = y + distance * Math.sin(increment * Math.PI / 180);
      coordsString = coordsString + String(x1) + " ";
      coordsString = coordsString + String(y1) + ";";
      if (firstTime) {
         firstString = coordsString;
         firstTime = false;
      }
      increment = increment + 10;
   }
   // close off circle
   var lastString = firstString.substring(0, firstString.length - 1)
   coordsString = coordsString + lastString;
   // alert(coordsString);
   return coordsString;
}

function makePoly(x, y, distance) {
   var polyString = "";
   var increment = 0.0;
   firstTime = true;
   distance = Number(distance);
   x = Number(x);
   y = Number(y);
   while (increment <= 350.0) {
      var x1 = x + distance * Math.cos(increment * Math.PI / 180);
      var y1 = y + distance * Math.sin(increment * Math.PI / 180);
      polyString = polyString + "<POINT x=\""+String(x1)+"\" y=\""+String(y1)+"\" />";
      if (firstTime) {
         firstString = polyString;
         firstTime = false;
      }
      increment = increment + 10;
   }
   // close off circle
   var lastString = firstString.substring(0, firstString.length)
   polyString = polyString + lastString;
   // alert(coordsString);
   return polyString;
}

function getPolygonRequest(){

   var customString = "";
   customString = customString + '<ARCXML version="1.0">';
   customString = customString + '<REQUEST>';
   customString = customString + '<GET_FEATURES featurelimit="25" beginrecord="0" outputmode="xml" geometry="true" envelope="true" compact="true">';
   customString = customString + '<LAYER id="' + customQueryId + '" />';


   if (customQueryId == "ERPABoundary") {
      customString = customString  + '<SPATIALQUERY subfields="#ALL#" where="WCERPA_ID =' + queryXMLsafe(customQuery) + '">';
   }
   else if (customQueryId == "SchoolDistricts") {
      customString = customString  + '<SPATIALQUERY subfields="#ALL#" where="DISTNAME=\'' + queryXMLsafe(customQuery)+ '\'">';
   }
   else {
      customString = customString  + '<SPATIALQUERY subfields="#ALL#" where="NAME=\'' + queryXMLsafe(customQuery) + '\'">';
   }

   //  customString = customString + '<SPATIALQUERY subfields="#ALL#" where="' + customQuery  + '">';
   customString = customString + '</SPATIALQUERY>';
   customString = customString + '</GET_FEATURES>';
   customString = customString + '</REQUEST>';
   customString = customString + '</ARCXML>';
   sendToServer(imsQueryURL, customString, 1003);
}

function writeDoc(i, count) {
   win1 = window.open("", "", "top=100, left=50, height=400, width=400, toolbar=0, scrollbars=1, resizable=1");
   win1.document.open();
   win1.document.write("<html><head>");
   win1.document.write('<link REL="stylesheet" Type="text/css" HREF="' + appDir + 'westchester.css" ></head><body leftmargin=0 topmargin=0>');
   win1.document.write("<div align='right'><a href='#' onclick='parent.window.close()'><IMG height='32' src='/westchester/cfl/images/close_window.gif' width='97' border='0'></div><br><b>Additional Information:</b><p>" + mStringArray[i][count]);
   win1.document.write("</p></body></html>");
   win1.document.close();
}
function openWin() {
   win1 = window.open("", "", "top=100, left=50, height=400, width=400, toolbar=0, scrollbars=1, resizable=1");
   switch (customSelectionValue) {
      case 'Cleanups' :
         win1.location.href = "http://www.westchestergov.com/envfacil/2003HCCDFlier.htm";
         break;
      case 'Greenteams' :
         win1.location.href = "http://www.westchestergov.com/envfacil/SW/DryCleanersGreenTeam/drycleanerssurvey.htm";
         break;
   }
}

function GetLayerByID(layerID) {

   var j = - 1;
   for (var i = 0; i < layerCount; i ++ ) {
      if (LayerID[i] == layerID) j = i;
   }
   if (j > - 1) {
      return LayerName[j];
   }
   return "";

}
function queryXMLsafe(oldString) {
   if (oldString == null ) return "";
   oldString = oldString.replace(/&/g, "&amp;");
   oldString = oldString.replace(/'/g, "&apos;&apos;");
   oldString = oldString.replace(/>/g, "&gt;");
   oldString = oldString.replace(/</g, "&lt;");
   oldString = oldString.replace(/"/g, " & quot; & quot; ");

   return oldString;
}
function addNewLabel(){

   var customString = "";
   var sFactor = (eRight - eLeft) / iWidth
   for (var i = 0; i < layerCount; i ++ ) {
      if (LabelVisible[i] == 1)	{
         if ((NewLabelColumn[i] != "" ) && (sFactor >= LayerMinScale[i]) && (sFactor <= LayerMaxScale[i]) && (LayerVisible[i] == 1))
         {
            customString += '<LAYER type="featureclass" name="' + LayerName[i] +'_Label" visible="true">'
            customString += '<DATASET fromlayer="' + LayerID[i] + '"/>'
            customString += '<SIMPLELABELRENDERER howmanylabels="' + NewLabelStyle[i] + '" field="' + NewLabelColumn[i] + '">'
            customString += '<TEXTSYMBOL antialiasing="true" font="Arial" interval="15" fontstyle="regular" fontsize="' + NewLabelSize[i] + '" glowing="' + NewLabelGlow[i]  + '" />'
            customString += '</SIMPLELABELRENDERER></LAYER>'

         }

      }
   }
   return customString;

}
function addCustomCommunity()
{
   var customString = "";
   var startString = "";
   var bRender = false;
   var endString = "";
   var returnString = "";
   var theCoords = makeCircle(customtheX, customtheY, custombuffDist);

   startString += '<LAYER type="acetate" name="buffer" id="buffer">';
   startString  += '<OBJECT units="database">';
   startString  += '<POLYGON coords="' + theCoords + '">';
   startString  += '<SIMPLEPOLYGONSYMBOL  antialiasing="true" fillcolor="190, 245, 255" filltransparency="0" boundary="true" boundarytype="solid" boundarycolor="38,115,0" boundarywidth="3" />';
   startString  += '</POLYGON>';
   startString  += '</OBJECT>';
   startString  += '</LAYER>';

   

   endString += '<LAYER type="acetate" name="acetate" id="102">';
   endString += '<OBJECT units="database">';
   endString += '<POINT coords="' + customtheX + ' ' + customtheY + '">';
   endString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI Default Marker" character="97" fontcolor="38,115,0" fontstyle="bold" fontsize="24" />';
   endString += '</POINT>';
   endString += '</OBJECT>';
   endString += '</LAYER>';
   endString += '<LAYER type="acetate" name="acetate" id="103">';
   endString += '<OBJECT units="database">';
   endString += '<TEXT coords="' + customtheX + ' ' + customtheY + '" label="' + customAddressValue +'">';
   endString += '<TEXTMARKERSYMBOL  antialiasing="true" fontstyle="bold" fontsize="14" font="Arial" fontcolor="38,115,0" glowing="255,255,155" overlap="false" interval="8" />';
   endString += '</TEXT>';
   endString += '</OBJECT>';
   endString += '</LAYER>';

   returnString = startString + endString;
   return  returnString;

}
function addCustomCommunity_()
{
   var customString = "";
   var startString = "";
   var bRender = false;
   var endString = "";
   var returnString = "";
   var theCoords = makeCircle(customtheX, customtheY, custombuffDist);

   startString += '<LAYER type="acetate" name="buffer" id="buffer">';
   startString  += '<OBJECT units="database">';
   startString  += '<POLYGON coords="' + theCoords + '">';
   startString  += '<SIMPLEPOLYGONSYMBOL  antialiasing="true" fillcolor="190, 245, 255" filltransparency="0" boundary="true" boundarytype="solid" boundarycolor="38,115,0" boundarywidth="3" />';
   startString  += '</POLYGON>';
   startString  += '</OBJECT>';
   startString  += '</LAYER>';

   if (queryClosest)
   {
      customString += '<LAYER type="featureclass" name="Found '+customSelectionValue+'" id ="100">';
      customString += '<DATASET fromlayer="' + customSelectionValue + '" />';
      customString += '<SPATIALQUERY subfields="#ALL#" where="' + queryCommunityClause + '">';
      customString += '</SPATIALQUERY>';
      customString += '<GROUPRENDERER>';
   }
   else
   {
      customString += '<LAYER type="featureclass" name="Found '+customSelectionValue+'" id ="100">';
      customString += '<DATASET fromlayer="' + customSelectionValue + '" />';
      customString += '<SPATIALQUERY>';
      customString += '<SPATIALFILTER relation="area_intersection">';
      customString += '<POLYGON><RING>';
      customString += makePoly(customtheX, customtheY, custombuffDist);
      customString += '</RING></POLYGON>';
      customString += '</SPATIALFILTER>';
      customString += '</SPATIALQUERY>';
      customString += '<GROUPRENDERER>';
   }



   if (customSelectionValue == "Cell Phone Drop Off" )
   {
      //bRender = true;
      // SetVisiblebyId(customSelectionValue,1)
      customString += '<SIMPLERENDERER>';
      customString += '<RASTERMARKERSYMBOL url="http://giswww.westchestergov.com/website/greenmap/images/" image="C:\ArcIMS\Website\GreenMap\images\GMS_Cell.gif" />';
      customString += '</SIMPLERENDERER>';
      customString += '<SIMPLELABELRENDERER field="NAME" labelpriorities="1,2,2,4,5,3,2,4">';
      customString += '<TEXTSYMBOL antialiasing="true" font="Arial" fontstyle="regular" fontsize="10" fontcolor="243,0,194" interval="16"/>';
      customString += '</SIMPLELABELRENDERER>';

   }
   else if (customSelectionValue == "Paint Hardener Stores" )
   {
      //bRender = true;
      // SetVisiblebyId(customSelectionValue,1)
      customString += '<SIMPLERENDERER>';
      customString += '<RASTERMARKERSYMBOL url="http://giswww.westchestergov.com/website/greenmap/images/" image="C:\ArcIMS\Website\GreenMap\images\Swatch_paint.gif" />';
      customString += '</SIMPLERENDERER>';
      customString += '<SIMPLELABELRENDERER field="NAME" labelpriorities="1,2,2,4,5,3,2,4">';
      customString += '<TEXTSYMBOL antialiasing="true" font="Arial" fontstyle="regular" fontsize="10" fontcolor="243,0,194" interval="16"/>';
      customString += '</SIMPLELABELRENDERER>';

   }
   else if (customSelectionValue == "Recycling Tour"  )
   {
      //bRender = true;
      // SetVisiblebyId(customSelectionValue,1)
      customString += '<SIMPLERENDERER>';
      customString += '<RASTERMARKERSYMBOL url="http://giswww.westchestergov.com/website/greenmap/images/" image="C:\ArcIMS\Website\GreenMap\images\GMS_GreenTour.gif" />';
      customString += '</SIMPLERENDERER>';
      customString += '<SIMPLELABELRENDERER field="NAME" labelpriorities="1,2,2,4,5,3,2,4">';
      customString += '<TEXTSYMBOL antialiasing="true" font="Arial" fontstyle="regular" fontsize="10" fontcolor="233,9,9" interval="16"/>';
      customString += '</SIMPLELABELRENDERER>';

   }
   else if (customSelectionValue == "Wind Powered Locations"  )
   {
      //bRender = true;
      // SetVisiblebyId(customSelectionValue,1)
      customString += '<SIMPLERENDERER>';
      customString += '<RASTERMARKERSYMBOL url="http://giswww.westchestergov.com/website/greenmap/images/" image="C:\ArcIMS\Website\greenmap\images\GMS_WindPower.gif" />';
      customString += '</SIMPLERENDERER>';
      customString += '<SIMPLELABELRENDERER field="NAME" labelpriorities="1,2,2,4,5,3,2,4">';
      customString += '<TEXTSYMBOL antialiasing="true" font="Arial" fontstyle="regular" fontsize="10" fontcolor="117,90,50" interval="16"/>';
      customString += '</SIMPLELABELRENDERER>';
    
   }
   else if (customSelectionValue == "Energy Star Buildings"  )
   {
      //bRender = true;
      // SetVisiblebyId(customSelectionValue,1)
      customString += '<SIMPLERENDERER>';
      customString += '<RASTERMARKERSYMBOL url="http://giswww.westchestergov.com/website/greenmap/images/" image="C:\ArcIMS\Website\greenmap\images\GMS_EcoBldg.gif" />';
      customString += '</SIMPLERENDERER>';     
      customString += '<SIMPLELABELRENDERER field="BUILDING" labelpriorities="1,2,2,4,5,3,2,4">';
      customString += '<TEXTSYMBOL antialiasing="true" font="Arial" fontstyle="regular" fontsize="10" fontcolor="117,90,50" interval="16"/>';
      customString += '</SIMPLELABELRENDERER>';
 
   }
   else if (customSelectionValue == "Energy Star Retailers"  )
   {
      //bRender = true;
      // SetVisiblebyId(customSelectionValue,1)
      customString += '<SIMPLERENDERER>';
      customString += '<RASTERMARKERSYMBOL url="http://giswww.westchestergov.com/website/greenmap/images/" image="C:\ArcIMS\Website\greenmap\images\GMS_EcoDesgn.gif" />';
      customString += '</SIMPLERENDERER>';
      customString += '<SIMPLELABELRENDERER field="NAME" labelpriorities="1,2,2,4,5,3,2,4">';
      customString += '<TEXTSYMBOL antialiasing="true" font="Arial" fontstyle="regular" fontsize="10" fontcolor="117,90,50" interval="16"/>';
      customString += '</SIMPLELABELRENDERER>';
     
   }
   else if (customSelectionValue == "Energy Star Builders"  )
   {
      //bRender = true;
      // SetVisiblebyId(customSelectionValue,1)
      customString += '<SIMPLERENDERER>';
      customString += '<RASTERMARKERSYMBOL url="http://giswww.westchestergov.com/website/greenmap/images/" image="C:\ArcIMS\Website\greenmap\images\GMS_EcoDesgn.gif" />';
      customString += '</SIMPLERENDERER>';
      customString += '<SIMPLELABELRENDERER field="NAME" labelpriorities="1,2,2,4,5,3,2,4">';
      customString += '<TEXTSYMBOL antialiasing="true" font="Arial" fontstyle="regular" fontsize="10" fontcolor="117,90,50" interval="16"/>';
      customString += '</SIMPLELABELRENDERER>';
     
   }
   else if (customSelectionValue == "Farmers Market"  )
   {
      //bRender = true;
      // SetVisiblebyId(customSelectionValue,1)
      customString += '<SIMPLERENDERER>';
      customString += '<RASTERMARKERSYMBOL url="http://giswww.westchestergov.com/website/greenmap/images/" image="C:\ArcIMS\Website\GreenMap\images\GMS_FarmerMarket.gif" />';
      customString += '</SIMPLERENDERER>';
      customString += '<SIMPLELABELRENDERER field="NAME" labelpriorities="1,2,2,4,5,3,2,4">';
      customString += '<TEXTSYMBOL antialiasing="true" font="Arial" fontstyle="regular" fontsize="10" fontcolor="8,143,34" interval="16"/>';
      customString += '</SIMPLELABELRENDERER>';
   
   }
   else if (customSelectionValue == "Nature Preserve" )
   {
       //bRender = true;
      // SetVisiblebyId(customSelectionValue,1)
      customString += '<SIMPLERENDERER>';
      customString += '<RASTERMARKERSYMBOL url="http://giswww.westchestergov.com/website/greenmap/images/" image="C:\ArcIMS\Website\GreenMap\images\GMS_NaturePreserve.gif" />';
      customString += '</SIMPLERENDERER>';
      customString += '<SIMPLELABELRENDERER field="NAME" labelpriorities="1,2,2,4,5,3,2,4">';
      customString += '<TEXTSYMBOL antialiasing="true" font="Arial" fontstyle="regular" fontsize="10" fontcolor="169,37,237" interval="16"/>';
      customString += '</SIMPLELABELRENDERER>';
 
   }
   else if (customSelectionValue == "Gardens"  )
   {
      //bRender = true;
      // SetVisiblebyId(customSelectionValue,1)
      customString += '<SIMPLERENDERER>';
      customString += '<RASTERMARKERSYMBOL url="http://giswww.westchestergov.com/website/greenmap/images/" image="C:\ArcIMS\Website\GreenMap\images\Swatch_SprgBlsms.gif" />';
      customString += '</SIMPLERENDERER>';
      customString += '<SIMPLELABELRENDERER field="NAME" labelpriorities="1,2,2,4,5,3,2,4">';
      customString += '<TEXTSYMBOL antialiasing="true" font="Arial" fontstyle="regular" fontsize="10" fontcolor="194,156,214" interval="16"/>';
      customString += '</SIMPLELABELRENDERER>';
   
   }
   else if (customSelectionValue == "Ferries" )
   {
     //bRender = true;
      // SetVisiblebyId(customSelectionValue,1)
      customString += '<SIMPLERENDERER>';
      customString += '<RASTERMARKERSYMBOL url="http://giswww.westchestergov.com/website/greenmap/images/" image="C:\ArcIMS\Website\greenmap\images\GMS_Ferry.gif" />';
      customString += '</SIMPLERENDERER>';
      customString += '<SIMPLELABELRENDERER field="NAME" labelpriorities="1,2,2,4,5,3,2,4">';
      customString += '<TEXTSYMBOL antialiasing="true" font="Arial" fontstyle="regular" fontsize="10" fontcolor="0,119,255" interval="16"/>';
      customString += '</SIMPLELABELRENDERER>';
    
   }
   else if (customSelectionValue == "Park Points")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true" field="name" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true" font="ESRI US MUTCD 3" character="241" fontcolor="56,168,0" fontsize="14" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Stay Cool Centers")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true" field="NAME" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="115,223,255" interval="16" glowing="255,255,155"/></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<SIMPLEMARKERSYMBOL  antialiasing="true" color="115,223,255" width="12" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Hospitals")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true" field="hospname" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true" font="ESRI Default Marker" character="118" fontcolor="0,0,255" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Libraries")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true" field="libname" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true" font="ESRI Transportation &amp; Civic" character="99" fontcolor="34,97,0" fontsize="18" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Gas Stations")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true" field="station" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL antialiasing="true"  font="ESRI Transportation &amp; Civic" character="85" fontcolor="0,56,147" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Soup Kitchens")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true" field="organizati" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL antialiasing="true"  font="ESRI Public1" character="58" fontcolor="205,46,49" fontsize="18" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Family Resources")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER antialiasing="true" field="organization" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL antialiasing="true" font="ESRI Public1" character="43" fontcolor="56,168,0" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "NYS Employment Centers")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER antialiasing="true" field="name" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL antialiasing="true"  font="ESRI Public1" character="92" fontcolor="0,56,147" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Shelters")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="organizati" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI Transportation &amp; Civic" character="87" fontcolor="152,230,0" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Food Pantries")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="organizati" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL antialiasing="true"   font="ESRI Crime Analysis" character="108" fontcolor="255,0,0" fontsize="18" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "NYS DMV Offices")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="name" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI US MUTCD 3" character="214" fontcolor="0,0,0" fontsize="14" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Senior Centers")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="name" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI Crime Analysis" character="105" fontcolor="255,137,41" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Health Offices")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="name" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI Default Marker" character="67" fontcolor="230,0,0" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Public Schools")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="name" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI Hazardous Materials" character="185" fontcolor="176,0,18" fontsize="18" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Recycling Events")
   {
      //bRender = true;
      // SetVisiblebyId(customSelectionValue,1)
      customString += '<VALUEMAPRENDERER lookupfield="EVENT">'
      customString += '<EXACT value="HRD" label="Household Recycle Days">'
      customString += '<TRUETYPEMARKERSYMBOL font="ESRI Enviro Hazard Incident" fontstyle="regular" fontsize="16" fontcolor="0,99,60" character="33" glowing="255,255,255"/>'
      customString += '</EXACT>'
      customString += '<EXACT value="E-Waste" label="E-Waste Days">'
      customString += '<TRUETYPEMARKERSYMBOL font="ESRI Enviro Hazard Incident" fontstyle="regular" fontsize="16" fontcolor="255,170,0" character="33" glowing="255,255,255"/>'
      customString += '</EXACT>'
      customString += '<EXACT value="Shredder" label="Mobile Shredder Days">'
      customString += '<TRUETYPEMARKERSYMBOL font="ESRI Enviro Hazard Incident" fontstyle="regular" fontsize="16" fontcolor="115,0,0" character="33" glowing="255,255,255"/>'
      customString += '</EXACT>'
      customString += '</VALUEMAPRENDERER>'
      customString += '<SCALEDEPENDENTRENDERER lower="1:1" upper="1:24000">'
      customString += '<SIMPLELABELRENDERER field="LOCATION" labelpriorities="1,2,2,4,5,3,2,4">'
      customString += '<TEXTSYMBOL antialiasing="true" font="Arial" fontstyle="regular" fontsize="10" fontcolor="0,0,0" interval="16" glowing="255,255,255"/>'
      customString += '</SIMPLELABELRENDERER></SCALEDEPENDENTRENDERER>'
   }
   else if (customSelectionValue == "Dry Cleaner")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="name" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI Enviro Hazard Analysis" character="110" fontcolor="150,205,96" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Tire Disposal Centers")
   {
      //bRender = true;
      // SetVisiblebyId(customSelectionValue,1)
      customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="name" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI Enviro Hazard Analysis" character="97" fontcolor="0,0,0" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Municipal Buildings")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="municipali" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI Cartography" character="241" fontcolor="255,0,0" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Youth Bureaus")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="program" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI Cartography" character="249" fontcolor="0,92,230" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Railroad Stations")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="statname" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI US MUTCD 3" character="164" fontcolor="60,60,60" fontsize="14" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "Bee Line Bus Stops")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="stopnum" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI US MUTCD 3" character="163" fontcolor="0,0,0" fontsize="14" />';
      customString += '</SIMPLERENDERER>';

   }
   else if (customSelectionValue == "Cemeteries")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="name" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI Cartography" character="239" fontcolor="0,0,0" fontsize="18" />';
      customString += '</SIMPLERENDERER>';
   }
   else if (customSelectionValue == "County Regulated Beaches")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="name" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI Enviro Hazard Sites" character="109" fontcolor="20,157,255" fontsize="18" />';
      customString += '</SIMPLERENDERER>';
   }
   // 					else if (customSelectionValue == "Park and Rides") {
   // 					customString += '<SIMPLELABELRENDERER  antialiasing="true"  field="name" labelpriorities="2,2,2,1,2,2,2,2"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="255,0,0" glowing="255,255,115" /></SIMPLELABELRENDERER>';
   // 			    	customString += '<SIMPLERENDERER>';
   // 					customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI Transportation &amp; Civic" character="252" fontcolor="0,0,0" fontsize="14" />';
   // 					customString += '</SIMPLERENDERER>';

   else if (customSelectionValue == "Theaters")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER antialiasing="true"  field="name" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL antialiasing="true"  font="ESRI Hazardous Materials" character="180" fontcolor="255,51,102" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }

   //  ---------------------------------------

   else if (customSelectionValue == "National Register Sites")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER antialiasing="true" field="resname" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL antialiasing="true" font="ESRI Business" character="54" fontcolor="201,87,0" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }

   //  ---------------------------------------

   else if (customSelectionValue == "Post Offices")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER antialiasing="true"   field="name" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL antialiasing="true"   font="ESRI Public1" character="75" fontcolor="32,20,255" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }

   //  ---------------------------------------

   else if (customSelectionValue == "Restaurants")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER antialiasing="true"   field="poi_name" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL antialiasing="true"   font="ESRI Public1" character="59" fontcolor="255,20,75" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }

   //  ---------------------------------------

   else if (customSelectionValue == "Universities and Colleges")
   {
      bRender = true;
      customString += '<SIMPLELABELRENDERER antialiasing="true"   field="name" labelpriorities="1,2,2,4,5,3,2,4"><TEXTSYMBOL font="Arial" fontstyle="regular" fontsize="10" fontcolor="168,58,0" interval="16" glowing="255,255,155" /></SIMPLELABELRENDERER>';
      customString += '<SIMPLERENDERER>';
      customString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI Cartography" character="222" fontcolor="140,80,0" fontsize="16" />';
      customString += '</SIMPLERENDERER>';
   }

   //  ---------------------------------------

   customString += '</GROUPRENDERER>';
   customString += '</LAYER>';

   endString += '<LAYER type="acetate" name="acetate" id="102">';
   endString += '<OBJECT units="database">';
   endString += '<POINT coords="' + customtheX + ' ' + customtheY + '">';
   endString += '<TRUETYPEMARKERSYMBOL  antialiasing="true"  font="ESRI Default Marker" character="97" fontcolor="38,115,0" fontstyle="bold" fontsize="24" />';
   endString += '</POINT>';
   endString += '</OBJECT>';
   endString += '</LAYER>';
   endString += '<LAYER type="acetate" name="acetate" id="103">';
   endString += '<OBJECT units="database">';
   endString += '<TEXT coords="' + customtheX + ' ' + customtheY + '" label="' + customAddressValue +'">';
   endString += '<TEXTMARKERSYMBOL  antialiasing="true" fontstyle="bold" fontsize="14" font="Arial" fontcolor="38,115,0" glowing="255,255,155" overlap="false" interval="8" />';
   endString += '</TEXT>';
   endString += '</OBJECT>';
   endString += '</LAYER>';

   if ( bRender )
   returnString = startString + customString + endString;
   else
   returnString = startString + endString;
   return  returnString;

}

function SetVisiblebyId(layerId,value) {

	var j = -1;
	for (var i=0;i<layerCount;i++) {
		if (LayerID[i]==layerId) j = i;
	}
	if (j>-1) {	 
			LayerVisible[j] = value;
			 
	}	
}