var map;
var geocoder;
var gc_title;
var bounds; 
var points = Array();

points[0] = new PVGeoMarker( 'Acapulco Hotel and Resort', '2505 S. Atlantic Ave. Daytona Beach Shores, FL 32118', 'Local Tel: 386-761-2210<br>Toll Free: 800-245-3580', -80.988235, 29.186674 );
points[1] = new PVGeoMarker( 'Aqua Terrace Motel', '599 South Atlantic Avenue Ormond Beach, FL 32176', 'Local Tel: (386) 677-2517<br>Toll Free: (800) 726-0678', -81.032295, 29.276489 );
points[3] = new PVGeoMarker( 'Bermuda House', '2560 N. Atlantic Ave. Daytona Beach, FL 32118', 'Local Tel: 800-448-2286<br>Toll Free: 800-584-3017', -81.025536,29.262339 );
points[4] = new PVGeoMarker( 'Best Western Mainsail Inn &amp; Suites', '281 South Atlantic Ave. Ormond Beach, FL 32176', 'Local Tel: (386) 677-2131<br>Toll Free: (800) 843-5142', -81.036392,29.284678 );
points[5] = new PVGeoMarker( 'Mayan Inn', '103 S. Ocean Avenue Daytona Beach, FL 32118', 'Local Tel: (800) 448-2286<br>Toll Free: (800) 448-2286', -81.006691,29.225248 );
points[7] = new PVGeoMarker( 'Comfort Inn on the Beach', '507 S. Atlantic Ave Ormond Beach, FL 32176', 'Local Tel: 386-677-8550<br>Toll Free: 800-456-8550', -81.033310,29.278538 );
points[8] = new PVGeoMarker( 'Conch House', '700 N. Atlantic Ave Daytona Beach, FL 32118', 'Local Tel: 386-255-3411<br>Toll Free: 800-584-3017', -81.013245,29.237204 );
points[9] = new PVGeoMarker( 'Driftwood Resort', '657 S. Atlantic Ave. Ormond Beach, FL 32176', 'Local Tel: 1-800-584-3017<br>Toll Free: 1-800-584-3017', -81.031464,29.274879 );
points[10] = new PVGeoMarker( 'La Breeze Inn &amp; Suites', '505 S. Atlantic Ave. Ormond Beach, FL 32176', 'Local Tel: 386-677-3353<br>Toll Free: none', -81.033333,29.278650 );
points[11] = new PVGeoMarker( 'LaPlaya Resort and Suites', '2500 N. Atlantic Ave. Daytona Beach, FL 32118', 'Local Tel: 386-672-0990<br>Toll Free: 800-874-6996', -81.024826,29.261515 );
points[12] = new PVGeoMarker( 'Makai Beach Lodge', '707 S. Atlantic Ave. Ormond Beach, FL 32176', 'Local Tel: 800-448-2286<br>Toll Free: 800-448-2286', -81.030991,29.273943 );
points[14] = new PVGeoMarker( 'Plaza Ocean Club', '640 N. Atlantic Ave. Daytona Beach, FL 32118', 'Local Tel: 800-806-3859<br>Toll Free: 800-806-3859', -81.012787,29.236250 );
points[15] = new PVGeoMarker( 'Plaza Resort and Spa', '600 N. Atlantic Avenue Daytona Beach, FL 32118', 'Local Tel: 386.255.4471<br>Toll Free: 800.225.0329', -81.012474,29.235632 );
points[16] = new PVGeoMarker( 'Quality Inn &amp; Suites', '295 S. Atlantic Ave Ormond Beach, FL 32176', 'Local Tel: 386-672-2651<br>Toll Free: 800-847-8811', -81.036240,29.284388 );
points[17] = new PVGeoMarker( 'Saxony Inn', '35 S. Ocean Ave. Daytona Beach, FL 32118', 'Local Tel: 1-800-584-3017<br>Toll Free: 1-800-584-3017', -81.007233,29.226381 );
points[18] = new PVGeoMarker( 'Seaside Inn', '500 N. Atlantic Avenue Daytona Beach, FL 32118', 'Local Tel: 386-253-2562<br>Toll Free: 1-800-584-3017', -81.011642,29.233946 );
points[19] = new PVGeoMarker( 'Sunny Shore Resort', '2037 S. Atlantic Ave. Daytona Beach, FL 32118', 'Local Tel: 1-800-584-3017<br>Toll Free: 1-800-584-3017', -80.995384,29.200808 );
points[20] = new PVGeoMarker( 'Super 8 Oceanfront', '133 South Ocean Avenue Daytona Beach, FL 32118', 'Local Tel: 1-800-800-8000<br>Toll Free: 1-800-584-3017', -81.006325,29.224415 );
points[22] = new PVGeoMarker( 'The Islander Resort', '3161 S.Atlantic Ave. Daytona Beach, FL 32118', 'Local Tel: 800-448-2286<br>Toll Free: 800-448-2286', -80.975029,29.162046 );
points[23] = new PVGeoMarker( 'Royal Beach Motel', '1601 S. Atlantic Ave. Daytona Beach, FL 32118', 'Local Tel: 386-255-8341<br>Toll Free: 800-584-3017', -80.998962,29.208136 );

function PVGeoMarker(title, address, info, lon, lat) {
		this.title = title;
	this.info = info;
	this.address = address;
	this.lat = lat;
	this.lon = lon;
	/* this.coords = new GLatLng(this.lat,this.lon); */
	this.marker = null;
	this.infohtml = '<b>' + this.title + '</b><br/>' + this.address + '<br/>' + this.info + '<div align="right"><a style="color: #000;"target="_blank" href="http://maps.google.com/maps?f=d&geocode=&daddr='+escape(this.address)+'&z=13">Get Driving Directions</a></div></span>';
}	

PVGeoMarker.prototype.createMarker = function() {
	this.marker = new GMarker(this.coords);
	this.marker.bindInfoWindowHtml( this.infohtml );
	return this.marker;	
}

PVGeoMarker.prototype.show = function() {
	map.clearOverlays();
	this.createMarker();
	map.setCenter( this.coords, 14 );
	map.addOverlay(this.marker);
	this.marker.openInfoWindowHtml(this.infohtml);
}

function AddressCache() {
	GGeocodeCache.apply(this);
}

function createMap( elementid ) {
    map = new google.maps.Map2(document.getElementById( elementid ));
    map.enableScrollWheelZoom();
    map.enableContinuousZoom();
    map.addControl(new GSmallMapControl());
    
    var point = new GLatLng(0, 0);
	map.setCenter( point , 4 );
	
    AddressCache.prototype = new GGeocodeCache();
    geocoder = new GClientGeocoder();
    geocoder.setCache(new AddressCache());
}

function loadMarkersLayer() { 
	bounds = new GLatLngBounds();
    map.clearOverlays();   	
	
	for (var i = 0; i < points.length; i++) {
		var pt = points[i];
		if(pt != null) {
            pt.coords = new GLatLng(pt.lat,pt.lon);
			map.addOverlay(pt.createMarker());
			bounds.extend(pt.coords);
		}
	}
	 if (!bounds.isEmpty()) {
	 	map.setCenter(bounds.getCenter(),
		map.getBoundsZoomLevel(bounds));
	 }
}

function loadGoogleMap() {
  if (GBrowserIsCompatible()) {
  	createMap( 'map' );
  	loadMarkersLayer();
  }
}

/* Event.observe(window, 'load', loadGoogleMap, false);
Event.observe(window, 'unload', GUnload, false);*/

google.load("maps", "2.x");
google.setOnLoadCallback(loadGoogleMap);