/*
	content:
	- javascript for fullscreen flash objects (resizing swf)
	  use 
*/


function getNewHPSWFHeight(){
	// 101: 	header without shadow
	// 57: 	footer without shadow
	// 420: 	minheight
	return Math.max((document.viewport.getHeight()-101-57-2), 420);
}

function resizeHomeSwf(id){					
	$(id).setStyle({height: getNewHPSWFHeight()+'px'});		
}

function insertFlash(prefs) {
		if (swfobject.hasFlashPlayerVersion("9.0.0")){
			$('wrap-bottom').setStyle({position: 'relative', top: 0});
			
			var newHeight = getNewHPSWFHeight();
			swfobject.embedSWF(prefs.swf_url, prefs.id, "100%", (newHeight)+"px", "9.0.0", false, prefs.optobj, {wmode: 'transparent', allowScriptAccess: 'always'}, {});		
			
			$(prefs.id).setStyle({height: newHeight+'px'});	
			
			$$('body')[0].addClassName('flashlp');
			Element.observe(window, 'resize', function(event){
				resizeHomeSwf(prefs.id);
			});
			
			// against renderbug in op9
			resizeHomeSwf.delay(0.5, prefs.id);		
		}
}