if (document.location.pathname == '/anfahrt/index.html' || document.location.pathname == '/anfahrt/') {
    document.write('<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=ABQIAAAAy-MfgKvKUTrUdcDeLLAi0RRNmMgk2y3fsEWIV1YWh5GZU-_n0RSdmezzSqHz6A3VVUD1aAldvjmZOA" type="text/javascript"></script>');
};
document.write('<script src="/scripts/swfobject.js" type="text/javascript"></script>');
document.write('<link href="/_/scripts/extjs/resources/css/ext-all.css" type="text/css" rel="stylesheet">');
document.write('<link href="/_/scripts/extjs/resources/css/xtheme-gray.css" type="text/css" rel="stylesheet">');

Ext.onReady(function(){
    var g = Ext.get('gmaps');
    if (g) {
        initialize();
    }
});

var getUniqueID = function() {
	uniqueID = (new Date()).getTime() + "" + Math.floor((Math.random() * 8999) + 1000);
	return (uniqueID);
};

var openMoviePlayer = function(src, w, h, v) {
	var box = Ext.MessageBox.show( {
		title : '<center>Spessart-R&auml;uberexamen</center>',
		msg : '<div id="video" style="height:350px;"></div>',
		buttons : {ok:'Schlie&szlig;en'},
		modal : true,
		progress : false,
		closable : true,
		width : 500
	});
	embedMoviePlayer(src, w, h, v);
	var dlg = box.getDialog();
	dlg.setHeight(350);
	dlg.on('hide', function() {
		var v = Ext.get('video');
		if (v) {
			v.remove();
		}
	});
};

var embedMoviePlayer = function(src, w, h, v) {
	var id = getUniqueID();
	var swf = new SWFObject('/_/flash/moviePlayer.swf', "videoobj", w, h, v || "8");
	swf.addParam('wmode', 'transparent');
	swf.addVariable("skinSource", '/_/flash/SteelExternalAll.swf');
	swf.addVariable("streamSource", src);
	swf.useExpressInstall('/_/flash/expressinstall.swf');
	swf.write("video");
};

var gdir;
var marker;
var map;
function initialize(){
    if (GBrowserIsCompatible()) {
    	var geocoder = new GClientGeocoder();
    	geocoder.getLatLng('63628 Bad Soden-Salmünster/Mernes, Salmünsterer Straße 15', function(point) {
			if (point) {
				map = new GMap2(document.getElementById("gmaps"));
		        map.addControl(new GMenuMapTypeControl());
		        map.addControl(new GLargeMapControl());
		        map.enableScrollWheelZoom();
		        map.setCenter(new GLatLng(point.y, point.x), 15);
		        marker = new GMarker(point);
		        var txt = ['<strong>Gasthaus-Pension "Zum Jossatal"</strong>', '', 'Salmünsterer Straße 15', '63628 Bad Soden-Salmünster/Mernes', 'Telefon: 06660/1376 ', 'Telefax: 06660/919018 ', '<a href="mailto:info@zum-jossatal.de">info@zum-jossatal.de</a>', '<a href="http://www.zum-jossatal.de/">www.zum-jossatal.de/</a>'];
		        txt = '<div style="color:#000000">' + txt.join('<br />') + '</div>';
		        GEvent.addListener(marker, "click", function(){
		            marker.openInfoWindowHtml(txt);
		        });
		        map.addOverlay(marker);
		        marker.openInfoWindowHtml(txt);
		        gdir = new GDirections(map, document.getElementById("directions"));
			};
    	});
    }
}

function setDirections(fromAddress){
	Ext.get('gmaps').setStyle('width', '450px');
	Ext.get('directions').setStyle('width', '190px');
	map.checkResize();
    gdir.load("from: " + fromAddress + " to: 63628 Bad Soden-Salmünster/Mernes, Salmünsterer Straße 15", {
        "locale": "de"
    });
    marker.closeInfoWindow();
}