var map = null;
var geocoder = null;
var destination = null;
var overview = false;
var zoom = null;

function doOnload() {
	var temp = destination.split("|");
	destination = temp[0];
	zoom = temp[1]-1;
	if (destination == "overview") {
		overview = true;
	}
	
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map"),G_SATELLITE_MAP);
		map.addControl(new GSmallZoomControl());
		map.addControl(new GMapTypeControl());
		//map.addControl(new GMapTypeControl());
		if (!overview) {
			geocoder = new GClientGeocoder();
			
			if (geocoder) {
				geocoder.getLatLng(
					destination, 
					function(point) {
						if (point) {
						  map.setCenter(point, parseInt(zoom));
						  map.setMapType(G_NORMAL_MAP);
						}
					}
				);
			}
		} else {
			// Übersichtskarte anzeigen
			map.setCenter(new GLatLng(22.4419, -38.1419),1);
			map.setMapType(G_SATELLITE_MAP);			
		}
	}
}

function addParams() {
	if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName('a');

var counter = 0;

for (var i=0; i<anchors.length; i++) {
      var anchor = anchors[i];
      if (anchor.href.indexOf('#') >= 1 || 
      		anchor.getAttribute('href') == null ||
      		anchor.href.indexOf('et_cid=4&et_lid=59268') >= 1) continue;
      if (anchor.href.indexOf('?') == -1) {
      	anchor.href = anchor.getAttribute('href')+'?et_cid=4&et_lid=59268&et_sub='+encodeURI(filename);
      	counter++;
      }
      else {
      	anchor.href = anchor.getAttribute('href')+'&et_cid=4&et_lid=59268&et_sub='+encodeURI(filename);
      	counter++;
      }
    }
//alert(counter+" Links erweitert");
}
