Witam, prowadzę portal na skrypcie Joomla oraz mam zainstalowany Sobi2. W tym rozszerzeniu jest funkcja rozpoznania współrzędnych miejsca (pobieranych z pól "ulica", "miasto", "kod pocztowy" itd...) przy pomocy API google, np: http://maps.google.com/maps/geo?q=warszawa...=getCoordinates

Kiedy klikam przycisk "Pobierz współrzędne" powinien zadziałać skrypt:
  1. <script type="text/javascript" language="JavaScript">
  2.  
  3. /* adjust here the field names if they are not correct */
  4.  
  5. var apiKey = "";
  6.  
  7. var postalCodeField = 'field_kodpocztowy';
  8.  
  9. var cityField = 'field_miasto';
  10.  
  11. var streetField = 'field_ulica';
  12.  
  13. var countryField = 'field_kraj';
  14.  
  15. var latitudeField = 'field_latitude';
  16.  
  17. var longitudeField = 'field_longitude';
  18.  
  19.  
  20.  
  21. function fetchCoordinates() {
  22.  
  23. /* here you should not change anything */
  24.  
  25. var gRequest = null;
  26.  
  27. var postalcode = document.getElementById(postalCodeField).value;
  28.  
  29. var city = document.getElementById(cityField).value;
  30.  
  31. var street = document.getElementById(streetField).value;
  32.  
  33. var country = document.getElementById(countryField).value;
  34.  
  35.  
  36.  
  37. if(postalcode == '' || city == '' || street == '' || country == '' ) {
  38.  
  39. /* you can change the error message here */
  40.  
  41. alert("Please fill in the address fields first");
  42.  
  43. }
  44.  
  45. else {
  46.  
  47. var gRequest = "http://maps.google.com/maps/geo?q=" +street+ "+" +postalcode+ "+" +city+ "+" +country+ "&output=json&key="+apiKey+"&callback=getCoordinates";
  48.  
  49. var scriptObj = document.createElement("script");
  50.  
  51. scriptObj.setAttribute("type", "text/javascript");
  52.  
  53. scriptObj.setAttribute("src", gRequest);
  54.  
  55. document.getElementsByTagName("head").item(0).appendChild(scriptObj);
  56.  
  57. }
  58.  
  59. }
  60.  
  61. function getCoordinates(data) {
  62.  
  63. switch(data.Status.code) {
  64.  
  65. case 610:
  66.  
  67. /* you can change the error message here */
  68.  
  69. alert("Api key not valid: ");
  70.  
  71. break;
  72.  
  73. case 603:
  74.  
  75. case 602:
  76.  
  77. case 601:
  78.  
  79. case 500:
  80.  
  81. /* you can change the error message here */
  82.  
  83. alert("Cannot get coordinates for this address");
  84.  
  85. break;
  86.  
  87. case 200:
  88.  
  89. document.getElementById(latitudeField).value = data.Placemark[0].Point.coordinates[1];
  90.  
  91. document.getElementById(longitudeField).value = data.Placemark[0].Point.coordinates[0];
  92.  
  93. break;
  94.  
  95. }
  96.  
  97. }
  98.  


Dane pobierane są prawidłowo, (w konsoli błędów w chrome wyświetla się prawidłowy adres do API z wstawionymi danymi), ale konsola chrome wyświetla błąd:
http://scr.hu/277/y6vmx (ostatnie kilka błędów). Klikając w błąd wyświetlają się szczegóły: http://scr.hu/277/fg4gs
Dane z API nie są wpisywane w pola poniżej, w które wpisuje się koordynaty (które później są potrzebne do wyświetlenia mapki)

Gdzie jest błąd w skrypcie? Skrypt działał i przestał działać, czy to google zmieniło swoje API? Proszę o pomoc,