var background;
var fenster_breite;
var fenster_hoehe;
var aspect_ratio_background;
var aspect_ratio_fenster;

// Hintergrund ans Fenster anpassen
function start() {
	background = document.getElementById("background");
	background.style.minWidth = "1px";
	background.style.minHeight = "1px";
	background_fit();
}
function background_fit() {
	if (window.innerHeight) {
		fenster_breite = window.innerWidth;
		fenster_hoehe = window.innerHeight;
	} else if (document.body) { // für IE7
		fenster_breite = document.body.offsetWidth;
		fenster_hoehe = document.body.offsetHeight;
	}
	aspect_ratio_background = background.width/background.height;
	aspect_ratio_fenster = fenster_breite/fenster_hoehe;
	if (aspect_ratio_background >= aspect_ratio_fenster) {
		background.style.width = "auto";
		background.style.height = "100%";
	} else {
		background.style.width = "100%";
		background.style.height = "auto";
	}
	background_mittig_setzen();
}

// Hintergrund mittig setzen
function background_mittig_setzen() {
	background.style.left = "50%";
	background.style.marginLeft = -(background.width/2)+"px";
	background.style.top = "50%";
	background.style.marginTop = -(background.height/2)+"px";
}

// Event-Listener setzen
if (window.addEventListener) {
	window.addEventListener("load", start, false);
	window.addEventListener("resize", background_fit, false);
} else if (window.attachEvent) { // für IE7
	window.attachEvent("onload", start);
	window.attachEvent("onresize", background_fit);
}
// Popups
function popup(dest) {
        window.open(dest+".html",'federico_popup','scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,fullscreen=0,width=400,height=500,top=100,left=100')
}