if(navigator.appVersion.indexOf('MSIE 6') > 0) {
	
	document.getElementById('map').innerHTML = '<img src="/public/images/map1.gif" />';
	document.getElementById('map2').innerHTML = '<img src="/public/images/map2.gif" />';
	document.getElementById('terms1').innerHTML = '<div style="position: absolute; top:-14px; left: 394px; width:70px; height:14px; font-size: 11px;"><a href="http://www.google.com/intl/en_us/help/terms_maps.html" target="_blank">Terms of Use</a></div>';
	document.getElementById('terms2').innerHTML = '<div style="position: absolute; top:-14px; left: 154px; width:70px; height:14px; font-size: 11px;"><a href="http://www.google.com/intl/en_us/help/terms_maps.html" target="_blank">Terms of Use</a></div>';
	document.getElementById('browserWarning').style.display = "block";

	
} else {
	
	var map = new GMap2(document.getElementById("map"));
	var map2 = new GMap2(document.getElementById("map2"));
	
	map.addControl(new GSmallMapControl());
	
	var locicon = new GIcon();
	locicon.image="http://labs.google.com/ridefinder/images/mm_20_red.png";
	locicon.iconSize = new GSize(12, 20);
	locicon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	locicon.shadowSize = new GSize(22, 20);
	locicon.iconAnchor = new GPoint(6, 20);
	locicon.infoWindowAnchor = new GPoint(5, 1);
	
	var hqicon = new GIcon();
	hqicon.image="http://labs.google.com/ridefinder/images/mm_20_yellow.png";
	hqicon.iconSize = new GSize(12, 20);
	hqicon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	hqicon.shadowSize = new GSize(22, 20);
	hqicon.iconAnchor = new GPoint(6, 20);
	hqicon.infoWindowAnchor = new GPoint(5, 1);
	
	var locations = new Array();
	locations[locations.length] = new locObj(new GLatLng(27.9747, -82.0157), "Lakeland, FL", "3535 W Pipkin Road<br />Lakeland, FL 33811", false);
	locations[locations.length] = new locObj(new GLatLng(41.6817, -91.5960), "Coralville, IA","2213 2nd Street<br />Coralville, IA 52241", false);
	locations[locations.length] = new locObj(new GLatLng(40.8063, -73.4784), "Woodbury, NY","750 Woodbury Road<br />Woodbury, NY 11797", false);
	locations[locations.length] = new locObj(new GLatLng(32.9399, -96.8377), "Dallas, TX","4201 Spring Valley Road<br />Dallas, TX 75244", false);
	locations[locations.length] = new locObj(new GLatLng(36.7843, -76.0141), "Virginia Beach, VA","1345 Perimeter Parkway<br />Virginia Beach, VA 23454", false);
	locations[locations.length] = new locObj(new GLatLng(32.2342, -110.8379), "Tucson, AZ","930 North Finance Center Drive<br />Tucson, AZ 85710", false);
	locations[locations.length] = new locObj(new GLatLng(32.8109, -83.5690), "Macon, GA", "4295 Ocmulgee East Blvd<br />Macon, GA 31295", false);
	locations[locations.length] = new locObj(new GLatLng(38.962234, -77.090965), "Chevy Chase, MD", "4608 Willard Ave<br />Chevy Chase, MD 20815", true);
	locations[locations.length] = new locObj(new GLatLng(38.364067, -77.524154), "Fredericksburg, VA", "One GEICO Blvd<br />Fredericksburg, VA 22412", false);
	locations[locations.length] = new locObj(new GLatLng(32.9395, -117.0323), "San Diego, CA", "14111 Danielson Street<br />Poway, CA 92064", false);
	locations[locations.length] = new locObj(new GLatLng(43.04269, -78.75089), "Buffalo, NY", "300 Crosspoint Parkway<br />Getzville, NY 14068", false);
	locations[locations.length] = new locObj(new GLatLng(39.902911, -74.934731), "Marlton, NJ", "8000 Lincoln Drive East<br />Marlton, NJ 08053", false);
	
	var hawaii = new locObj(new GLatLng(21.301704, -157.854876), "Honolulu, HI","711 Kapiolani Blvd Suite 300<br />Honolulu, HI 96813", false );
	var hawaii2 = new locObj2(new GLatLng(21.301704, -157.854876), "Honolulu, HI", "711 Kapiolani Blvd Suite 300<br />Honolulu, HI 96813", false);
	
	map.setCenter(new GLatLng(0,0),0);
	map.enableScrollWheelZoom();
	map2.setCenter(new GLatLng(0,0),0);
	var bounds = new GLatLngBounds();
	var bounds2 = new GLatLngBounds();
	
	for(i=0; i<locations.length; i++) {
		bounds.extend(locations[i].point);
		map.addOverlay(locations[i].marker);
	}
	
	bounds2.extend(hawaii.point);
	map2.addOverlay(hawaii2.marker);
	map.addOverlay(hawaii.marker);
	
	map.setZoom(map.getBoundsZoomLevel(bounds));
	map.setCenter(bounds.getCenter());
	
	map2.setZoom(4);
	map2.setCenter(bounds2.getCenter());
	
}

function locObj(point, name, address, hq) {
	this.name=name;
	this.address=address;
	this.point=point;
	var funcRef=this;
	var hqString = '';
	
	if(hq==true) {
		funcRef.marker=new GMarker(this.point, hqicon);
		hqString = " (Headquarters)";
	} else {
		funcRef.marker=new GMarker(this.point, locicon);
	}
	
	GEvent.addListener(funcRef.marker, "click", function() {
		funcRef.marker.openInfoWindow("<p><b>" + name + hqString + "</b><br />" + address + "<br /><a href=\"/working_at_geico/office_locations/" + name.toLowerCase().replace(", ","_").replace(" ","_") + "\">Learn more about this location</a></p>");
	});
}

function locObj2(point, name, address) {
	this.name=name;
	this.address=address;
	this.point=point;
	var funcRef=this;

	funcRef.marker=new GMarker(this.point, locicon);
	GEvent.addListener(funcRef.marker, "click", function() {
		hawaii.marker.openInfoWindow("<p><b>" + name + "</b><br />" + address + "<br/><a href=\"/working_at_geico/office_locations/" + name.toLowerCase().replace(", ","_") + "\">Learn more about this location</a></p>");
	});
}

function recenter(index) {
	nearlocations[index].marker.openInfoWindow(nearlocations[index].address);
}