var SysFun={poGeoCoder:null,poDirections:null,getAddress:function(){poGeoCoder=new google.maps.Geocoder();poDirections=new google.maps.DirectionsService();var lcZipcode=document.getElementById("anv_postcd").value+"+Nederland";lcZipcode=lcZipcode.replace(" ","");poGeoCoder.geocode({'address':lcZipcode},SysFun._onGetCoordinates);poDirections.route({origin:lcZipcode+"+Nederland",destination:lcZipcode+"+Nederland",region:"GB",travelMode:google.maps.DirectionsTravelMode.DRIVING},SysFun._onGetDirections);},checkCaptcha:function(lcURL){llOke=false;lcSCID=document.getElementById("scid").value;new Ajax.Request(lcURL+"&lcSCID="+lcSCID,{method:"get",asynchronous:false,onSuccess:function(loResponse){lcResponse=loResponse.responseText;if(lcResponse=="1"){llOke=true;}else{handleError("scid","Geheime code","bevat niet de juiste geheime code.");}},onFailure:function(){alert('Er is een probleem opgetreden, neem contact op met Pioen Partners.');}});return llOke;},_onGetCoordinates:function(loResults,loStatus){if(loStatus==google.maps.GeocoderStatus.OK){var laLatLng=loResults[0].geometry.location;poGeoCoder.geocode({'latLng':laLatLng},SysFun._onGetCity);}},_onGetCity:function(loResults,loStatus){if(loStatus==google.maps.GeocoderStatus.OK){var lcCity=loResults[0].address_components[1].short_name;if(document.getElementById("anv_plaats")!=null){document.getElementById("anv_plaats").value=lcCity;}}},_onGetDirections:function(loResults,loStatus){if(loStatus==google.maps.DirectionsStatus.OK){var lcInstructions=loResults.routes[0].legs[0].steps[0].instructions;lcInstructions=lcInstructions.substr(lcInstructions.indexOf("op de <b>")+9);lcInstructions=lcInstructions.substr(0,lcInstructions.indexOf("</b>"));if(document.getElementById("anv_adres")!=null){document.getElementById("anv_adres").value=lcInstructions;}}}};
