var map1 = null;
var geocoder = null;

var myIcon = new GIcon();
	myIcon.image = '/images/chart-1.png';
	myIcon.shadow = 'http://maps.gstatic.com/intl/de_ALL/mapfiles/shadow50.png';
	myIcon.iconSize = new GSize(32,32);
	myIcon.shadowSize = new GSize(48,32);
	myIcon.iconAnchor = new GPoint(16,32);
	myIcon.infoWindowAnchor = new GPoint(16,0);	
	myIcon.printImage = 'http://maps.gstatic.com/intl/de_ALL/mapfiles/printImage.gif';
	myIcon.mozPrintImage = 'http://maps.gstatic.com/intl/de_ALL/mapfiles/mozPrintImage.gif';
	myIcon.printShadow = 'http://maps.gstatic.com/intl/de_ALL/mapfiles/dithshadow.gif';
	myIcon.transparent = 'http://maps.gstatic.com/intl/de_ALL/mapfiles/transparent.png';
	myIcon.imageMap = [19,0,21,1,22,2,23,3,23,4,24,5,24,6,24,7,24,8,24,9,24,10,24,11,23,12,23,13,22,14,22,15,21,16,20,17,19,18,19,19,18,20,18,21,18,22,17,23,17,24,17,25,17,26,17,27,17,28,17,29,17,30,17,31,14,31,14,30,14,29,14,28,14,27,14,26,14,25,14,24,13,23,13,22,13,21,13,20,12,19,11,18,11,17,10,16,9,15,9,14,8,13,7,12,7,11,7,10,7,9,7,8,7,7,7,6,7,5,8,4,8,3,9,2,10,1,12,0];
		
var markerOptions = {icon:myIcon}

	$(".headbg_link_bln").click(function(){
		$(this).addClass("selected");
		$("#map_canvas_bln").slideToggle(600, function(){	
			map1 = new GMap2(document.getElementById("map_canvas_bln"), { size: new GSize(480,300) });
    		geocoder = new GClientGeocoder();
    		showAddress("Torstraße 6-8, 10119 Berlin");
			function showAddress(address) {
			     if (geocoder) {
			       geocoder.getLatLng(
			         address,
			         function(point1) {
			           if (!point1) {
			             alert(address + " wurde nicht gefunden");
			           } else {
			             map1.addControl(new GSmallMapControl(),
			new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(8,30))) 
			             var marker = new GMarker(point1, markerOptions);
			             map1.addOverlay(marker);
			             map1.setCenter(point1, 12);
			             html1='<h5 style="margin: 0; width: 60px">Anschrift</h5>'
			             html2='<br/><a href="http://maps.google.com/maps?f=d&saddr=&daddr=Torstraße 6-8, 10119 Berlin&&hl=de&geocode=&mra=ls&sll=50.106488,7.723389&sspn=1.846144,5.72937&ie=UTF8&z=11" title="">Eine Route zu dieser Anschrift planen</a>';
			             marker.openInfoWindowHtml(html1+address+html2);
			           }
			         }
			       );
			     }
			   }
 		});
	});
