function MWS_Services_LocateMe(searchDiv, searchResultsDiv, onClickCode) {
   var contentText = '<div class="wrap"><div><div id="' + searchDiv + '" class="srchPanel"></div></div></div>';
   MWS.locatemeSearchTab = new YAHOO.widget.Tab ( {
      id : 'locatemeView', label : "Locate Me", content : contentText, active : true }
   );
   MWS.MWS_LocateMe_Crosshair = null;
   //(function() {
   MWS.MWS_LocateMe_Init = function() {
      //alert('MWS_LocateMe_Init');
      /* Instantiate a YUI dialog object for use */
      YAHOO.namespace("example.container");
      function initDialog() {
         //alert('initDialog');
         // NOTE: dialog1 div is predrawn in index.php
         // Instantiate the Dialog
	 if (YAHOO.example.container.dialog1==null)
	 {
		 YAHOO.example.container.dialog1 = new YAHOO.widget.Dialog("dialog1", {
		    width : "35em", draggable : true, fixedcenter : true, underlay : "none", visible : false, constraintoviewport : true, zindex : 120001, modal : true, buttons : [ ] }
		 );
		 YAHOO.example.container.dialog1.showDialog = function() {
		    MWS.locatemeSVC.ShowLocateMeInfo();
		    YAHOO.example.container.dialog1.show();
		    }
		 YAHOO.example.container.dialog1.hideCrossHair = function() {
		    MWS.locatemeSVC.CleanUpFunction();
		    }
		 // Render the Dialog
		 YAHOO.example.container.dialog1.render();
		 YAHOO.util.Event.addListener("showDialog", "click", YAHOO.example.container.dialog1.showDialog, YAHOO.example.container.dialog1, true);
		 YAHOO.util.Event.addListener("hideCrossHair", "click", YAHOO.example.container.dialog1.hideCrossHair, YAHOO.example.container.dialog1, true);
	 }
      }
      YAHOO.util.Event.onDOMReady(initDialog);
      var Dom = YAHOO.util.Dom, Event = YAHOO.util.Event, dd1;
      YAHOO.example.DDRegion = function(id, sGroup, config) {
         this.cont = config.cont;
         YAHOO.example.DDRegion.superclass.constructor.apply(this, arguments);
         };
      YAHOO.extend ( YAHOO.example.DDRegion, YAHOO.util.DD, {
         cont : null, init : function() {
            //alert('init');
            //Call the parent's init method
            YAHOO.example.DDRegion.superclass.init.apply(this, arguments); this.initConstraints(); Event.on(window, 'resize', function() {
               this.initConstraints(); }
            , this, true); }
         , initConstraints : function() {
            //alert('initConstraints');
            OpenLayers.Util.getElement("crosshair_1").style.display = 'block'; //Get the top, right, bottom and left positions
            var region = Dom.getRegion('mapPanel'); //Get the element we are working on
            var el = this.getEl(); //Get the xy position of it
            var xy = Dom.getXY(el); //Get the width and height
            var width = parseInt(Dom.getStyle(el, 'width'), 10); var height = parseInt(Dom.getStyle(el, 'height'), 10); //Set left to x minus left
            var left = xy[0] - (region.left); var right = region.right - xy[0] - width; var bottom = region.bottom - xy[1] - height; this.setXConstraint(left, right); this.setYConstraint(0, bottom); }
         }
      );
      };
   MWS.MWS_addService("locateme", "Locate Me", "event");
   var startUpFunction = function () {
      //alert('startup');
      MWS.MWS_resetEnvironment();

      MWS.MWS_LocateMe_Init();
      if (MWS.MWS_LocateMe_Crosshair == null)
      {
	      MWS.MWS_LocateMe_Crosshair = new YAHOO.example.DDRegion('crosshair_1', '', {cont : 'mapPanel' });
	      MWS.MWS_LocateMe_Crosshair.endDrag = function(e) {
		 YAHOO.util.Dom.setStyle(OpenLayers.Util.getElement("crosshair_buttons"), 'display', 'block');
		 var div = OpenLayers.Util.getElement(MWS.MWS_getServiceDiv("locateme", 0));
		 if (div != null) 
			div.innerHTML = "Now click OK to get your hyperlink or embeddable map code.  "+
			"Copy and paste either (or both, if you like) into the HTML code of your web page.  "+
			"Don't hesitate to <a class=\"usermenu\" href=\"javascript:void(0);\" onClick=\"MWS.showContactsPage();\">contact us</a> if you encounter problems.";     
		 }
	      MWS.MWS_LocateMe_Crosshair.startDrag = function(e) {
		 YAHOO.util.Dom.setStyle(MWS.MWS_LocateMe_Crosshair.getEl(), 'cursor', 'move' );
		 YAHOO.util.Dom.setStyle(OpenLayers.Util.getElement("crosshair_buttons"), 'display', 'none');
		 YAHOO.util.Dom.setStyle(OpenLayers.Util.getElement("crosshair_hint"), 'display', 'none');
		 }
      }
      //YAHOO.util.Dom.setStyle(MWS.MWS_LocateMe_Crosshair.getEl(), 'z-index', - 1);

      var serviceID = "locateme";
      var svc = MWS.MWS_getService(serviceID);
      MWS.ServiceClearTabs();
      MWS.ServiceTabs.addTab(MWS.locatemeSearchTab);
      MWS.ServiceTabs.set('activeIndex', 0);
      YAHOO.example.app.tabView.set('activeIndex', 0);
      var div = OpenLayers.Util.getElement(MWS.MWS_getServiceDiv(serviceID, 0));
      if (div != null) 
      	div.innerHTML = "<b>Help customers find your business on the map!</b><br/><br/>"+
		"It's free and very simple. You'll get a hyperlink on your website like this:&nbsp;&nbsp;"+
		"<b><a href=#>Ama's Restaurant</a></b><br/>" +
		"Or a mini version of the actual map into your website like this:</br/>"+
		"<img src='images/mnl_map1.png' style='{border:1px solid #808080;}'><br/>"+
		"First, drag the yellow cross-hair on the map to your location.";
      
      YAHOO.util.Dom.setStyle(MWS.MWS_LocateMe_Crosshair.getEl(), 'z-index', 120000);
      YAHOO.util.Dom.setStyle(MWS.MWS_LocateMe_Crosshair.getEl(), 'display', 'block');
      YAHOO.util.Dom.setStyle(OpenLayers.Util.getElement("crosshair_buttons"), 'display', 'none');
      YAHOO.util.Dom.setStyle(OpenLayers.Util.getElement("crosshair_hint"), 'display', 'block');
      };
   var cleanUpFunction = function () {

      try {
         YAHOO.util.Dom.setStyle(MWS.MWS_LocateMe_Crosshair.getEl(), 'display', 'none');
         YAHOO.util.Dom.setStyle(MWS.MWS_LocateMe_Crosshair.getEl(), 'z-index', -120000);
         YAHOO.util.Dom.setStyle(MWS.MWS_LocateMe_Crosshair.getEl(), 'left', 50);
         YAHOO.util.Dom.setStyle(MWS.MWS_LocateMe_Crosshair.getEl(), 'top', 0);

	MWS.ServiceClearTabs();     
         }
      catch(e) {
         }
      //MWS.MWS_LocateMe_Crosshair = null;
      };
      
   var showLocateMeInfo = function () {
      //alert('showLocateMeInfo');
      var div0 = OpenLayers.Util.getElement("dialoghdr");
      div0.innerHTML = "You're almost there!";
      var div1 = OpenLayers.Util.getElement("dialogbody");
      if (div1 != null) {
         x = parseInt(MWS.MWS_LocateMe_Crosshair.getEl().style.left.replace("px", ""));
         y = parseInt(MWS.MWS_LocateMe_Crosshair.getEl().style.top.replace("px", ""));
         w = parseInt(YAHOO.util.Dom.getStyle(MWS.MWS_LocateMe_Crosshair.getEl(), 'width').replace("px", ""));
         h = parseInt(YAHOO.util.Dom.getStyle(MWS.MWS_LocateMe_Crosshair.getEl(), 'height').replace("px", ""));
         var pixel = new OpenLayers.Pixel(x + w / 2, y + h / 2);
         var lonlat = MWS.MWS_MapObj.getLonLatFromViewPortPx(pixel);
	MWS.locatemeSVC.CrosshairX=lonlat.lon;
	MWS.locatemeSVC.CrosshairY=lonlat.lat;
	MWS.locatemeSVC.UpdateLink();

         }
      }
   var t = "dddd";
   MWS.locatemeSVC = MWS.MWS_getService("locateme");
   MWS.locatemeSVC.StartUpFunction = startUpFunction;
   MWS.locatemeSVC.CleanUpFunction = cleanUpFunction;
   MWS.locatemeSVC.ShowLocateMeInfo = showLocateMeInfo;
   MWS.locatemeSVC.ResultsInitText = t;
   MWS.MWS_setServiceDiv("locateme", searchDiv);
   MWS.MWS_setServiceDiv("locateme", searchResultsDiv);
   
   MWS.locatemeSVC.UpdateLink = function(){   
   		var name = "";
	      var field = OpenLayers.Util.getElement("txtLocationName");
	      if (field != null)
	      	name = field.value;
			
			if (name == "")
				name = "YOUR BUSINESS NAME GOES HERE";
				
	      var div1 = OpenLayers.Util.getElement("txtURL");
			div1.value = "" + 
			"<a href='http://"+MWS.ServerName + "/index.php" + 
			"?svc=locateme" + 
			"&x=" + MWS.locatemeSVC.CrosshairX + 
			"&y=" + MWS.locatemeSVC.CrosshairY + 
			"&z=10" + 
			"&name=" + name + 
			"'>"+name+"</a>";
			
	      var div1 = OpenLayers.Util.getElement("txtMap");
			div1.value = "<iframe width='300' height='300' " +
				"	style='{border: 1px solid black;}' " +
				"	src='http://"+MWS.ServerName + "/locateme.php" + 
				"?svc=locateme" + 
				"&x=" + MWS.locatemeSVC.CrosshairX + 
				"&y=" + MWS.locatemeSVC.CrosshairY + 
				"&z=10" + 
				"&name=" + name + 
				"' />";
		var url = "locateme.php?svc=save&x=" + 
				MWS.locatemeSVC.CrosshairX + "&y=" + MWS.locatemeSVC.CrosshairY + "&z=10"+
				"&sessionid="+MWS.MWS_SessionID+"&name="+name;		
		OpenLayers.loadURL(url,'', MWS.MWS_MapObj, MWS.locatemeSVC.SaveResult);				
   	}
   	
	MWS.locatemeSVC.SaveResult=function(resp)
	{
		//alert(resp.responseText + " saved");
	}

	MWS.locatemeSVC.createMarker=function(x,y,zoom,name)
	{
		MWS.searchResultsLayer.clearMarkers();
		MWS.searchResultsItems = new Array();

		var item = new MWS.searchResultsItem();
		item.ID = 0;
		item.X = x;
		item.Y = y;
		item.Number = 1;
		item.Name = name;
		item.Uniqueid = '';
		item.Type = '';

		MWS.searchResultsItems[0] = item;
		var DetailBubble = OpenLayers.Class(OpenLayers.Popup.AOMFramedCloud, {'autoSize': true});

		var feature = new OpenLayers.Feature(MWS.searchResultsLayer, new OpenLayers.LonLat(x,y));
		feature.closeBox = true;
		feature.popupClass = DetailBubble;
		feature.data.popupContentHTML = "<div class='olFramedCloudPopupContent'><div style='{position: relative; font-size: 8pt;}'></div><div style='{position: relative; font-size: 8pt;}'></div></div>";
		feature.data.overflow = "hidden";
		feature.poiid = 0;
		feature.funiqueid = '';
		feature.fname = target_name;
		feature.ftype = '';
		item.Feature = feature;

		var icon = MWS_Utils.createIcon("mavlibs/utils/markercreator.php?index=X&type=POI",20,34);

		var marker = new OpenLayers.Marker(new OpenLayers.LonLat(x,y),icon);

		var markerClick = function (evt) {
			MWS.searchResultsClickDiv(this.poiid, this.funiqueid, this.fname, this.ftype);
			OpenLayers.Event.stop(evt);
		};

		marker.setOpacity(1);
		marker.poiid = 0;

		marker.number = 1;
		marker.events.register("mouseover", feature, markerClick);

		MWS.searchResultsLayer.addMarker(marker); 

		MWS.MWS_MapObj.setCenter(new OpenLayers.LonLat(x,y),zoom);
		MWS.searchResultsClickDiv(feature.poiid, feature.funiqueid, feature.fname, feature.ftype);
	}

   }
