function writeXML(XMLType)
   {
   theRequest = '<?xml version="1.0" encoding="UTF-8"?>';
   switch (XMLType)
      {
      //SERVICE INFORMATION
      case 'service_info':
         theRequest += '<ARCXML version="1.1">';
         theRequest += '   <REQUEST>';
         theRequest += '      <GET_SERVICE_INFO dataframe="#DEFAULT#" envelope="false" />';
         theRequest += '   </REQUEST>';
         theRequest += '</ARCXML>';
         break;
      //MAP IMAGE
      case 'map_image':
         theRequest += '<ARCXML version="1.1">';
         theRequest += '   <REQUEST>';
         theRequest += '      <GET_IMAGE>';
         theRequest += '         <PROPERTIES>';
         theRequest += '            <ENVELOPE minx="' + minx + '" miny="' + miny + '" maxx="' + maxx + '" maxy="' + maxy + '" />';
         theRequest += '            <IMAGESIZE width="' + map_width + '" height="' + map_height + '" />';
         theRequest += '            <LEGEND autoextend="true" title="Legend" titlefontsize="14" />';
         theRequest += '         </PROPERTIES>';
         //IF THERE IS A SUBJECT TAX ID, SELECT THE PARCEL
         if (subj_tax_id)
            {
            theRequest += '      <LAYER id="selected_parcel" type="featureclass" name="Selected Parcel">';
            theRequest += '         <DATASET fromlayer="' + layer_id_parcels + '" />';
            theRequest += '         <SPATIALQUERY where="' + super_parcel_taxid + '=';
            //IF THE TAX ID FIELD OF SUPER PARCEL LAYER IS NUMERIC
            if (parcel_taxid_numeric)
               {
               theRequest += subj_tax_id + '" />';
               }
            //OTHERWISE, FIELD OF SUPER PARCEL LAYER IS TEXT
            else
               {
               theRequest += '&apos;' + subj_tax_id + '&apos;" />';
               }
            theRequest += '      </LAYER>';
            }
         //CARTOGRAPHIC ELEMENTS
         theRequest += '         <LAYER id="carto_elements" type="acetate">';
         theRequest += '            <OBJECT units="pixel">';
         theRequest += '               <SCALEBAR coords="22 22" fontsize="8" mapunits="' + map_units + '" scaleunits="' + map_units + '" screenlength="96" />';
         theRequest += '            </OBJECT>';
         theRequest += '            <OBJECT units="pixel">';
         theRequest += '               <NORTHARROW coords="36 46" type="4" />';
         theRequest += '            </OBJECT>';
         theRequest += '         </LAYER>';
         theRequest += '      </GET_IMAGE>';
         theRequest += '   </REQUEST>';
         theRequest += '</ARCXML>';
         break;
      //QUERY FOR PARCEL
      case 'parcel_query':
         theRequest += '<ARCXML version="1.1">';
         theRequest += '  <REQUEST>';
         theRequest += '    <GET_FEATURES geometry="false" globalenvelope="true" outputmode="newxml">';
         theRequest += '      <LAYER id="' + layer_id_parcels + '" />'
         theRequest += '      <SPATIALQUERY where="' + super_parcel_taxid + '=';
         //IF THE TAX ID FIELD OF SUPER PARCEL LAYER IS NUMERIC
         if (parcel_taxid_numeric)
            {
            theRequest += subj_tax_id + '" />';
            }
         //OTHERWISE, FIELD OF SUPER PARCEL LAYER IS TEXT
         else
            {
            theRequest += '&apos;' + subj_tax_id + '&apos;" />';
            }
         theRequest += '    </GET_FEATURES>';
         theRequest += '  </REQUEST>';
         theRequest += '</ARCXML>';
         break;
      //QUERY FOR ADDRESS
      case 'addr_query':
         theRequest += '<ARCXML version="1.1">';
         theRequest += '   <REQUEST>';
         theRequest += '      <GET_FEATURES geometry="false" outputmode="newxml">';
         theRequest += '         <LAYER id="' + layer_id_points + '" />';
         theRequest += '         <SPATIALQUERY where="' + addr_points_street + ' LIKE &apos;' + the_street.substring(0,5) + '%&apos; AND ' + addr_points_house + ' &gt;= ' + the_house_low + ' AND ' + addr_points_house + ' &lt;= ' + the_house_high + '" />';
         theRequest += '      </GET_FEATURES>';
         theRequest += '   </REQUEST>';
         theRequest += '</ARCXML>';
         break;
      //QUERY PARCELS WITH CLICKED LOCATION
      case 'parcel_click':
         theRequest += '<ARCXML version="1.1">';
         theRequest += '  <REQUEST>';
         theRequest += '    <GET_FEATURES envelope="true" geometry="false" outputmode="newxml">';
         theRequest += '      <LAYER id="' + layer_id_parcels + '" />';
         theRequest += '      <SPATIALQUERY>';
         theRequest += '        <SPATIALFILTER relation="area_intersection">';
         theRequest += '          <ENVELOPE minx="' + (map_x - 1) + '" miny="' + (map_y - 1) + '" maxx="' + (map_x + 1) + '" maxy="' + (map_y + 1) + '" />';
         theRequest += '        </SPATIALFILTER>';
         theRequest += '      </SPATIALQUERY>';
         theRequest += '    </GET_FEATURES>';
         theRequest += '  </REQUEST>';
         theRequest += '</ARCXML>';
         break;
      default:
         alert('Application Error:  ArcXML type ' + XMLType + ' not found in function writeXML().');
         theRequest = '';
         break;
      }
   return theRequest;
   }