/*
* Hiveon Google Maps 1.0
* Uses Google Maps Mapping API to create customizable
* Google Maps that can be embedded on your website
*
* @class        Hiveon Google Maps 1.0
* @author       Tommaso Soprana <info@lifecode.it>
* @copyright    2009 Lifecode srl
*/


var toggleState = 1;
var markerOptions;
		
// Create our "tiny" marker icon

						

function customIcon (icon) {
	var custom_icon = new GIcon();
	
	if (icon) {
		custom_icon.image = icon;  
		custom_icon.size = new GSize(16,16);
		custom_icon.iconAnchor = new GPoint(8,16);
		custom_icon.infoWindowAnchor = new GPoint(7,7);
	}
	else {
		custom_icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
		custom_icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
		custom_icon.iconSize = new GSize(12, 20);
		custom_icon.shadowSize = new GSize(22, 20);
		custom_icon.iconAnchor = new GPoint(6, 20);
		custom_icon.infoWindowAnchor = new GPoint(5, 1);
	}
	var myOpt = { icon: custom_icon };
	return myOpt;
}


function showMark(key) {
	var longitude = eval('hvnMarkerLon_' + key);
	var latitude = eval('hvnMarkerLat_' + key);
	var cloudcontent = eval('hvnMarkerCloudContent_' + key);
	var icon = eval('hvnMarkerIcon_' + key);
	
	 if (longitude && latitude) {
		var point = new GLatLng(longitude, latitude);
		if (point) {
        	var marker = new GMarker(point, customIcon(icon));
        	marker.bindInfoWindowHtml(cloudcontent);
			map.addOverlay(marker);
			return marker;
		}
	}
	return null;
}


function activateMark(key) {
	var obj = eval('hvnMarker_' + key);
	var cloudcontent = eval('hvnMarkerCloudContent_'  + key);
	obj.openInfoWindow(cloudcontent);
}