

// JavaScript Document
//<![CDATA[
if (GBrowserIsCompatible())
{
  // this variable will collect the html which will be placed in the list_display
  var sideBarCollections = [];
    
  // arrays to hold copies of the markers and html used by the list_display
  // because the function closure trick doesnt work there
  var gmarkers = [];
  var htmls = [];
  var renderMarkers = [];
	var directions = [];
  var i = 0;

  // --- array of icons
  var icons = [];	
	var Icon_81 = new GIcon();
Icon_81.image = "http://www.ema2.net/Imaps/icons/corp.png";
icons[0] = Icon_81;

var Icon_89 = new GIcon();
Icon_89.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[1] = Icon_89;

var Icon_62 = new GIcon();
Icon_62.image = "http://www.ema2.net/Imaps/icons/airport.png";
icons[2] = Icon_62;

var Icon_132 = new GIcon();
Icon_132.image = "http://www.ema2.net/Imaps/icons/services.png";
icons[3] = Icon_132;

var Icon_92 = new GIcon();
Icon_92.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[4] = Icon_92;

var Icon_122 = new GIcon();
Icon_122.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[5] = Icon_122;

var Icon_157 = new GIcon();
Icon_157.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[6] = Icon_157;

var Icon_112 = new GIcon();
Icon_112.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[7] = Icon_112;

var Icon_119 = new GIcon();
Icon_119.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[8] = Icon_119;

var Icon_107 = new GIcon();
Icon_107.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[9] = Icon_107;

var Icon_143 = new GIcon();
Icon_143.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[10] = Icon_143;

var Icon_145 = new GIcon();
Icon_145.image = "http://www.ema2.net/Imaps/icons/shop.png";
icons[11] = Icon_145;

var Icon_116 = new GIcon();
Icon_116.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[12] = Icon_116;

var Icon_146 = new GIcon();
Icon_146.image = "http://www.ema2.net/Imaps/icons/theatre.png";
icons[13] = Icon_146;

var Icon_150 = new GIcon();
Icon_150.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[14] = Icon_150;

var Icon_149 = new GIcon();
Icon_149.image = "http://www.ema2.net/Imaps/icons/services.png";
icons[15] = Icon_149;

var Icon_114 = new GIcon();
Icon_114.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[16] = Icon_114;

var Icon_118 = new GIcon();
Icon_118.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[17] = Icon_118;

var Icon_134 = new GIcon();
Icon_134.image = "http://www.ema2.net/Imaps/icons/services.png";
icons[18] = Icon_134;

var Icon_94 = new GIcon();
Icon_94.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[19] = Icon_94;

var Icon_142 = new GIcon();
Icon_142.image = "http://www.ema2.net/Imaps/icons/corp.png";
icons[20] = Icon_142;

var Icon_108 = new GIcon();
Icon_108.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[21] = Icon_108;

var Icon_63 = new GIcon();
Icon_63.image = "http://www.ema2.net/Imaps/icons/colleges.png";
icons[22] = Icon_63;

var Icon_120 = new GIcon();
Icon_120.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[23] = Icon_120;

var Icon_64 = new GIcon();
Icon_64.image = "http://www.ema2.net/Imaps/icons/convention_center.png";
icons[24] = Icon_64;

var Icon_65 = new GIcon();
Icon_65.image = "http://www.ema2.net/Imaps/icons/corp.png";
icons[25] = Icon_65;

var Icon_115 = new GIcon();
Icon_115.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[26] = Icon_115;

var Icon_113 = new GIcon();
Icon_113.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[27] = Icon_113;

var Icon_95 = new GIcon();
Icon_95.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[28] = Icon_95;

var Icon_144 = new GIcon();
Icon_144.image = "http://www.ema2.net/Imaps/icons/shop.png";
icons[29] = Icon_144;

var Icon_155 = new GIcon();
Icon_155.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[30] = Icon_155;

var Icon_135 = new GIcon();
Icon_135.image = "http://www.ema2.net/Imaps/icons/services.png";
icons[31] = Icon_135;

var Icon_66 = new GIcon();
Icon_66.image = "http://www.ema2.net/Imaps/icons/entertainment.png";
icons[32] = Icon_66;

var Icon_90 = new GIcon();
Icon_90.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[33] = Icon_90;

var Icon_104 = new GIcon();
Icon_104.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[34] = Icon_104;

var Icon_158 = new GIcon();
Icon_158.image = "http://www.ema2.net/Imaps/icons/recreation.png";
icons[35] = Icon_158;

var Icon_129 = new GIcon();
Icon_129.image = "http://www.ema2.net/Imaps/icons/services.png";
icons[36] = Icon_129;

var Icon_136 = new GIcon();
Icon_136.image = "http://www.ema2.net/Imaps/icons/services.png";
icons[37] = Icon_136;

var Icon_96 = new GIcon();
Icon_96.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[38] = Icon_96;

var Icon_152 = new GIcon();
Icon_152.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[39] = Icon_152;

var Icon_67 = new GIcon();
Icon_67.image = "http://www.ema2.net/Imaps/icons/golf.png";
icons[40] = Icon_67;

var Icon_97 = new GIcon();
Icon_97.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[41] = Icon_97;

var Icon_151 = new GIcon();
Icon_151.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[42] = Icon_151;

var Icon_68 = new GIcon();
Icon_68.image = "http://www.ema2.net/Imaps/icons/hospital.png";
icons[43] = Icon_68;

var Icon_69 = new GIcon();
Icon_69.image = "http://www.ema2.net/Imaps/icons/building.png";
icons[44] = Icon_69;

var Icon_88 = new GIcon();
Icon_88.image = "http://www.ema2.net/Imaps/icons/building.png";
icons[45] = Icon_88;

var Icon_123 = new GIcon();
Icon_123.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[46] = Icon_123;

var Icon_111 = new GIcon();
Icon_111.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[47] = Icon_111;

var Icon_110 = new GIcon();
Icon_110.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[48] = Icon_110;

var Icon_154 = new GIcon();
Icon_154.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[49] = Icon_154;

var Icon_93 = new GIcon();
Icon_93.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[50] = Icon_93;

var Icon_100 = new GIcon();
Icon_100.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[51] = Icon_100;

var Icon_125 = new GIcon();
Icon_125.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[52] = Icon_125;

var Icon_82 = new GIcon();
Icon_82.image = "http://www.ema2.net/Imaps/icons/parks_locreg.png";
icons[53] = Icon_82;

var Icon_124 = new GIcon();
Icon_124.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[54] = Icon_124;

var Icon_99 = new GIcon();
Icon_99.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[55] = Icon_99;

var Icon_102 = new GIcon();
Icon_102.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[56] = Icon_102;

var Icon_121 = new GIcon();
Icon_121.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[57] = Icon_121;

var Icon_71 = new GIcon();
Icon_71.image = "http://www.ema2.net/Imaps/icons/museum.png";
icons[58] = Icon_71;

var Icon_156 = new GIcon();
Icon_156.image = "http://www.ema2.net/Imaps/icons/services.png";
icons[59] = Icon_156;

var Icon_72 = new GIcon();
Icon_72.image = "http://www.ema2.net/Imaps/icons/nightlife.png";
icons[60] = Icon_72;

var Icon_73 = new GIcon();
Icon_73.image = "http://www.ema2.net/Imaps/icons/";
icons[61] = Icon_73;

var Icon_147 = new GIcon();
Icon_147.image = "http://www.ema2.net/Imaps/icons/theatre.png";
icons[62] = Icon_147;

var Icon_131 = new GIcon();
Icon_131.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[63] = Icon_131;

var Icon_137 = new GIcon();
Icon_137.image = "http://www.ema2.net/Imaps/icons/services.png";
icons[64] = Icon_137;

var Icon_106 = new GIcon();
Icon_106.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[65] = Icon_106;

var Icon_74 = new GIcon();
Icon_74.image = "http://www.ema2.net/Imaps/icons/POI.png";
icons[66] = Icon_74;

var Icon_133 = new GIcon();
Icon_133.image = "http://www.ema2.net/Imaps/icons/services.png";
icons[67] = Icon_133;

var Icon_75 = new GIcon();
Icon_75.image = "http://www.ema2.net/Imaps/icons/recreation.png";
icons[68] = Icon_75;

var Icon_76 = new GIcon();
Icon_76.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[69] = Icon_76;

var Icon_130 = new GIcon();
Icon_130.image = "http://www.ema2.net/Imaps/icons/services.png";
icons[70] = Icon_130;

var Icon_109 = new GIcon();
Icon_109.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[71] = Icon_109;

var Icon_70 = new GIcon();
Icon_70.image = "http://www.ema2.net/Imaps/icons/services.png";
icons[72] = Icon_70;

var Icon_138 = new GIcon();
Icon_138.image = "http://www.ema2.net/Imaps/icons/services.png";
icons[73] = Icon_138;

var Icon_159 = new GIcon();
Icon_159.image = "http://www.ema2.net/Imaps/icons/shop.png";
icons[74] = Icon_159;

var Icon_77 = new GIcon();
Icon_77.image = "http://www.ema2.net/Imaps/icons/shop.png";
icons[75] = Icon_77;

var Icon_101 = new GIcon();
Icon_101.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[76] = Icon_101;

var Icon_139 = new GIcon();
Icon_139.image = "http://www.ema2.net/Imaps/icons/services.png";
icons[77] = Icon_139;

var Icon_117 = new GIcon();
Icon_117.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[78] = Icon_117;

var Icon_83 = new GIcon();
Icon_83.image = "http://www.ema2.net/Imaps/icons/parks_state.png";
icons[79] = Icon_83;

var Icon_91 = new GIcon();
Icon_91.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[80] = Icon_91;

var Icon_103 = new GIcon();
Icon_103.image = "http://www.ema2.net/Imaps/icons/restaurant.png";
icons[81] = Icon_103;

var Icon_78 = new GIcon();
Icon_78.image = "http://www.ema2.net/Imaps/icons/theatre.png";
icons[82] = Icon_78;

var Icon_79 = new GIcon();
Icon_79.image = "http://www.ema2.net/Imaps/icons/theme_park.png";
icons[83] = Icon_79;

var Icon_140 = new GIcon();
Icon_140.image = "http://www.ema2.net/Imaps/icons/services.png";
icons[84] = Icon_140;

var Icon_148 = new GIcon();
Icon_148.image = "http://www.ema2.net/Imaps/icons/theme_park.png";
icons[85] = Icon_148;

var Icon_141 = new GIcon();
Icon_141.image = "http://www.ema2.net/Imaps/icons/nightlife.png";
icons[86] = Icon_141;

var Icon_153 = new GIcon();
Icon_153.image = "http://www.ema2.net/Imaps/icons/entertainment.png";
icons[87] = Icon_153;

var Icon_80 = new GIcon();
Icon_80.image = "http://www.ema2.net/Imaps/icons/worship.png";
icons[88] = Icon_80;


	// --- End array of icons

	
  // This function picks up the click from the text list and opens the corresponding info window
  function myclick(i) {
		
		//if(i.indexOf("i0_") < 0) {
			gmarkers[i].setImage("http://www.ema2.net/Imaps/icons/star.png");		
			map.panTo(gmarkers[i].getLatLng());
		//} else {
      
			    
			gmarkers[i].openInfoWindowHtml(htmls[i]);
      
		//}
  }
  function myclick_close(i) {
		gmarkers[i].setImage(gmarkers[i].getIcon().image);
		gmarkers[i].closeInfoWindow();
  }
		
	function show(st, markeri, i, dirlat, dirlong)
	{		
		var style = document.getElementById("d"+st).style;
		style.display = "block";
		style.backgroundColor='#FFFFFF';
		style.border = '1px solid #666666';
		style.width='300px';
	
		// Direction
		directions[i] = new GDirections(map, document.getElementById("dp"+st));	
		directions[i].load(markeri);

		// Streetview
		var myPano;
		var dirlatlong = new GLatLng(dirlat, dirlong);
		panoramaOptions = { latlng:dirlatlong };
		myPano = new GStreetviewPanorama(document.getElementById("s"+st), panoramaOptions);
			
	}
	function hide(st, i)
	{
		var style = document.getElementById("d"+st).style;
		style.display = "none";
		
		directions[i].clear();
	}

			
	// (5)
	// --- createMarker for the location
	// A function to create the marker and set up the event window
  // the icon information is passed to this function
  // "name" = ' is already converted to \'
  // "nName" = \' is reverted back to '
  function createMarker(point, name, html, icontype, itm) {
		
		var useIcon = new GIcon(icons[icontype]);
		
		// useIcon.shadow = "http://www.ema2.net/Imaps/icons/building_s.png";
		// useIcon.shadowSize = new GSize(56, 32);
		// useIcon.infoShadowAnchor = new GPoint(0, 0);
		useIcon.iconSize = new GSize(32, 32);
		useIcon.iconAnchor = new GPoint(16, 32);
		useIcon.infoWindowAnchor = new GPoint(16, 0);
		// useIcon.transparent = "http://www.ema2.net/Imaps/icons/markerTransparent.png";

		// Set up our GMarkerOptions object
    markerOptions = { icon:useIcon };
		var marker = new GMarker(point, useIcon);

		// --- ?? not sure what is is for
		// var locName; 
		// var nName = name.replace('\\','');
		// --- ?? not sure what is is for
		
		// If click on map, open info window
	  GEvent.addListener(marker, "click", function() {
			if(setupVals["MapControl"] == "sml") {
				window.open('map-lg.asp?t='+setupVals["typeOfPoints"],'map','menubar=0;scrollbars=1;toolbar=0;');
			}
			else { 
				marker.openInfoWindowHtml(html);
			}
		});

	 	//GEvent.addListener(marker, "mouseover", function() {
		//	marker.setImage("http://www.ema2.net/Imaps/icons/airport_s.png");
		//});

	  //GEvent.addListener(marker, "mouseout", function() {
		//	marker.setImage(marker.getIcon().image);
		//});

		// store the maker and html
		gmarkers[itm] = marker;
		htmls[itm] = html;

		return marker;
	}
	// --- End createMarker for the location
	
	
	
	
	// --- recursively draw icons to the map and locations to list
	function addMap(startpt) {
		var endpt;
		var progress;
		
		endpt = startpt + 1;
		
		//alert('startpt: ' + startpt + '; endpt: ' + endpt + '> renderMarkers.length:' + renderMarkers.length);
		   
		if (endpt > renderMarkers.length)
			endpt = renderMarkers.length 
	
		if (document.getElementById("prg"))
			document.getElementById("prg").style.display = "";	

		// If no list
		if (renderMarkers[startpt] != undefined)
    { 
      // Draw 1 marker
      map.addOverlay(renderMarkers[startpt]);
        
      if (document.getElementById("list_display"))
      {	
        
         
          
        // Draw load bar
        if (document.getElementById("prg"))
        {
          progress = Math.ceil((startpt/renderMarkers.length)*100) + "%";
          document.getElementById("prg").innerHTML = progress;
          document.getElementById("prg").style.width = progress;
        }
      }
            
      //Draw one icon and list one location
      //for (var i=startpt; i<endpt; i++)
      //{			
      	//map.addOverlay(renderMarkers[i]);
          
      	//if (document.getElementById("list_display"))
      	//{					
      		//document.getElementById("list_display").innerHTML += sideBarCollections[i];
          
          // Draw load bar
      		//if(document.getElementById("prg"))
      		//{
      			//progress = Math.ceil((i/renderMarkers.length)*100) + "%";
      			//document.getElementById("prg").innerHTML = progress;
      			//document.getElementById("prg").style.width = progress;
      		//}
      	//}
      //}
    
      // if not a small map, open html box of first marker
      // if (setupVals["MapControl"] != "sml" && startpt == 0)
      // myclick('i0_1');
    
      if (endpt < renderMarkers.length) {
        setTimeout(function() {addMap(endpt);},300);
      }
      else {
        if (document.getElementById("prg")) {
          document.getElementById("prg").style.display = "none";
        }
      }	
    }
    else	
    {
    	if (document.getElementById("prg")) {
      	document.getElementById("prg").style.display = "none";
      }    
    }
    // End If no list
  }
	// --- End recursively draw icons to the map and locations to list
	
	
	
	
	
	
  // --- create the map with default setup
  var map = new GMap2(document.getElementById("map_display"));

  if (setupVals["MapControl"] == "sml") {
		map.addControl(new GSmallMapControl());	
  }
	else {
		//map.addControl(new GLargeMapControl());
		//map.addControl(new GMapTypeControl());
		
		//var customUI = map.getDefaultUI();
		//customUI.controls.scalecontrol = true;
		//map.setUI(customUI);
		
		//------ custom
		// We define the function first
		function TextualZoomControl() {	}
		
		// To "subclass" the GControl, we set the prototype object to
		// an instance of the GControl object
		TextualZoomControl.prototype = new GControl();
		
		// Creates a one DIV for each of the buttons and places them in a container
		// DIV which is returned as our control element. We add the control to
		// to the map container and return the element for the map class to
		// position properly.
		TextualZoomControl.prototype.initialize = function(map) {
			var container = document.createElement("div");
			this.setButtonBgStyle_(container);
				
			var zoomInDiv = document.createElement("div");
			this.setButtonStyle_(zoomInDiv);
			container.appendChild(zoomInDiv);					
			//zoomInDiv.appendChild(document.createTextNode("Zoom In"));				
			var zoomInBut = document.createElement('div');
			zoomInBut.innerHTML = '<img src="http://www.ema2.net/Imaps/images-skin/75.png">';		
			zoomInDiv.appendChild(zoomInBut);
			GEvent.addDomListener(zoomInDiv, "click", function() {
				map.zoomIn();
			});
					
			var zoomDiv20 = document.createElement("div");
			this.setButtonStyle20_(zoomDiv20);
			container.appendChild(zoomDiv20);	
			var zoomBut20 = document.createElement('div');
			zoomBut20.innerHTML = '<img src="http://www.ema2.net/Imaps/images-skin/markerTransparent.png" width="1" height="1">';		
			zoomDiv20.appendChild(zoomBut20);		
			GEvent.addDomListener(zoomDiv20, "click", function() {
				map.setZoom(20);
			});

			var zoomDiv18 = document.createElement("div");
			this.setButtonStyle18_(zoomDiv18);
			container.appendChild(zoomDiv18);	
			var zoomBut18 = document.createElement('div');
			zoomBut18.innerHTML = '<img src="http://www.ema2.net/Imaps/images-skin/markerTransparent.png" width="1" height="1">';		
			zoomDiv18.appendChild(zoomBut18);	
			GEvent.addDomListener(zoomDiv18, "click", function() {
				map.setZoom(18);
			});
			
			var zoomDiv16 = document.createElement("div");
			this.setButtonStyle16_(zoomDiv16);
			container.appendChild(zoomDiv16);		
			var zoomBut16 = document.createElement('div');
			zoomBut16.innerHTML = '<img src="http://www.ema2.net/Imaps/images-skin/markerTransparent.png" width="1" height="1">';		
			zoomDiv16.appendChild(zoomBut16);
			GEvent.addDomListener(zoomDiv16, "click", function() {
				map.setZoom(16);
			});

			var zoomDiv14 = document.createElement("div");
			this.setButtonStyle14_(zoomDiv14);
			container.appendChild(zoomDiv14);			
			var zoomBut14 = document.createElement('div');
			zoomBut14.innerHTML = '<img src="http://www.ema2.net/Imaps/images-skin/markerTransparent.png" width="1" height="1">';		
			zoomDiv14.appendChild(zoomBut14);		
			GEvent.addDomListener(zoomDiv14, "click", function() {
				map.setZoom(14);
			});

			var zoomDiv13 = document.createElement("div");
			this.setButtonStyle13_(zoomDiv13);
			container.appendChild(zoomDiv13);		
			var zoomBut13 = document.createElement('div');
			zoomBut13.innerHTML = '<img src="http://www.ema2.net/Imaps/images-skin/markerTransparent.png" width="1" height="1">';		
			zoomDiv13.appendChild(zoomBut13);		
			GEvent.addDomListener(zoomDiv13, "click", function() {
				map.setZoom(13);
			});

			var zoomDiv12 = document.createElement("div");
			this.setButtonStyle12_(zoomDiv12);
			container.appendChild(zoomDiv12);
			var zoomBut12 = document.createElement('div');
			zoomBut12.innerHTML = '<img src="http://www.ema2.net/Imaps/images-skin/markerTransparent.png" width="1" height="1">';		
			zoomDiv12.appendChild(zoomBut12);
			GEvent.addDomListener(zoomDiv12, "click", function() {
				map.setZoom(12);
			});

			var zoomOutDiv = document.createElement("div");
			this.setButtonStyle_(zoomOutDiv);
			container.appendChild(zoomOutDiv);
			var zoomOutBut = document.createElement('div');
			zoomOutBut.innerHTML = '<img src="http://www.ema2.net/Imaps/images-skin/76.png">';		
			zoomOutDiv.appendChild(zoomOutBut);			
			GEvent.addDomListener(zoomOutDiv, "click", function() {
				map.zoomOut();
			});
				
			map.getContainer().appendChild(container);
			return container;
		}
				

		// By default, the control will appear in the top left corner of the
		// map with 7 pixels of padding.
		TextualZoomControl.prototype.getDefaultPosition = function() {
			return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 7));
		}
		
		// Sets the proper CSS for the background div element.
		TextualZoomControl.prototype.setButtonBgStyle_ = function(buttonBg) {
			buttonBg.style.width = "24px";			
			buttonBg.style.backgroundColor = "#FFFFFF";
			buttonBg.style.border = "1px solid #666666";
      buttonBg.style.font = "small Arial";
      
      buttonBg.style.paddingTop = "4px";
      buttonBg.style.paddingBottom = "4px";
			buttonBg.style.margin = "0px";		
			     
      //buttonBg.style.backgroundImage = "url(http://www.ema2.net/Imaps/images-skin/zoomout.png)";
			//buttonBg.style.textDecoration = "underline";
			//buttonBg.style.color = "#0000cc";
			//buttonBg.style.textAlign = "center";
			//buttonBg.style.cursor = "pointer";		
		}		
		
		// Sets the proper CSS for the zoom button element.
		TextualZoomControl.prototype.setButtonStyle_ = function(button) {	
      button.style.padding = "0px";
			button.style.marginTop = "4px";
      button.style.marginLeft = "5px";
      
			button.style.cursor = "pointer";
		}
		
		// Sets the proper CSS for the given button element.
		TextualZoomControl.prototype.setButtonStyle20_ = function(button) {
			button.style.backgroundColor = "#77C4F4";
			button.style.border = "1px solid #828282";
      
			button.style.padding = "0px";
			button.style.marginTop = "2px";     
			button.style.marginLeft = "6px";
      
			button.style.width = "10px";
			button.style.height = "4px";
			button.style.cursor = "pointer";
		}
		
		// Sets the proper CSS for the given button element.
		TextualZoomControl.prototype.setButtonStyle18_ = function(button) {
			button.style.backgroundColor = "#8EC3E2";
			button.style.border = "1px solid #828282";
      
			button.style.padding = "0px";
			button.style.marginTop = "3px";
			button.style.marginLeft = "6px";
      
			button.style.width = "10px";
			button.style.height = "4px";
			button.style.cursor = "pointer";
		}
		
		// Sets the proper CSS for the given button element.
		TextualZoomControl.prototype.setButtonStyle16_ = function(button) {
			button.style.backgroundColor = "#B2C1C5";
			button.style.border = "1px solid #828282";
      
			button.style.padding = "0px";
			button.style.marginTop = "3px";
			button.style.marginLeft = "6px";
      
			button.style.width = "10px";
			button.style.height = "4px";
			button.style.cursor = "pointer";
		}		

		// Sets the proper CSS for the given button element.
		TextualZoomControl.prototype.setButtonStyle14_ = function(button) {
			button.style.backgroundColor = "#CDC0B0";
			button.style.border = "1px solid #828282";
      
			button.style.padding = "0px";
			button.style.marginTop = "3px";
			button.style.marginLeft = "6px";
      
			button.style.width = "10px";
			button.style.height = "4px";
			button.style.cursor = "pointer";
		}

		// Sets the proper CSS for the given button element.
		TextualZoomControl.prototype.setButtonStyle13_ = function(button) {
			button.style.backgroundColor = "#E2BE9E";
			button.style.border = "1px solid #828282";
      
			button.style.padding = "0px";
			button.style.marginTop = "3px";
			button.style.marginLeft = "6px";
      
			button.style.width = "10px";
			button.style.height = "4px";
			button.style.cursor = "pointer";
		}
		
		// Sets the proper CSS for the given button element.
		TextualZoomControl.prototype.setButtonStyle12_ = function(button) {
			button.style.backgroundColor = "#FFBD88";
			button.style.border = "1px solid #828282";
      
			button.style.padding = "0px";
			button.style.marginTop = "3px";
			button.style.marginLeft = "6px";
      
			button.style.width = "10px";
			button.style.height = "4px";
			button.style.cursor = "pointer";
		}
				
		map.addControl(new TextualZoomControl());
		//------ /custom

  }
	 
  map.setCenter(new GLatLng( setupVals["Latitude"],setupVals["Longitude"]), setupVals["Zoom"]);
	// --- End create the map with default setup	
	
	
	// --- Read the data from xml & process it
  // Read the data from xml
  var request = GXmlHttp.create();
  request.open("GET", setupVals["qString"], true);
	
	
	// --- process on onreadystatechange function() for xml file
  request.onreadystatechange = function() {
		if (request.readyState == 4)
		{
			var xmlDoc = request.responseXML;
				
			// obtain the array of markers from xml file and loop through it
			var markers = xmlDoc.documentElement.getElementsByTagName("marker");
			
			for (var i=0; i<markers.length; i++)
			{
				
				// obtain the attribues of each marker from the xml file
				var lat = parseFloat(markers[i].getAttribute("lat"));
				var lng = parseFloat(markers[i].getAttribute("lng"));
				var point = new GLatLng(lat,lng);
				var html = GXml.value(markers[i].getElementsByTagName("infowindow")[0]);
				var label = markers[i].getAttribute("label");
				var ltype = markers[i].getAttribute("ltype");
				var itm = markers[i].getAttribute("itm");
				var dist = markers[i].getAttribute("dist");				
				var infolist = GXml.value(markers[i].getElementsByTagName("infolist")[0]);
				var infodir = GXml.value(markers[i].getElementsByTagName("infodir")[0]).replace(/\'/g, "\\'");			
				if (ltype == "81")
var marker = createMarker(point, label, html, 0, itm);

if (ltype == "89")
var marker = createMarker(point, label, html, 1, itm);

if (ltype == "62")
var marker = createMarker(point, label, html, 2, itm);

if (ltype == "132")
var marker = createMarker(point, label, html, 3, itm);

if (ltype == "92")
var marker = createMarker(point, label, html, 4, itm);

if (ltype == "122")
var marker = createMarker(point, label, html, 5, itm);

if (ltype == "157")
var marker = createMarker(point, label, html, 6, itm);

if (ltype == "112")
var marker = createMarker(point, label, html, 7, itm);

if (ltype == "119")
var marker = createMarker(point, label, html, 8, itm);

if (ltype == "107")
var marker = createMarker(point, label, html, 9, itm);

if (ltype == "143")
var marker = createMarker(point, label, html, 10, itm);

if (ltype == "145")
var marker = createMarker(point, label, html, 11, itm);

if (ltype == "116")
var marker = createMarker(point, label, html, 12, itm);

if (ltype == "146")
var marker = createMarker(point, label, html, 13, itm);

if (ltype == "150")
var marker = createMarker(point, label, html, 14, itm);

if (ltype == "149")
var marker = createMarker(point, label, html, 15, itm);

if (ltype == "114")
var marker = createMarker(point, label, html, 16, itm);

if (ltype == "118")
var marker = createMarker(point, label, html, 17, itm);

if (ltype == "134")
var marker = createMarker(point, label, html, 18, itm);

if (ltype == "94")
var marker = createMarker(point, label, html, 19, itm);

if (ltype == "142")
var marker = createMarker(point, label, html, 20, itm);

if (ltype == "108")
var marker = createMarker(point, label, html, 21, itm);

if (ltype == "63")
var marker = createMarker(point, label, html, 22, itm);

if (ltype == "120")
var marker = createMarker(point, label, html, 23, itm);

if (ltype == "64")
var marker = createMarker(point, label, html, 24, itm);

if (ltype == "65")
var marker = createMarker(point, label, html, 25, itm);

if (ltype == "115")
var marker = createMarker(point, label, html, 26, itm);

if (ltype == "113")
var marker = createMarker(point, label, html, 27, itm);

if (ltype == "95")
var marker = createMarker(point, label, html, 28, itm);

if (ltype == "144")
var marker = createMarker(point, label, html, 29, itm);

if (ltype == "155")
var marker = createMarker(point, label, html, 30, itm);

if (ltype == "135")
var marker = createMarker(point, label, html, 31, itm);

if (ltype == "66")
var marker = createMarker(point, label, html, 32, itm);

if (ltype == "90")
var marker = createMarker(point, label, html, 33, itm);

if (ltype == "104")
var marker = createMarker(point, label, html, 34, itm);

if (ltype == "158")
var marker = createMarker(point, label, html, 35, itm);

if (ltype == "129")
var marker = createMarker(point, label, html, 36, itm);

if (ltype == "136")
var marker = createMarker(point, label, html, 37, itm);

if (ltype == "96")
var marker = createMarker(point, label, html, 38, itm);

if (ltype == "152")
var marker = createMarker(point, label, html, 39, itm);

if (ltype == "67")
var marker = createMarker(point, label, html, 40, itm);

if (ltype == "97")
var marker = createMarker(point, label, html, 41, itm);

if (ltype == "151")
var marker = createMarker(point, label, html, 42, itm);

if (ltype == "68")
var marker = createMarker(point, label, html, 43, itm);

if (ltype == "69")
var marker = createMarker(point, label, html, 44, itm);

if (ltype == "88")
var marker = createMarker(point, label, html, 45, itm);

if (ltype == "123")
var marker = createMarker(point, label, html, 46, itm);

if (ltype == "111")
var marker = createMarker(point, label, html, 47, itm);

if (ltype == "110")
var marker = createMarker(point, label, html, 48, itm);

if (ltype == "154")
var marker = createMarker(point, label, html, 49, itm);

if (ltype == "93")
var marker = createMarker(point, label, html, 50, itm);

if (ltype == "100")
var marker = createMarker(point, label, html, 51, itm);

if (ltype == "125")
var marker = createMarker(point, label, html, 52, itm);

if (ltype == "82")
var marker = createMarker(point, label, html, 53, itm);

if (ltype == "124")
var marker = createMarker(point, label, html, 54, itm);

if (ltype == "99")
var marker = createMarker(point, label, html, 55, itm);

if (ltype == "102")
var marker = createMarker(point, label, html, 56, itm);

if (ltype == "121")
var marker = createMarker(point, label, html, 57, itm);

if (ltype == "71")
var marker = createMarker(point, label, html, 58, itm);

if (ltype == "156")
var marker = createMarker(point, label, html, 59, itm);

if (ltype == "72")
var marker = createMarker(point, label, html, 60, itm);

if (ltype == "73")
var marker = createMarker(point, label, html, 61, itm);

if (ltype == "147")
var marker = createMarker(point, label, html, 62, itm);

if (ltype == "131")
var marker = createMarker(point, label, html, 63, itm);

if (ltype == "137")
var marker = createMarker(point, label, html, 64, itm);

if (ltype == "106")
var marker = createMarker(point, label, html, 65, itm);

if (ltype == "74")
var marker = createMarker(point, label, html, 66, itm);

if (ltype == "133")
var marker = createMarker(point, label, html, 67, itm);

if (ltype == "75")
var marker = createMarker(point, label, html, 68, itm);

if (ltype == "76")
var marker = createMarker(point, label, html, 69, itm);

if (ltype == "130")
var marker = createMarker(point, label, html, 70, itm);

if (ltype == "109")
var marker = createMarker(point, label, html, 71, itm);

if (ltype == "70")
var marker = createMarker(point, label, html, 72, itm);

if (ltype == "138")
var marker = createMarker(point, label, html, 73, itm);

if (ltype == "159")
var marker = createMarker(point, label, html, 74, itm);

if (ltype == "77")
var marker = createMarker(point, label, html, 75, itm);

if (ltype == "101")
var marker = createMarker(point, label, html, 76, itm);

if (ltype == "139")
var marker = createMarker(point, label, html, 77, itm);

if (ltype == "117")
var marker = createMarker(point, label, html, 78, itm);

if (ltype == "83")
var marker = createMarker(point, label, html, 79, itm);

if (ltype == "91")
var marker = createMarker(point, label, html, 80, itm);

if (ltype == "103")
var marker = createMarker(point, label, html, 81, itm);

if (ltype == "78")
var marker = createMarker(point, label, html, 82, itm);

if (ltype == "79")
var marker = createMarker(point, label, html, 83, itm);

if (ltype == "140")
var marker = createMarker(point, label, html, 84, itm);

if (ltype == "148")
var marker = createMarker(point, label, html, 85, itm);

if (ltype == "141")
var marker = createMarker(point, label, html, 86, itm);

if (ltype == "153")
var marker = createMarker(point, label, html, 87, itm);

if (ltype == "80")
var marker = createMarker(point, label, html, 88, itm);

				
	
				// map.addOverlay(marker);
	
				
				// store info for use
				if (ltype != "None")
				{
					var dis_str;
					if (dist == 0) { dis_str = ''; } else { dis_str = ' (' + dist + 'mi)'; }				
					
					renderMarkers[i] = marker;
					sideBarCollections[i] = '<div id="'+ itm +'" onmouseover="sbar(\'' + itm + '\'); myclick(\'' + itm + '\');" onmouseout="cbar(\'' + itm + '\'); myclick_close(\'' + itm + '\');" style="padding:8px 3px 8px 3px; font-size:12px; font-family:Arial;">'
																		+ '<span id="t'+ itm +'" style="font-weight:bold;">' + label.replace('\\','') + '<span style="font-weight:normal;">' + dis_str + '</span></span>' 
																		+ infolist
																					
					sideBarCollections[i] = sideBarCollections[i]															
																		+ '<div style="padding:5px 0px 0px 0px;">'
                                    	+ '<a href="http://www.ema2.net/imaps/cal-event.asp?cID=' + itm + '" title="Add Location to my Calendar"><img src="http://www.ema2.net/Imaps/images-skin/cal.png" border="0" style="padding-right:5px;"></a>'
                                    
					if (infodir.length > 0) {												
					sideBarCollections[i] = sideBarCollections[i]
																			+ '<a href="javascript:show(\'' + itm + '\', \'' + infodir + '\', \'' + i + '\', ' + lat + ', ' + lng + ');" title="Get Driving Directions"><img src="http://www.ema2.net/Imaps/images-skin/drive.png" border="0" style="padding-right:5px;"></a>'
					}
                                    
          sideBarCollections[i] = sideBarCollections[i]                 
                                    + '</div>'
          												+ '</div>'
                                  
          if (infodir.length > 0) {												
					sideBarCollections[i] = sideBarCollections[i]
                                      + '<div id="d'+ itm +'" style="position:absolute; display:none; padding:0px 3px 3px 3px; font-size:12px; font-family:Arial;">'
                                        + '<span style="float:right; padding-top:6px">'
                                          + '<a href="javascript:PrintContent(\'' + itm + '\');" style="padding:0px 0px 10px 4px;" title="Print Direction"><img src="http://www.ema2.net/Imaps/images-skin/printer-micro-icon.png" border="0"></a>'
                                          + '<a href="javascript:hide(\'' + itm + '\', \'' + i + '\');" style="padding:0px 0px 10px 4px;" title="Close Window"><img src="http://www.ema2.net/Imaps/images-skin/icon-cross-16.png" border="0"></a>'
                                        + '</span>'
                                        + '<br><br><br><div id="s'+ itm +'" style="width:300px;"></div><div id="dp'+ itm +'" style="width:290px;"></div>'
                                      + '</div>'                                    
           } 
           
           sideBarCollections[i] = sideBarCollections[i]                                  
																	+ '<div style="clear:both"></div><hr>';																	
				}
			} // End for loop
			
			
			// put the first location (client) html contents into the list_display div
			if (document.getElementById("list_display"))
			{
      	
				if (ltype == "None"){
        	//Coming Soon
					//document.getElementById("list_display").innerHTML += "<div style=\"color:#990000; font-style:italic; font-weight:bold; margin-top:15px; border-bottom:1px #eee solid;\"></div>";
				}
			}
			
				
			// Draw client marker
			map.addOverlay(renderMarkers[0]);
			
			// if not a small map, open info box of client marker
			if(setupVals["MapControl"] != "sml")
				myclick(markers[0].getAttribute("itm"));
        //myclick('i0_1');
			// End if not a small map, open info box of client marker
				
		} // End if readyState 4
		
	} // --- End onreadystatechange function() for xml file

	request.send(null);
	
	
	// Draw marker and marker list on a timer
	setTimeout("addMap(1)", 1500);
	// --- End Read the data from xml & process it
	
}
else {
	alert ("Sorry, the Google Maps API is not compatible with this browser");
}

// This Javascript is based on code provided by the
// Blackpool Community Church Javascript Team
// http://www.commchurch.freeserve.co.uk/   
// http://www.econym.demon.co.uk/googlemaps/
//]]>

