var lastMarker;

function hideBoxWinkel() {
	$("winkeloverlay").style.display = "none";
	var wi = Wp.General.GetElementsByClass($("winkels_ovz_list_body"), "winkelinfo")
	for (var i = 0; i < wi.length; i++) { wi[i].style.display = "none"; wi[i].style.top = "0px"; }
	if (lastMarker) {
		lastMarker.setImage("http://pilot.winkelparade.nl/img/gm/shop.png");
		lastMarker = undefined;
	}
}

function normalizeMarker() {
	if (lastMarker) {
		lastMarker.setImage("http://pilot.winkelparade.nl/img/gm/shop.png");
	}
}

function showBoxWinkel(vstid, marker) {
	hideBoxWinkel();
	
	setTimeout(function() {
		if (marker) {
			if (vstid.indexOf("poi") == -1) {
				marker.setImage("http://pilot.winkelparade.nl/img/gm/shop_selected.png");
				lastMarker = marker;
				GMmap.panTo(marker.getLatLng());
			}
		}
		with ($("winkeloverlay")) {
			style.display = "block";
			onclick = hideBoxWinkel;
		}

		with ($("box_winkel" + vstid)) {
			style.display = "block";
			style.top = "-350px";
			onclick = hideBoxWinkel;
		}
	},100);
}

function GMPanToShop(zoom, lat, lng, vstid) {
	showBoxWinkel(vstid);	
	GMPanTo(zoom, lat, lng);
}

function GMPanTo(zoom, lat, lng) {
	document.documentElement.scrollTop=0;
	GMmap.setZoom(zoom);
	GMmap.panTo(new GLatLng(lat, lng));
}

