var map;

function initialize_map(latitude, longitude, zoomLevel) {
	map =  new GMap2(document.getElementById("map_canvas"));
   	if (GBrowserIsCompatible()) {
		// this function call set the map as center and zoomlevel
		map.setCenter(new GLatLng(latitude, longitude), zoomLevel);
		map.setUIToDefault();
		// Create our "tiny" marker icon
        var blueIcon = new GIcon(G_DEFAULT_ICON);
        blueIcon.image = "/wp-content/themes/beautiful-day/img/pmarker.png";
		// Set up our GMarkerOptions object
		markerOptions = { icon:blueIcon };
		
		//call function to add all property markers to the map
		addAllProperties();

    }
}
// this function gets details of map markers to create and the html information also from property_marker.js file in wp-includes/js directory
function createMarker(latlng,propertyId,bathrooms,bedrooms,sleeps,quality,nightlyrangestart,nightlyrangeend,thumbnail) {
	// function for creating marker
  var marker = new GMarker(latlng, markerOptions);
 // this code is useful to display the property marker information when we click on property marker
  GEvent.addListener(marker,"click", function() {
  var myHtml = '<table style="font-family:Arial, Helvetica, sans-serif;font-size:14px;" ><tr><td colspan="3" height="40px" align="left"><span style="font-size:20px">Property '+propertyId+'</span><hr color="#085173" size="2"/></td></tr><tr><td valign="top" width="150px" height="120px"><img style="margin:0px;border:0px;"  src="'+thumbnail+'"/></td><td width="2px">&nbsp;</td><td align="left" valign="top"><b>'+quality+'</b><br/>&#36;'+nightlyrangestart+' - &#36;'+nightlyrangeend+' / night<br/>Sleeps '+sleeps+'<br/>'+bedrooms+' br '+bathrooms+' baths<br/>' +
				'<a href="http://www.findtahoerentals.com/'+propertyId+'" target="_blank">More Details</a></td></tr></table>';
  map.openInfoWindowHtml(latlng, myHtml);
  });
  return marker;
}

