var addEvent = function(elem, type, eventHandle) {
    if (elem == null || elem == undefined) return;
    if ( elem.addEventListener ) {
        elem.addEventListener( type, eventHandle, false );
    } else if ( elem.attachEvent ) {
        elem.attachEvent( "on" + type, eventHandle );
    }
};

function fensterbreite () {
	if (window.innerWidth) {
		return window.innerWidth;
	}
	else {
		if (window.document.documentElement &&
			window.document.documentElement.clientWidth) {
			return window.document.documentElement.clientWidth;
		}
		return window.document.body.offsetWidth;
	}
}

function fensterhoehe () {
	if (window.innerHeight) {
		return window.innerHeight;
	}
	else {
		if (window.document.documentElement
			&& window.document.documentElement.clientHeight) {
			return window.document.documentElement.clientHeight;
		}
		return window.document.body.offsetHeight;
	} 
}

addEvent(window, "resize", handleResize );

function handleResize() {
	var wgh = fensterhoehe();
	var wgw = fensterbreite();

	var con = document.getElementById('flashcontent');

	if( wgw <= 1280 ) {
		if( wgw < 640 ) {
			con.width = 640;
		}
		else {
			con.width = (wgw - 30);
		}
	}
	else {
		con.width = 1280;
	}

	if( wgh < 800 ) {
		if( wgh < 480 ) {
			con.height = 480;
		}
		else {
			con.height = (wgh - 20);
		}
	}
	else {
		var mtop = (wgh - 825) / 2;
		con.style.marginTop = mtop + 'px';
		con.height = 800;
	}
}
