var map1 = null; var boxList =[]; var j = 0; function initialize() { var mapOptions = { center: new google.maps.LatLng(51.10, 10.25), zoom: 6 }; map1 = new google.maps.Map(document.getElementById("map12"), mapOptions); globalAdress = 0; geocoder = new google.maps.Geocoder(); setQuestion(); // Create our "tiny" marker icon showStart('Deutschland', 6); showAll(); } google.maps.event.addDomListener(window, 'load', initialize); function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } function requestDataFilialen(params){ //Action Filialen xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } var url = 'ajax-request.php?action=getFilialen&'+params; xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4) { response = xmlhttp.responseText; document.getElementById('filialenContent').innerHTML = response; } } xmlhttp.open("GET",url,true); xmlhttp.send(null); /* new Ajax.Request('ajax-request.php?action=getFilialen&'+params, { method:'get', onSuccess: function(transport){ }, onFailure: function(){ alert('Something went wrong...') } }); */ } function addCoords(aplz,aort,aaddress, ahnr, atype){ var address = aplz; if (geocoder) { geocoder.getLatLng ( address, function(point) { if (!point) { } else{ var params = "xpos="+point.lat()+"&ypos="+point.lng()+"&type="+atype+"&nr="+ahnr; ajaxRequestPos(params); } } ); } } function ajaxRequestMail(params){ //Action Filialen xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } var url = 'ajax-request.php?action=sendMessage&'+params; xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4) { response = xmlhttp.responseText; alert(response); if( response.search(/erfolgreich.+/)){ document.getElementById('resetForm').click(); setQuestion(); } } } xmlhttp.open("GET",url,true); xmlhttp.send(null); /* new Ajax.Request('ajax-request.php?action=sendMessage&'+params, { method:'get', onSuccess: function(transport){ response = transport.responseText || "no response text"; alert(response); if( response.search(/erfolgreich.+/)){ document.getElementById('resetForm').click(); } }, onFailure: function(){ alert('Something went wrong...') } }); */ } function ajaxRequestPos(params){ //Action Filialen xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } var url = 'ajax-request.php?action=addPos&'+params; xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4) { response = transport.responseText || "no response text"; } } xmlhttp.open("GET",url,true); xmlhttp.send(null); /* new Ajax.Request('ajax-request.php?action=addPos&'+params, { method:'get', onSuccess: function(transport){ response = transport.responseText || "no response text"; }, onFailure: function(){ alert('Something went wrong...') } }); */ } function showStart(address, wideness) { map1.setCenter(new google.maps.LatLng(51.10, 10.25)); map1.setZoom(6); } function setTraderData(){ var response = requestDataFilialen("fNr="+globalF+"&type="+globalType+"&hNr="+globalH); } function setTrader(fId, hType, hId, hName, hAdress, hMail, hpartner){ globalAdress = 0; globalSend = 0; globalMail = ''; globalF = fId; globalH = hId; globalType = hType; if(hAdress){ globalAdress = hAdress; } if(hName){ globalName = hName; } if(hMail){ globalMail = hMail; } if(hpartner){ globalPartner = hpartner; } document.getElementById('kontaktFirma').innerHTML = hName; document.getElementById('routeFirma').innerHTML = hAdress; } function showRoute(){ //globalAdress closeAll(); map1.overlayMapTypes.setAt( 0, null); var routeAdress = 0; if(globalAdress){ routeAdress = globalAdress; } var startAdress = document.getElementById('startAdress').value; var startOrt = document.getElementById('startOrt').value; var startPlz = document.getElementById('startPlz').value; var message = ''; var bolError = 0; if(!startAdress){ message = "* Ihre Adresse \n"; bolError = 1; } if(!startOrt){ message += "* Ihr Ort \n"; bolError = 1; } if(!startPlz || isNaN(startPlz)){ message += "* Ihre Postleitzahl \n"; bolError = 1; } if(!routeAdress){ message += "* Ihr Zielort \n"; bolError = 1; } var start = startPlz+" "+startOrt+" routeAdress"; if(!bolError || startOrt){ document.getElementById('routeInformation').innerHTML = ''; if ( typeof directionsDisplay != 'undefined' ){ directionsDisplay.setMap(null); } var directionsService = new google.maps.DirectionsService(); directionsDisplay = new google.maps.DirectionsRenderer(); directionsDisplay.setMap(map1); directionsDisplay.setPanel(document.getElementById('routeInformation')); var request = { origin:start, destination:routeAdress, travelMode: google.maps.TravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } }); if(document.getElementById('routeInformation').innerHTML == ''){ // alert("Keine Routeninformationen zu dieser Adresse verfügbar. Prüfen Sie noch einmal ihre Eingaben!"); } } else{ alert('Folgende Felder wurden nicht korrekt ausgefüllt: \n'+ message); } window.location= '#standort'; } function handleErrors() { alert('Die Adresse konnte nicht gefunden werden. Vermeiden Sie Hausnummerangaben die einen Buchstaben enthalten. Verwenden Sie stattdessen nur den Ziffernwert.'); /* if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS) alert("Unknown Adress"); else if (gdir.getStatus().code == G_GEO_SERVER_ERROR) alert("A geocoding or directions request could not be successfully"); else if (gdir.getStatus().code == G_GEO_MISSING_QUERY) alert("The HTTP q parameter was either missing or had no value."); else if (gdir.getStatus().code == G_GEO_BAD_KEY) alert("The given key is either invalid or does not match the domain" + gdir.getStatus().code); else if (gdir.getStatus().code == G_GEO_BAD_REQUEST) alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code); else alert("An unknown error occurred on Map."+G_GEO_UNKNOWN_ADDRESS); */ } function setQuestion(){ var a = Math.ceil(Math.random() * 10); var b = Math.ceil(Math.random() * 10); globalAnswer = a + b; var question = "Wieviel ist "+ a + " + " + b +"? "; document.getElementById("codeQuestion").innerHTML = question; } function sendMessage(){ var kontaktName = document.getElementById('kontaktName').value; var kontaktTel = document.getElementById('kontaktTel').value; var kontaktMail = document.getElementById('kontaktMail').value; var kontaktMessage = document.getElementById('kontaktMessage').value; var kontaktCode = document.getElementById('kontaktCode').value; var rTel = document.getElementById('rTel').checked; var rFax = document.getElementById('rFax').checked; var rMail = document.getElementById('rMail').checked var answerType = ''; var adressMail = globalMail; //var adressMail = "simon.pickert@gmx.de"; var message = ""; var bolError = 0; if(!kontaktName){ bolError = 1; message += '* Ihre Name \n'; } if(!kontaktMail){ bolError = 1; message += '* Ihre E-Mail Adresse \n'; } if(!kontaktMessage){ bolError = 1; message += '* Ihre Nachricht \n'; } if(!rTel && !rFax && !rMail){ bolError = 1; message += '* Ihre Antwortvariante \n'; } else { if(rTel){ answerType = 'Telefon'; } if(rFax){ answerType = 'Fax'; } if(rMail){ answerType = 'E-Mail'; } } if(kontaktCode != globalAnswer){ bolError = 1; message += '* Ihr Sicherheitscode \n'; setQuestion(); } if(!bolError){ if(kontaktTel){ var answerTel = "&tel="+kontaktTel; } if(globalSend != 'send'){ ajaxRequestMail("name="+kontaktName+"&mail="+kontaktMail+"&hpartner="+globalPartner+"&message="+kontaktMessage+"&answer="+answerType+"&hname="+globalName+"&globalH="+globalH+"&adressMail="+adressMail+answerTel); globalSend = 'send'; } else{ alert("Sie haben bereits eine Nachricht an diesen Händler gesendet."); } } else{ alert("Folgende Felder müssen noch richtig ausgefüllt werden: \n"+message); } } function setMarker(address, wideness, arrData, show) { var htmlString = "