var Background = Class.create({
	initialize: function(expressInstall) {
		if(window.flbg != undefined) this.createBackground(expressInstall);
	},
	
	createBackground: function(expressInstall) {
		var dimensions = $(window.flbg.pageWrap).getDimensions();
		var fullHeight = dimensions.height;
		
		if (screen.height > fullHeight) {
			fullHeight = "100%";
			$('top').style.height = "100%";
		}else {
			fullHeight = fullHeight + "px";
		}
			
		var flashvars = {};
			flashvars.cpWhere = window.flbg.cpWhere
			flashvars.cpMade = window.flbg.cpMade
			flashvars.cpXMLPath = window.flbg.cpXMLPath
			flashvars.soundCat = window.flbg.soundCat
			flashvars.soundPath = window.flbg.soundPath
			flashvars.cpComponents = window.flbg.cpComponents			
		
		var params = {};
			params.base = "typo3conf/ext/flbg/res/";
			params.allowfullscreen = "true";
			params.quality = "best";
			params.wmode = "transparent";
			params.scale = "noScale";
			params.menu = "true";		
			
		var attributes = {};
			attributes.id = window.flbg.id;
			attributes.name = window.flbg.id;		

		swfobject.embedSWF("typo3conf/ext/flbg/res/flbg.swf", window.flbg.id, "100%", fullHeight.split("px").join("").toString(), "8", expressInstall, flashvars, params, attributes);
		
		$(window.flbg.id).wrap("div", { "class": window.flbg.id, "id": window.flbg.id+"ID"});	
		$(window.flbg.id).style.height = fullHeight;
		$$("."+window.flbg.id)[0].style.height = fullHeight;		
		
		$(window.flbg.pageWrap).wrap("div", {"id": "cpPageT3"});			
	}
});

UClass.background = Background;
