// JavaScript Document

var map;
var centerLatitude = 56.117687;
var centerLongitude = -3.942118;
var startZoom = 15;

// Kerr icon
//
var newIcon = new GIcon();
newIcon.iconSize = new GSize(48, 34);
var kerr_icon = new GIcon(newIcon);
//var iconImage = 'http://www.kerrstirling.co.uk/img/icons/map_icon.png';
var iconImage = 'http://kerrstirling.good-creative.com/img/icons/map_icon.png';
kerr_icon.image = iconImage;
kerr_icon.iconAnchor = new GPoint(5,34);
kerr_icon.infoWindowAnchor = new GPoint(30, 5);
//

// Kerr location
var klatitude = 56.117880; //56.117720;
var klongitude = -3.943367; //-3.9421500;
var kdescription = '<font style="font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#626366;">Kerr Stirling,<br />10 Albert Place,<br />Stirling, FK8 2QL</font>';


// add the location to the map
function addKerr(klatitude, klongitude, kdescription) {
		var marker = new GMarker(new GLatLng(klatitude, klongitude), kerr_icon);
		GEvent.addListener(marker, 'click', function() {
		marker.openInfoWindowHtml(kdescription);
		}
	);
	map.addOverlay(marker);
}

// instantiate
function init()
{
if (GBrowserIsCompatible()) {
	map = new GMap(document.getElementById("map"));
	// add map controls
		map.addControl(new GSmallMapControl());
    	map.addControl(new GMapTypeControl());
	// create the location
	var location = new GLatLng(centerLatitude, centerLongitude);
	map.setCenter(location, startZoom);
	// add marker
	addKerr(klatitude, klongitude, kdescription);
	}
}

// Zoom
function kerrZoom(){
	if (GBrowserIsCompatible()) {
		var location = new GLatLng(klatitude, klongitude);
		var kZoom = 14;
		map.setCenter(location, kZoom);
	}
}

// switch to the map or satelite views
function Map(){
	map.setMapType(G_NORMAL_MAP);
}
function Sat(){
	map.setMapType(G_SATELLITE_MAP);
}

window.onload = init;
window.onunload = GUnload;