var LeslieMap = new function () {
	var me = this;

	var mapDiv, map;
	var address = '1600 Amphitheatre Pky, Mountain View, CA';
	
	var geocoder;

	me.init = function () { 
		if (EventHelpers.hasPageLoadHappened(arguments)) return;

		mapDiv = document.getElementById('map');
	
		if (mapDiv && GBrowserIsCompatible()) {
			map = new GMap2(mapDiv);
			map.setCenter(new GLatLng(37.4419, -122.1419), 13);
			geocoder = new GClientGeocoder();		
			me.showAddress();
			EventHelpers.addEvent(document, 'click', LeslieMap.showAddress);
			//map.setCenter(new GLatLng(37.4419, -122.1419), 13);
		}
	}
	
	function getPoint(point) {
	  
      if (!point) {
        alert(address + " not found, point " + point);
      } else {
        map.setCenter(point, 13);
        var marker = new GMarker(point);
        map.addOverlay(marker);
        marker.openInfoWindowHtml(address);
      }
	};
	
	me.showAddress = function () {
	  if (geocoder) {
	  	geocoder.getLatLng(address, getPoint);
	  } else {
	  	alert('no geocoder available');
	  }
	}

	me.unloadEvent = function (e) {
		GUnload();
	}
}

/* Routine below is not really encryption.  It just obfuscates */

/***********************************************
* Encrypt Email script- Please keep notice intact
* Tool URL: http://www.dynamicdrive.com/emailriddler/
* **********************************************/


var mHelp = new function () {
	var me = this;
	
	me.init = function () {
		if (EventHelpers.hasPageLoadHappened(arguments)) return;
		var emailriddlerarray=[105,110,102,111,64,108,101,115,108,105,101,112,97,105,110,116,46,99,111,109]
		var encryptedemail_id59='' //variable to contain encrypted email 
		for (var i=0; i<emailriddlerarray.length; i++)
		 encryptedemail_id59+=String.fromCharCode(emailriddlerarray[i])
		
		var addy = StringHelpers.sprintf('<%sef="m%so:%s">%s</a>', 
			'a hr', 'ailt', encryptedemail_id59, encryptedemail_id59);
			
		var addyTags = CSSHelpers.getElementsByClassName(document, 'addy');
		
		for (i=0; i<addyTags.length; i++) {
			addyTags[i].innerHTML = addy;
		}
	}
}

EventHelpers.addPageLoadEvent('mHelp.init');

//EventHelpers.addPageLoadEvent('LeslieMap.init');
/* EventHelpers.addEvent(window, 'load', LeslieMap.init)
EventHelpers.addEvent(window, 'unload', LeslieMap.unloadEvent); */
