Shops = {};
Shops.items = {};
Shops.ICON = new GIcon (G_DEFAULT_ICON);


Shops.ICON.image = '/gfx/icons/marker.png';
Shops.ICON.iconSize = new GSize(24,24);
Shops.ICON.iconAnchor = new GPoint(24,24);
	
Shops.ICON.shadow = '/gfx/icons/marker-shadow.png';
Shops.ICON.shadowSize = new GSize(24,24);
//Shops.ICON.shadowAnchor = new GPoint(19,25);

Shops.init = function ( small, centerLat, centerLng, centerZoom ) {
    if (GBrowserIsCompatible()) {
        Shops.map = new GMap2(document.getElementById("mapContents"));
        Shops.map.setCenter(new GLatLng(52,4.9), 7);
        Shops.map.addControl( new GSmallMapControl ());
    
		var mapTypes = Shops.map.getMapTypes();
		for (var i=0; i<mapTypes.length; i++) {
            mapTypes[i].getMinimumResolution = function() {return 7;}
            mapTypes[i].getMaximumResolution = function() {return 15;}
		}
		
		Shops.geoCoder = new GClientGeocoder();
		Shops.form = $('searchPostCodeForm'); 
		Shops.form.addEvent('submit',
		  function (e) { 
		      new Event(e).stop();
		      Shops.setUserLocation(Shops.form);
		  }
	    )
	    
	    Shops.markerManager = new MarkerManager(Shops.map);
    }
}

Shops.add = function ( lat, lng, description ) {
    var marker = new GMarker(new GLatLng(lat,lng),{icon:Shops.ICON});
    GEvent.addListener(marker,"click", function () {
        marker.openInfoWindowHtml( description );
    } );
	Shops.markerManager.addMarker(
	    marker,
	    0
	);
}

Shops.setUserLocation = function ( form ) {
    Shops.geoCoder.getLatLng (
        Shops._formatGeoCode(form),
        Shops._geoCodeResponse
    );
}

Shops._formatGeoCode = function ( form ) {
    var value = '' + form.elements['postcode'].value + ' Nederland';
    return value;
}

Shops._geoCodeResponse = function ( point ) {
    Shops.map.setCenter ( point, 14 );
}

Shop = {};
Shop.items = {};
Shop.ICON = new GIcon (G_DEFAULT_ICON);


Shop.ICON.image = '/gfx/icons/marker.png';
Shop.ICON.iconSize = new GSize(24,24);
Shop.ICON.iconAnchor = new GPoint(24,24);
	
Shop.ICON.shadow = '/gfx/icons/marker-shadow.png';
Shop.ICON.shadowSize = new GSize(24,24);

Shop.init = function (lat, lng) {
    if (GBrowserIsCompatible()) {
        Shop.map = new GMap2(document.getElementById("mapContents"));
        Shop.map.setCenter(new GLatLng(lat,lng), 13);
        Shop.map.addControl( new GSmallMapControl ());

		var mapTypes = Shop.map.getMapTypes();
		for (var i=0; i<mapTypes.length; i++) {
            mapTypes[i].getMinimumResolution = function() {return 7;}
            mapTypes[i].getMaximumResolution = function() {return 15;}
		}
		
		Shop.geoCoder = new GClientGeocoder();
	    
	    Shop.markerManager = new MarkerManager(Shop.map);
    }
}

Shop.add = function ( lat, lng, description ) {
    var marker = new GMarker(new GLatLng(lat,lng),{icon:Shop.ICON});
    GEvent.addListener(marker,"click", function () {
        marker.openInfoWindowHtml( description );
    } );
	Shop.markerManager.addMarker(
	    marker,
	    0
	);
}


Shop._geoCodeResponse = function ( point ) {
    Shop.map.setCenter ( point, 14 );
} 