var footer, swf, swfWap,html;
var targetW = 990;
var targetH = 600;
var footerH = 30;
var strW = targetW + 'px';
var strH = targetH + 'px';
var resizeInterval;

function ini(){
	setTimeout(function(){
		Element.removeClassName($("wap"),"noflash");
		footer = $( 'ftIndex' );
		swfWap =  $( 'wap' );
		swf = $( 'flash_movie' );
		Event.observe(window, 'resize', onResizeWindow, false);
	},0);
	setTimeout(fixSize,10);
}

function onResizeWindow(){
	clearInterval(resizeInterval);
	resizeInterval = setTimeout(fixSize,50);
}

function fixSize(){
		var w = 0;
		var h = 0;
		if ( document.documentElement && document.documentElement.clientWidth ){
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		}else if ( document.body && document.body.clientWidth ){
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}else{
			w = window.innerWidth;
			h = window.innerHeight;
		}
		if ( w == 0 || h == 0 ) return;
		if ( w < targetW && h < targetH + footerH ){
				swf.style.width = strW;
				swf.style.height = strH;
				swfWap.style.width = strW;
				swfWap.style.height = strH;
		}else if ( w < targetW ){
				swf.style.width = strW;
				swf.style.height = ( h - footerH ) + 'px';
				swfWap.style.width = strW;
				swfWap.style.height = ( h - footerH ) + 'px';
		}else if ( h < targetH + footerH ){
				swf.style.width = '100%';
				swf.style.height = strH;
				swfWap.style.width = '100%';
				swfWap.style.height = strH;
		}else{
				swf.style.width = '100%';
				swf.style.height = ( h - footerH ) + 'px';
				swfWap.style.width = '100%';
				swfWap.style.height = ( h - footerH ) + 'px';
		}
}

{
	
	var flashvars = {	//dir: '',
		dir: 'flash/',
		rss: 'common/rss/'
	};
	var params = {
		menu: 'false'
	};
	var attributes = {};
	swfobject.embedSWF( flashvars.dir + 'Index.swf', 'flash_movie', '100%', '100%', '9.0.0.0', flashvars.dir + 'Installer.swf', flashvars, params, attributes );
	swfobject.addDomLoadEvent(ini);
}