/**
*	JS - 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;
	// Definitionen
	popup_url = '/geodaten/search.php?ID_COUNTRY=&LOCATION='+location_headline+'&TIMEZONE_DATE='+timezone_date+'&SEARCH_METHOD=like&RADIX_PREFIX='+radix_prefix;
	popup = window.open(popup_url, 'popup_geodaten', 'width=775, height=550, top=10, left=25, resizable=yes, scrollbars=yes, menubar=yes, location=yes, status=yes');
	popup.focus();
}	// of function


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

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

