/* Set background properties */
function setBackground(){
	var browserwidth = $(window).width();
	var browserheight = $(window).height();	
	// set Height on #content (subtract 30px for top menu and 30px for footer menu)
	$("#content").css({ 'min-height' : browserheight-30-30});
	var contentHeight = $("#content").height();
	$("#wrapper").css({ 'height' : browserheight});	
	$("#bgwrapper").css({ 'height' : browserheight});
	$("#container").css({ 'height' : browserheight});	
}


/* google maps */

function LoadMap()
{	if (GBrowserIsCompatible())
	{	var map = new GMap2(document.getElementById("karte"));
		map.setCenter(new GLatLng(48.76369, 8.23765), 16, G_NORMAL_MAP);
		var customUI = map.getDefaultUI();
		map.setUI(customUI);
		marker = new GMarker(new GLatLng(48.76369, 8.23765));
		map.addOverlay(marker);
		marker.openRouteInfoWindow = getRouteInfoWindow;
		marker.openRouteInfoWindow_targetName = "Lange Str. 43, 76530 Baden-Baden";
		marker.openRouteInfoWindow_html = 'SKYWALKER<br/>Lange Str. 43, 76530 Baden-Baden';
		marker.openRouteInfoWindow();
		var htmlInfoWindow = 'SKYWALKER';
		marker.openRouteInfoWindow(htmlInfoWindow);
		GEvent.addListener(marker, "click", function()
		{	marker.openRouteInfoWindow();
		});
	}
}


function getRouteInfoWindow(sAction) {	
	var LatLong = this.getLatLng();
	var aDisplay = ["block", "none", "none"];
	if (sAction == "to") aDisplay = ["none", "block", "none"];

	var sTargetName = this.openRouteInfoWindow_targetName;
	var sHtml = this.openRouteInfoWindow_html;
	
	// Info Window: Route
	sHtml +=	'<div style="display:'+aDisplay[0]+';">' +
				'<a href="javascript:ShowRoute(\'to\');">Route berechnen</a></div>';

	// Info Window: Hierher
	sHtml += 	'<div style="display:'+aDisplay[1]+';">' +
				'<br />Startadresse:<form action="http://maps.google.com/maps" method="get" target="_blank">' +
				'<input type="text" SIZE=30 MAXLENGTH=40 name="saddr" id="saddr" value="" /><br />' +
				'<input value="OK" TYPE="SUBMIT">';
	if (sTargetName != "")
			sHtml += '<input type="hidden" name="daddr" value="'+sTargetName+'" />';
	else	sHtml += '<input type="hidden" name="daddr" value="'+LatLong.lat()+','+LatLong.lng()+'" />';
	sHtml +=  '</form></div>';

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


function ShowRoute(sAction) {	
	marker.openRouteInfoWindow(sAction);
}


function loadPage(action, pid, track_id, name){
	piwikTracker.trackPageView(track_id);
	piwikTracker.enableLinkTracking();
	document.title = "SKYWALKER - " + name; 
	$('#loader').css("visibility", "visible");
	$("#content_gallery_external").load(
		path + action + "/showpage",
		{
			id: pid
		},
		function (responseText, textStatus, XMLHttpRequest){
			$('#loader').css("visibility", "hidden");
		}
	);
}

