function encodeEmail(text, email, host, domain){
	var email, host, domain;
	document.write('<a href="mailto:'+email+'&#64;'+host+'&#46;'+domain+'">&rsaquo; '+text+'</a>');
}

function check(form){
	var vNameChk = /^[a-zA-zß-ü][^0-9][^ .,;!?]/;
	var nNameChk = /^[a-zA-zß-ü][^0-9][^ .,;!?]/;
	var emailChk = /^([a-zA-Z0-9_\.?\-?])+\@{1}(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var betreffChk = /(^[a-zA-z0-9ß-ü.,;!?]+)/;
	var nachrichtChk = /(^[a-zA-z0-9ß-ü.,;!?]+)/;
	
	if(!vNameChk.test(form.vName.value)||!nNameChk.test(form.nName.value)||!emailChk.test(form.email.value)||!betreffChk.test(form.betreff.value)||!nachrichtChk.test(form.nachricht.value)){
		alert("Bitte Überprüfen Sie Ihre Eingaben.");
		if(!vNameChk.test(form.vName.value)){
			form.vName.style.backgroundColor="grey";
		}
		if(!nNameChk.test(form.nName.value)){
			form.nName.style.backgroundColor="grey";
		}
		if(!emailChk.test(form.email.value)){
			form.email.style.backgroundColor="grey";
		}
		if(!betreffChk.test(form.betreff.value)){
			form.betreff.style.backgroundColor="grey";
		}
		if(!nachrichtChk.test(form.nachricht.value)){
			form.nachricht.style.backgroundColor="grey";
		}
		return false;
	} else{
		return true;
	}
	
}

function subnav(tag, id, zustand){
	if(zustand == 'on'){
		document.getElementById(id).style.display = 'block';
		if(document.getElementById(tag).className != 'active'){
			document.getElementById(tag).className = 'activeSub';
		} else {document.getElementById(id).style.width = '184px';}
	} else {
		document.getElementById(id).style.display = 'none';
		if(document.getElementById(tag).className != 'active'){
			document.getElementById(tag).className = '';
		}
	}
}

function clearSub(id){
	document.getElementById(id).style.display = 'none';
}

var map = null;
var geocoder = null;

function initialize() {
  if (GBrowserIsCompatible()) {
	map = new GMap2(document.getElementById("map"));
	map.setCenter(new GLatLng(50.203715, 8.575339, 18));
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	map.addControl(new GScaleControl());
	map.addControl(new GOverviewMapControl());
	geocoder = new GClientGeocoder();
	showAddress("An der Herrenmühle 7, 61440 Oberursel");
  }
}

function showAddress(address) {
  if (geocoder) {
	geocoder.getLatLng(
	  address,
	  function(point) {
		if (!point) {
		  alert(address + " nicht gefunden");
		} else {
		  map.setCenter(point, 13);
		  var marker = new GMarker(point);
		  map.addOverlay(marker);
		  marker.openInfoWindowHtml('<br /><a href="http://www.mondeor.de" target="_blank">Mondeor Capital GmbH & Co. KG.</a><p>An der Herrenmühle 7</p><p>61440 Oberursel</p>');
		  
		  GEvent.addListener(map, "click", function(markersetzen, point) {
			map.clearOverlays();
			marker = new GMarker(point);
			map.addOverlay(marker);
			marker.openInfoWindowHtml('<br /><a href="http://www.mondeor.de" target="_blank">Mondeor Capital GmbH & Co. KG.</a><p>An der Herrenmühle 7</p><p>61440 Oberursel</p>');
		  });
		}
	  }
	);
  }
}
