var icon = new GIcon(); icon.image = 'http://google.webassist.com/google/markers/flag/yosemite.png'; icon.shadow = 'http://google.webassist.com/google/markers/flag/shadow.png'; icon.iconSize = new GSize(31,35); icon.shadowSize = new GSize(31,35); icon.iconAnchor = new GPoint(4,27); icon.infoWindowAnchor = new GPoint(8,3); icon.printImage = 'http://google.webassist.com/google/markers/flag/yosemite.gif'; icon.mozPrintImage = 'http://google.webassist.com/google/markers/flag/yosemite_mozprint.png'; icon.printShadow = 'http://google.webassist.com/google/markers/flag/shadow.gif'; icon.transparent = 'http://google.webassist.com/google/markers/flag/yosemite_transparent.png'; var map; var marker; var gdir; var geocoder = null; var points = []; var gmarkers = []; var locations = new Array( { 'coordinates' : '50.820985, 8.747917', 'street' : 'Emil-von-Behring-Straße 76', 'zip' : '35041', 'city' : 'Marburg', 'info' : 'Standort Behringwerke Marburg
Hauptwerk

Emil-von-Behring-Straße 76
35041 Marburg
GPS: 50° 49' 15" N 8° 44' 49" E' }, { 'coordinates' : '50.830620, 8.716680', 'street' : 'Görzhäuser Hof', 'zip' : '35041', 'city' : 'Marburg', 'info' : 'Standort Behringwerke
Werksteil Görzhausen

Görzhäuser Hof
35041 Marburg
GPS: 50° 49' 51" N 8° 43' 1" E' }, { 'coordinates' : '50.830620, 8.716680', 'street' : 'Görzhäuser Hof', 'zip' : '35041', 'city' : 'Marburg', 'info' : 'Standort Behringwerke
Zentrales Warenlager

Görzhäuser Hof
35041 Marburg
GPS: 50° 49' 51" N 8° 43' 1" E' } ); function initLocation(index) { loc = locations[index] || locations[0]; $('#toStreet').attr("value", loc['street']); $('#toZipcode').attr("value", loc['zip']); $('#toCity').attr("value", loc['city']); $('#toCoord').attr("value", loc['coordinates']); } function initMap(index) { loc = locations[index] || locations[0]; if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map_canvas")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); geocoder = new GClientGeocoder(); geocoder.getLatLng ( loc['coordinates'], function(point) { if(point) { map.setCenter(point, 14); marker = new GMarker(point, icon); GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(loc['info']); }); map.addOverlay(marker); marker.openInfoWindowHtml(loc['info']); } else { map.setCenter(new GLatLng(50.820985, 8.747917), 14); } } ); gdir = new GDirections(map, document.getElementById('directions')); GEvent.addListener(gdir, "load", onGDirectionsLoad); GEvent.addListener(gdir, "error", handleErrors); } } function setDirections(fromAddress, toAddress, locale) { direction = "from: " + fromAddress; if($('#bytruck').is(':checked')) direction += " to: @50.858790, 8.695580"; direction += " to: " + toAddress; gdir.load(direction, { "locale": locale } ); } function handleErrors(){ if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS) $('#directions').html('

Die Angegebene Startadresse wurde nicht gefunden. Bitte überprüfen Sie Ihre Angaben.

'); else if (gdir.getStatus().code == G_GEO_SERVER_ERROR) $('#directions').html('

Es ist ein interner Fehler aufgetreten, bitte versuchen Sie es später erneut.

'); else if (gdir.getStatus().code == G_GEO_BAD_KEY) $('#directions').html('

Es wurde ein falscher API-Key hinterlegt! Die Funktion kann daher nicht korrekt ausgeführt werden.

'); else $('#directions').html('

Es ist ein unbekannter Fehler aufgetreten.

'); } function onGDirectionsLoad(){ marker.closeInfoWindow(); marker.hide(); map.removeOverlay(marker); } jQuery(document).ready(function() { $('#location_plan').hide(); initLocation(getByTruck ? 2 : 0); initMap(getByTruck ? 2 : 0); $('#locations input').change(function(){ value = $(this).attr("value"); initLocation($('#bytruck').is(':checked') ? 2 : value); if($('#fromStreet').attr("value") && $('#fromZipcode').attr("value") && $('#fromCity').attr("value")) $('#direction_form').submit(); else initMap($('#bytruck').is(':checked') ? 2 : value); }); $('#arrival_bytrucks input').change(function(){ $("#locations input:last").trigger('click').trigger('change'); var disable = (this.checked) ? true : false; $("#locations input").each(function() { this.disabled = disable; }); if($('#fromStreet').attr("value") && $('#fromZipcode').attr("value") && $('#fromCity').attr("value")) $('#direction_form').submit(); }); if (getByTruck) $('#arrival_bytrucks input').trigger('click').trigger('change'); $('#direction_form').submit(function(){ $('#directions').html(''); $('#location_plan').show(); from = ""; if($('#fromStreet').attr('value')) from += $('#fromStreet').attr('value') + ","; if($('#fromZipcode').attr('value')) from += $('#fromZipcode').attr('value') + ","; if($('#fromCity').attr('value')) from += $('#fromCity').attr('value'); to = $('#toCoord').attr("value"); setDirections(from, to, 'de'); return false; }); $('#print a').click(function(){ loc = $('#locations input:checked').attr("value"); href = $(this).attr("href"); href += '?TB_iframe=true&height=500&width=750'; href += '&location=' + loc; href += '&fromStreet=' + escape($('#fromStreet').attr("value")); href += '&fromZipcode=' + escape($('#fromZipcode').attr("value")); href += '&fromCity=' + escape($('#fromCity').attr("value")); href += '&bytruck=' + $('#bytruck').is(':checked'); if ($.browser.opera) { window.open(href, "Wegbeschreibung", "width=780,height=500,status=no,scrollbars=yes,resizable=no"); return false; } tb_show('Wegbeschreibung', href, false); this.blur(); $('#TB_closeWindowButton').html(''); $('#TB_closeAjaxWindow').prepend(''); return false; }); }); window.onunload = function() { GUnload(); }