
function popUp(file,width,height) {

	height = parseInt(height);
	width = parseInt(width);
	popup = window.open('/popup.php?f='+file,'popup','width='+width+',height='+height);
}

function setStatus(str) {
	window.status = str;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function createOverlay(){
 if(navigator.appName == "Microsoft Internet Explorer"){
	var x = document.all.body.offsetWidth;
	var y = document.all.body.offsetHeight;
        document.getElementById('flashBox_background').style.width = x;
	document.getElementById('flashBox_background').style.height = y;
}
	document.getElementById('flashBox_background').style.visibility = 'visible';
        document.getElementById('flashHome').style.visibility = 'hidden';

}

function removeOverlay(){
/*	document.getElementById('flashBox_background').style.visibility = 'hidden';
        document.getElementById('flashHome').style.visibility = 'visible';
*/


	document.getElementById('flashHome').style.visibility = 'visible';
	var obj = document.getElementById('flashBox_background');
	//obj.style.removeAttribute("flashvars", false);
	obj.style.visibility = 'hidden';
}

var smap;

function createMap(){
	smap = new 
	GMap2(document.getElementById("map_canvas"));
	sgeocoder = new GClientGeocoder();         
	sgeocoder.getLocations('Carl-Metz-Str. 9, 76185 Karlsruhe, Deutschland', addAddressToMap);
	

	smap.addControl(new GSmallMapControl());

}

function addAddressToMap(response){
	place = response.Placemark[0];
	point = new GLatLng(place.Point.coordinates[1], 
	place.Point.coordinates[0]);
	
	var marker = new GMarker(point);
	smap.addOverlay(marker);
	smap.setCenter(new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]), 13);


	// Infofenster mit Routenberechnung
	marker.openRouteInfoWindow = getRouteInfoWindow;
	// Hier die Adresse des Markers eintragen
	marker.openRouteInfoWindow_targetName = "Carl-Metz-Str. 9, 76185 Karlsruhe, Deutschland";
	// Hier HTML eintragen, das oben im InfoFenster erscheinen soll.
	marker.openRouteInfoWindow_html = '<h3 style="margin-top:0px;">Metz Aerials GmbH & Co. KG</h3><br />Carl-Metz-Str. 9, <br />76185 Karlsruhe<br/><br/>';
	// Infofenster öffnen
	marker.openRouteInfoWindow();
	// Nach einem Klick auf Schließen kann man das Infofenster mit einem Klick auf den Marker wieder öffnen
	GEvent.addListener(marker, "click", function()
	{	
		marker.openRouteInfoWindow();
	});
		smap.checkResize();
			
}


function getRouteInfoWindow(sAction) 
{	// this ist marker	
	var LatLong = this.getLatLng();

	var aDisplay = ["block", "none", "none"];
	if (sAction == "to") aDisplay = ["none", "block", "none"];
	else if (sAction == "from") aDisplay = ["none", "none", "block"];

	var sTargetName = this.openRouteInfoWindow_targetName;
	var sHtml = this.openRouteInfoWindow_html;
	// Info Window: Route
	sHtml +=	'<div style="display:'+aDisplay[0]+';">' +
				'<a href="http://maps.google.at/maps?f=d&source=s_d&saddr=&daddr=Carl-Metz-Str.+9,+76185+Karlsruhe,+Deutschland&geocode=&hl=de&mra=ls&sll=49.01118,8.3513&sspn=0.007319,0.021136&ie=UTF8&z=16" target="_blank">Route</a> ' +
				'</div>';
 

	this.closeInfoWindow();	
	this.openInfoWindow(sHtml);
}




		
