/**
*   Funktionen fuer die Geodaten Abfrage.
*/


/** Oeffnet ein PopUp, sucht nach dem uebergebenen Ortsnamen und liefert eine Auswahlliste von Orten.
*
*   @param string location_name     Name des Ortes aus dem Formular
*/
function geodaten_popup(location_headline, timezone_date, radix_prefix) {
    var popup;
    var popup_url;

    // WWWDEV
//  popup_url = 'http://hose-engine20.isis.ske/geodaten/search.php?LOCATION_HEADLINE='+location_headline+'&TIMEZONE_DATE='+timezone_date+'&RADIX_PREFIX='+radix_prefix;
    // ONLINE
    popup_url = 'http://engine20.horoskopserver.de/geodaten/search.php?LOCATION_HEADLINE='+location_headline+'&TIMEZONE_DATE='+timezone_date+'&RADIX_PREFIX='+radix_prefix;
    popup = window.open(popup_url, 'popup_geodaten', 'width=600, height=400, top=200, left=200, resizable=yes, scrollbars=yes, menubar=yes, locationbar=yes, status=yes');
    popup.focus();

}   // of function


/** Sendet die Daten des selektieren Eintrags an das aufrufende Formular zurueck.
*/
function geodaten_r1_data2form() {
    var idx_select;
//alert(document.geodaten.ID_LOCATION.length);
    cnt_location = document.geodaten.ID_LOCATION.length;
    if (cnt_location) {
        for (i=0;i<cnt_location;i++) {
            if (document.geodaten.ID_LOCATION[i].checked == true) {
                opener.document.horoskop.R1_LOCATION.value = eval("document.geodaten.HEADLINE_"+i+".value");
                opener.document.horoskop.R1_LAT.value = eval("document.geodaten.LATITUDE_"+i+".value");
                opener.document.horoskop.R1_LON.value = eval("document.geodaten.LONGITUDE_"+i+".value");
                opener.document.horoskop.R1_TIME_DIFF_GMT.value = eval("document.geodaten.TIMEZONE_VALUE_"+i+".value");
            }
        }   // of for i
    } else {
        i = 0;
        opener.document.horoskop.R1_LOCATION.value = eval("document.geodaten.HEADLINE_"+i+".value");
        opener.document.horoskop.R1_LAT.value = eval("document.geodaten.LATITUDE_"+i+".value");
        opener.document.horoskop.R1_LON.value = eval("document.geodaten.LONGITUDE_"+i+".value");
        opener.document.horoskop.R1_TIME_DIFF_GMT.value = eval("document.geodaten.TIMEZONE_VALUE_"+i+".value");
    }
    self.close();
}   // of function


/** Sendet die Daten des selektieren Eintrags an das aufrufende Formular zurueck.
*/
function geodaten_r2_data2form() {
    var idx_select;
//alert(document.geodaten.ID_LOCATION.length);
    cnt_location = document.geodaten.ID_LOCATION.length;
    if (cnt_location) {
        for (i=0;i<cnt_location;i++) {
            if (document.geodaten.ID_LOCATION[i].checked == true) {
                opener.document.horoskop.R2_LOCATION.value = eval("document.geodaten.HEADLINE_"+i+".value");
                opener.document.horoskop.R2_LAT.value = eval("document.geodaten.LATITUDE_"+i+".value");
                opener.document.horoskop.R2_LON.value = eval("document.geodaten.LONGITUDE_"+i+".value");
                opener.document.horoskop.R2_TIME_DIFF_GMT.value = eval("document.geodaten.TIMEZONE_VALUE_"+i+".value");
            }
        }   // of for i
    } else {
        i = 0;
        opener.document.horoskop.R2_LOCATION.value = eval("document.geodaten.HEADLINE_"+i+".value");
        opener.document.horoskop.R2_LAT.value = eval("document.geodaten.LATITUDE_"+i+".value");
        opener.document.horoskop.R2_LON.value = eval("document.geodaten.LONGITUDE_"+i+".value");
        opener.document.horoskop.R2_TIME_DIFF_GMT.value = eval("document.geodaten.TIMEZONE_VALUE_"+i+".value");
    }
    self.close();
}   // of function

