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 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 werden. Fehler: " + status);
	}
  });
}



function doM(s, shift) {
        location.href="mailto:" + getM(s, shift);
} 

function getM(s, shift)
{
        shift = shift;
        var n=0;
        var r="";
        for(var i=0;i<s.length;i++) {
               n=s.charCodeAt(i);
               if (n>=8364) {n = 128;}
               r += String.fromCharCode(n-(shift));
        }
        return r;
}

function showM(s, shift, d)    {
        var d;
        if (d) { d = d; } else { d = s; }
        document.write("<a href=\"javascript:doM('" + s + "', " + shift + ");\">" + getM(d,shift) + "</a>");      
}

function printM(s, shift)
{
        document.write(getM(s,shift));
}

