	
		var mapObj = function() {
		var tempObj = {
			locAry : {
					"1" : {
						locName : "Up Down Tobacco",
						locAddr : "1550 N. Wells ",
						locAddr2 : "Chicago,IL 60610",
						locID : "1"
					}
			},

			mapURL : function(mapid) {
				return 'http://maps.google.com/maps?q='
					+this.locAry[mapid].locAddr
					+'+Chicago,+Cook,+IL';
			},

			map : null ,

			geocoder : null,

			initialize : function() {
				if (GBrowserIsCompatible()) {
					this.map = new GMap2(document.getElementById("mapsearch"));
					this.geocoder = new GClientGeocoder(); // for converting addresses to lat-longs

					this.map.setCenter(new GLatLng(41.90, -87.659), 12);
					this.map.setZoom(15);
					this.map.addControl(new GSmallMapControl());
					this.map.addControl(new GMapTypeControl());

				}
			},

			showAddress : function (num) {
				var thisObj = this;
				var address = thisObj.locAry[num].locAddr;
				var address2 = thisObj.locAry[num].locAddr2;
				var name = thisObj.locAry[num].locName;
				this.geocoder.getLatLng(address+' '+address2,
					function(point) {
						if (point) {
							thisObj.marker[num] = new GMarker(point);
							thisObj.latlng[num] = point;
							thisObj.map.addOverlay(thisObj.marker[num]);
							thisObj.map.setCenter( thisObj.latlng[num] );
							thisObj.marker[num].openInfoWindowHtml( "<br><b>"+name+"</b><br />"+address+'<br />'+address2+'<br /><br /><strong>Get Directions:</strong><br><input type="text" id="directions_input_'+num+'" /> <br /><a href="##" target="_blank" class="tohere" onclick="mapObj.getDirections(this,'+num+')" >To Here</a><br />'); //hidden div w/ map info
							
							GEvent.addListener(thisObj.marker[num], "click", function() {
								thisObj.map.setCenter( thisObj.latlng[num] );
								thisObj.marker[num].openInfoWindowHtml( "<br><b>"+name+"</b><br />"+address+'<br />'+address2+'<br /><br /><strong>Get Directions:</strong><br><input type="text" id="directions_input_'+num+'" /> <br /><a href="##" target="_blank" class="tohere" onclick="mapObj.getDirections(this,'+num+')" >To Here</a><br />'); //hidden div w/ map info
							
							});
						}
					}
				);
			},

			marker: {},
			latlng: {},
			getDirections :function(thisObj,num) {
				var to_or_from = thisObj.className;
				var strGoogleURL= "http://maps.google.com/maps?";
				var strOne, strTwo;
				if(to_or_from == "tohere") {
					strOne = "saddr=";
					strTwo = "&daddr=";
				}
				else {
					strOne = "daddr=";
					strTwo = "&saddr=";
				};
				thisObj.href = strGoogleURL + strOne + escape(document.getElementById('directions_input_'+num).value) + strTwo + this.locAry[num].locAddr+",+Chicago,+IL,+("+this.locAry[num].locName+"\n)" ;
			}
		};
		//
		return tempObj;
	}();
	window.onunload = GUnload;
	$(function(){
		mapObj.initialize();
		for(i in mapObj.locAry) {
			mapObj.showAddress(i);
		
		}
		setTimeout("mapObj.map.checkResize()",30);
	});
