
//<![CDATA[

var map = null;
var geocoder = null;

var iconBlue = new GIcon(); 
iconBlue.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png';
iconBlue.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconBlue.iconSize = new GSize(12, 20);
iconBlue.shadowSize = new GSize(22, 20);
iconBlue.iconAnchor = new GPoint(6, 20);
iconBlue.infoWindowAnchor = new GPoint(5, 1);

var iconRed = new GIcon(); 
iconRed.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png';
iconRed.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconRed.iconSize = new GSize(12, 20);
iconRed.shadowSize = new GSize(22, 20);
iconRed.iconAnchor = new GPoint(6, 20);
iconRed.infoWindowAnchor = new GPoint(5, 1);

var iconGreen = new GIcon(); 
iconGreen.image = 'http://labs.google.com/ridefinder/images/mm_20_green.png';
iconGreen.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconGreen.iconSize = new GSize(12, 20);
iconGreen.shadowSize = new GSize(22, 20);
iconGreen.iconAnchor = new GPoint(6, 20);
iconGreen.infoWindowAnchor = new GPoint(5, 1);

var iconYellow = new GIcon(); 
iconYellow.image = 'http://labs.google.com/ridefinder/images/mm_20_yellow.png';
iconYellow.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconYellow.iconSize = new GSize(12, 20);
iconYellow.shadowSize = new GSize(22, 20);
iconYellow.iconAnchor = new GPoint(6, 20);
iconYellow.infoWindowAnchor = new GPoint(5, 1);

var iconOrange = new GIcon(); 
iconOrange.image = 'http://labs.google.com/ridefinder/images/mm_20_orange.png';
iconOrange.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconOrange.iconSize = new GSize(12, 20);
iconOrange.shadowSize = new GSize(22, 20);
iconOrange.iconAnchor = new GPoint(6, 20);
iconOrange.infoWindowAnchor = new GPoint(5, 1);

var iconPurple = new GIcon(); 
iconPurple.image = 'http://labs.google.com/ridefinder/images/mm_20_purple.png';
iconPurple.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconPurple.iconSize = new GSize(12, 20);
iconPurple.shadowSize = new GSize(22, 20);
iconPurple.iconAnchor = new GPoint(6, 20);
iconPurple.infoWindowAnchor = new GPoint(5, 1);

var iconBlack = new GIcon(); 
iconBlack.image = 'http://labs.google.com/ridefinder/images/mm_20_black.png';
iconBlack.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconBlack.iconSize = new GSize(12, 20);
iconBlack.shadowSize = new GSize(22, 20);
iconBlack.iconAnchor = new GPoint(6, 20);
iconBlack.infoWindowAnchor = new GPoint(5, 1);

var iconWhite = new GIcon(); 
iconWhite.image = 'http://labs.google.com/ridefinder/images/mm_20_white.png';
iconWhite.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconWhite.iconSize = new GSize(12, 20);
iconWhite.shadowSize = new GSize(22, 20);
iconWhite.iconAnchor = new GPoint(6, 20);
iconWhite.infoWindowAnchor = new GPoint(5, 1);

var iconGray = new GIcon(); 
iconGray.image = 'http://labs.google.com/ridefinder/images/mm_20_gray.png';
iconGray.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconGray.iconSize = new GSize(12, 20);
iconGray.shadowSize = new GSize(22, 20);
iconGray.iconAnchor = new GPoint(6, 20);
iconGray.infoWindowAnchor = new GPoint(5, 1);

var customIcons = [];
customIcons['Building Engineering'] = iconBlue;
customIcons['Community Centers'] = iconRed;
customIcons['Consulting'] = iconGreen;
customIcons['Education'] = iconYellow;
customIcons['Entertainment'] = iconOrange;
customIcons['Financial'] = iconPurple;
customIcons['Hotels'] = iconBlack;
customIcons['Health'] = iconWhite;
customIcons['Human Services'] = iconGray;
customIcons['Legal'] = iconBlue;
customIcons['Marketing'] = iconRed;
customIcons['Photography'] = iconGreen;
customIcons['Real Estate'] = iconYellow;
customIcons['Residential'] = iconOrange;
customIcons['Restaurants'] = iconPurple;
customIcons['Retail'] = iconBlack;
customIcons['Utilities'] = iconWhite;
customIcons['Other'] = iconGray;

function load() {
	if (GBrowserIsCompatible()) {
	map = new GMap2(document.getElementById("map"));
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());

	map.setCenter(new GLatLng(40.742629, -73.990101), 15);
	geocoder = new GClientGeocoder(); 
	 } 
}

function showAddress(address,contact,email,website,discounts,type) {
	if (geocoder) {
		geocoder.getLatLng(address, function(point) {
			if (!point) {
				alert(address + " not found");
			}
			else {
				target = 'target="_blank"';
				map.setCenter(point, 15);
				var marker = new GMarker(point,customIcons[type]);
				contact += '<p><a href="mailto:' + email + '">' + email + '</a></p><p><a href="' + website + '" ' + target + '>' + website + '</a></p>';
				discounts = '<div align="left">' + discounts + '</div>';
				
        var infoTabs = [
          new GInfoWindowTab('Contact',contact),
          new GInfoWindowTab('Discounts',discounts)
        ];
				
				GEvent.addListener(marker, "click", function() {
					marker.openInfoWindowTabsHtml(infoTabs,{maxWidth:250});
				});
				map.addOverlay(marker);
				marker.openInfoWindowTabsHtml(infoTabs,{maxWidth:250});
			}
		}
	); }
}

//]]