    function initialize(buttonId) {

      act(buttonId);

      if (GBrowserIsCompatible()) {
      
        	var dispStr,dispArr,dispCount,dispLat,dispLng;
        	
        	var map = new GMap2(document.getElementById("map_canvas"));        	
        
        	map.setCenter(new GLatLng(0, 0), 0, G_NORMAL_MAP);

		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());

		dispStr = addMarkers(map);		
		dispArr = dispStr.split(",");
		
		dispCount = dispArr[0];
		dispLat = dispArr[1];
		dispLng = dispArr[2];

		map.zoomToMarkers(1,1);
		
		if(dispCount == 1) {
		
			map.setCenter(new GLatLng(dispLat, dispLng), 10);
		
		}

      }
    }

    function addMarkers(map) {

    	// get xml from hidden input on page
    	
    	var lat, lng, title, url, logo, addr, pcode, tel, fax;

    	var markerXml = document.getElementById("markerxml").value;
    	
    	var xml;
    	
	try { 
		xml = GXml.parse(markerXml);
		
	} 
	catch (e) { 
		
		addMessage("Error: Cannot parse text as XML file:"+ e); 
		
		return consoleOutput; 		
	}     	    	
    	
	var ourMarkers = xml.documentElement.getElementsByTagName("marker");
	
	var markCnt = ourMarkers.length;
	
	// loop through markers
	j = 0;
	for(j;j<markCnt;j++) {
		
		// get stuff from xml		
		lat = ourMarkers[j].getAttribute("lat");
		lng = ourMarkers[j].getAttribute("lng");		
		title = ourMarkers[j].getAttribute("dname");
		url = ourMarkers[j].getAttribute("url");
		logo = ourMarkers[j].getAttribute("logo");
		addr = ourMarkers[j].getAttribute("addr");
		pcode = ourMarkers[j].getAttribute("pcode");
		tel = ourMarkers[j].getAttribute("tel");
		fax = ourMarkers[j].getAttribute("fax");
		
		// fix stuff
		
		title = title.replace("*","&amp;");
		title = title.replace("^","&#39;");
		
		addr = addr.replace("*","&amp;");
		addr = addr.replace("^","&#39;");
				
		var latNum = new Number(lat);
		var lngNum = new Number(lng);		
		
		addr = addr.replace(new RegExp( ",", "g" ),"<br/>");
		
		//logo = "http://www.diem-angling.com/new/resize.asp?File=images/dealers/" + logo + "&Width=85&UseWidth=True&C=False"
		
		logo = "http://www.diem-angling.com/resize.asp?File=images/dealers/" + logo + "&Width=85&UseWidth=True&C=False"
		
		addMarkerToMap(map,latNum,lngNum,title,url,logo,addr,tel,fax);		
	}
	
	return markCnt + "," + lat + "," + lng;

    }

    function addMarkerToMap(map,thisLat,thisLong,thisTitle,thisUrl,thisLogo,thisAddr,thisTel,thisFax) {

	var baseIcon = new GIcon(G_DEFAULT_ICON);
	baseIcon.image = "images/dealers/shop-icon.png";
	baseIcon.shadow = "images/dealers/shadow-shop-icon.png";
	
	//baseIcon.iconSize = new GSize(15.0, 14.0);
	//baseIcon.shadowSize = new GSize(23.0, 14.0);
	//baseIcon.iconAnchor = new GPoint(7.0, 7.0);
	//baseIcon.infoWindowAnchor = new GPoint(7.0, 7.0);
	
    	baseIcon.iconSize = new GSize(10.0, 9.0);
    	baseIcon.shadowSize = new GSize(15.0, 9.0);
    	baseIcon.iconAnchor = new GPoint(5.0, 4.0);
    	baseIcon.infoWindowAnchor = new GPoint(5.0, 4.0);
	

	var marker = new PdMarker(new GLatLng(thisLat,thisLong),baseIcon);

	var logoWidth = "75px";
	var logoHeight = "66px";

	marker.setTooltip(thisTitle);

	var html = "<div style='width:210px;text-align:justify;margin-top:10px;'><a href='" + thisUrl + "' target='_blank'>" + thisTitle + "<\/a>";
	html = html + "<br/><div style='float:right;'><a href='" + thisUrl + "' target='_blank'><img src='" + thisLogo + "' alt='' style='padding-top:-10px;border:0;'\/><\/a><\/div>";
	html = html + thisAddr + "<br/>Tel: " + thisTel + "<br/>" 
	
	if(thisFax.length > 0) {
	
	html = html + "Fax:" + thisFax
	
	}
	
	html = html + "<div style='clear:both;'>&nbsp;<\/div><\/div>";

	  GEvent.addListener(marker,"click", function() {

		map.setCenter(marker.getPoint());
		map.openInfoWindow(map.getCenter(),html);


	  });

	//marker.setDetailWinHTML(html);
	map.addOverlay(marker);

    }