

function init(images) {
	
	startSWFObject(images);
	
	resizeFlashBackground();
	
	/* Überwachung von Netscape initialisieren */
	if (!window.Weite && window.innerWidth) {
	  window.onresize = neuAufbau;
	  Weite = Fensterweite();
	  Hoehe = Fensterhoehe();
	}

	/* Überwachung von Internet Explorer initialisieren */
	if (!window.Weite && document.body && document.body.offsetWidth) {
	  window.onresize = neuAufbau;
	  Weite = Fensterweite();
	  Hoehe = Fensterhoehe();
	}
}

function startSWFObject(images){
	for (i=0; i<images.length+i; i++) {
		a = Math.round(Math.random()*images.length);
		if ((a >= 0) && (a < images.length)) {
			image = images[a];
			backgroundimage = image;
			break;
		}
	}

	var params = {
		quality: 'high',
		wmode: 'transparent',
		scale: 'scale',
		allowScriptAccess: 'sameDomain'
	};
	var flashvars = {
		imagePath : backgroundimage
	};
	
	var playerVersion = swfobject.getFlashPlayerVersion();
	
	var display_on_linux = true;
	var platform = navigator.platform;
	if ((platform.indexOf("Linux") != -1) || (platform.indexOf("Safari") != -1)) {
		var display_on_linux = false;
	}
	
	if (playerVersion.major >= 9 && display_on_linux) {
		document.getElementById("background").style.background = 'none';
		swfobject.embedSWF("fileadmin/swf/background.swf", "backgroundFlash", "100%", "100%", "9.0.0","expressInstall.swf", flashvars, params);
		
	}
	else {
		document.getElementById("background").style.background = 'url(' + backgroundimage + ') center top no-repeat';
	}
}

function Fensterweite () {
	  if (window.innerWidth) {
	    return window.innerWidth;
	  } else if (document.body && document.body.offsetWidth) {
	    return document.body.offsetWidth;
	  } else {
	    return 0;
	  }
}

function Fensterhoehe () {
	  if (window.innerHeight) {
	    return window.innerHeight;
	  } else if (document.body && document.body.offsetHeight) {
	    return document.body.offsetHeight;
	  } else {
	    return 0;
	  }
}

function neuAufbau () {
	  if (Weite != Fensterweite() || Hoehe != Fensterhoehe())
		  resizeFlashBackground();
}


function GetWindowSize() {
	/*
    var width = document.getElementById("sitecontainer").offsetWidth;
    var height = document.getElementById("sitecontainer").offsetHeight;
        
    w = window;
    var width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
    var height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
*/
	w = window;
	var width = document.getElementById("sitecontainer").offsetWidth;
	var height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
	
    return [width, height]
}

function resizeFlashBackground() {
	
	var size = GetWindowSize();
	document.getElementById("background").style.width = size[0];
	document.getElementById("background").style.height = size[1];

}
