/**
 * Custom Google Maps Class
 */

function GMap(locations) {
	var _l0 = this;
	$(document).ready(function() {
		_l0.locations = gmap_locations;
		_l0.build();
	});
};

GMap.prototype.build = function() {
	var _l0 = this;
	_l0.the_options = {
		zoom: 1,
		center: new google.maps.LatLng(10, -20),
		//mapTypeControl: true,
		//mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
		navigationControl: true,
		//navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
		disableDefaultUI: true,
		draggable: true,
		disableDoubleClickZoom: true,
		mapTypeId: google.maps.MapTypeId.ROADMAP       
	};
	_l0.custom_map = new google.maps.Map(document.getElementById('google-map-container'), _l0.the_options);
	var image = image = new google.maps.MarkerImage(BASE_URL + 'assets/css/images/common/markerImage.png', new google.maps.Size(12, 20), new google.maps.Point(0,0), new google.maps.Point(6, 20));
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
		if ((new Number(RegExp.$1))<7) {
			image = new google.maps.MarkerImage(BASE_URL + 'assets/css/images/common/markerImage.gif', new google.maps.Size(12, 20), new google.maps.Point(0,0), new google.maps.Point(6, 20));
		}
	}
	for (var loc in _l0.locations) {
		var point = new google.maps.Marker({
			position: new google.maps.LatLng(_l0.locations[loc]['latitude'], _l0.locations[loc]['longitude']),
			icon: image,
			title: _l0.locations[loc]['title'],
			map: _l0.custom_map,
			url: _l0.locations[loc]['link']
		});
		google.maps.event.addListener(point, 'click', function() {
			window.location = BASE_URL + this.url;
		});
	};
	$("#google-map-home").show();
};
