function ajaxRequest(URL,callback){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			document.getElementById(callback).innerHTML = ajaxRequest.responseText;
		}
	}
	ajaxRequest.open("POST", URL, true);
	ajaxRequest.send(null); 
}

	
function changeConfig(name,wert,SID)
{
	new Ajax.Request('ajax_action.php', {
		method: 'POST',
		parameters: 'changeConfig=1&sid=' + SID + '&name=' + name + '&wert=' + wert,
		onSuccess: function(transport) {
			t = transport.responseText.evalJSON();
			feedback(t[1],t[0]);
		},
		onFailure: function() { feedback('Es gab einen Fehler bei der Verarbeitung.',1); }
	});
}




function initializeGmap(divname, address, gmapszoom, gmapTypeId, gmapTypeControl, gmapTypeControlStyle, gmapNavigationControl, gmapNavigationControlStyle) {
	var map;
	var geocoder;
	var marker;
	 var myLatLng = new google.maps.LatLng(45,10);
	 geocoder = new google.maps.Geocoder();
	 var myOptions = {
		zoom: gmapszoom,
		center: myLatLng,
		mapTypeId: gmapTypeId,
		mapTypeControl: gmapTypeControl,
		mapTypeControlOptions: {  
			style: gmapTypeControlStyle  
		},
		navigationControl: gmapNavigationControl,
		navigationControlOptions: {  
			style: gmapNavigationControlStyle
		}  
	 }
	 map = new google.maps.Map(document.getElementById(divname), myOptions);

	geocoder.geocode( { 'address': address}, function(results, status) {
	if (status == google.maps.GeocoderStatus.OK) {
	  map.setCenter(results[0].geometry.location);
	  var marker = new google.maps.Marker({
		  map: map, 
		  position: results[0].geometry.location,
		  draggable:true
	  });
		google.maps.event.addListener(marker, "dragend", function(latlng) {
		 location.href= marker.position;
		 });
	} else {
	  alert("Google maps konnte nicht korrekt geladen werdenm. Fehler: " + status);
	}
  });
}
