function PlainIconProvider(){
    this.getIconName = function() { return 'blue'; };
    this.getShadowName= function() { return 'msmarker.shadow'; }
    this.getIcon = buildIcon;
    this.iconSize = new GSize(32, 32);
    this.shadowSize = new GSize(59, 32);
    this.iconAnchor = new GPoint(25, 35);
    this.infoWindowAnchor = new GPoint(25, 35);
}

function NumberedIconProvider() {
    this.getIcon = buildNumberedIcon;
    this.iconSize = new GSize(20, 34);
    this.shadowSize = new GSize(59, 32);
    this.iconAnchor = new GPoint(10, 35);
    this.infoWindowAnchor = new GPoint(5, 1);
}

function CustomIconProvider() {
    this.getIcon = buildCustomIcon;
    this.iconAnchor = new GPoint(10, 35);
    this.infoWindowAnchor = new GPoint(5, 1);
}

function buildIcon() {
    var icon = new GIcon();
    icon.image = "/images/googlemaps/" + this.getIconName() + ".png";
    icon.shadow = "/images/googlemaps/" + this.getShadowName() + ".png";
    icon.iconSize = this.iconSize;
    icon.shadowSize = this.shadowSize;
    icon.iconAnchor = this.iconAnchor;
    icon.infoWindowAnchor = this.infoWindowAnchor;
    return icon;
}

function buildCustomIcon(iconUrl, iconWidth, iconHeight, shadowUrl, shadowWidth, shadowHeight) {
	var icon = new GIcon();
    icon.image = iconUrl;
    icon.shadow = shadowUrl;
    icon.iconSize = new GSize(iconWidth, iconHeight);
    icon.shadowSize = new GSize(shadowWidth, shadowHeight);
    icon.iconAnchor = this.iconAnchor;
    icon.infoWindowAnchor = this.infoWindowAnchor;
    return icon;
}

function buildNumberedIcon(number) {
	var icon = new GIcon();
    icon.image = "/images/googlemaps/numbered/marker" + number + ".png";
    icon.shadow = "/images/googlemaps/msmarker.shadow.png";
    icon.iconSize = this.iconSize;
    icon.shadowSize = this.shadowSize;
    icon.iconAnchor = this.iconAnchor;
    icon.infoWindowAnchor = this.infoWindowAnchor;
    return icon;
}

var iconProvider = new PlainIconProvider();
var customIconProvider = new CustomIconProvider();
var numberedIconProvider = new NumberedIconProvider();

function panMap(map, lat, lng) {
	map.panTo(new GLatLng(lat, lng))
}


